2016-05-31 03:58:58 +00:00
|
|
|
#pragma once
|
2016-05-19 14:41:06 +00:00
|
|
|
|
2016-06-15 03:32:35 +00:00
|
|
|
#include "drawtypes/iconset.hpp"
|
2016-05-19 14:41:06 +00:00
|
|
|
#include "drawtypes/label.hpp"
|
2016-06-15 03:32:35 +00:00
|
|
|
#include "modules/meta.hpp"
|
|
|
|
#include "utils/bspwm.hpp"
|
|
|
|
|
|
|
|
LEMONBUDDY_NS
|
|
|
|
|
|
|
|
namespace modules {
|
2016-11-03 16:54:26 +00:00
|
|
|
enum class state_ws {
|
2016-06-15 03:32:35 +00:00
|
|
|
WORKSPACE_NONE,
|
|
|
|
WORKSPACE_ACTIVE,
|
|
|
|
WORKSPACE_URGENT,
|
|
|
|
WORKSPACE_EMPTY,
|
|
|
|
WORKSPACE_OCCUPIED,
|
|
|
|
WORKSPACE_DIMMED, // used when the monitor is out of focus
|
2016-11-03 16:54:26 +00:00
|
|
|
};
|
|
|
|
enum class state_mode {
|
2016-06-15 03:32:35 +00:00
|
|
|
MODE_NONE,
|
|
|
|
MODE_LAYOUT_MONOCLE,
|
|
|
|
MODE_LAYOUT_TILED,
|
|
|
|
MODE_STATE_FULLSCREEN,
|
|
|
|
MODE_STATE_FLOATING,
|
|
|
|
MODE_NODE_LOCKED,
|
|
|
|
MODE_NODE_STICKY,
|
|
|
|
MODE_NODE_PRIVATE
|
|
|
|
};
|
|
|
|
|
2016-11-03 16:54:26 +00:00
|
|
|
struct bspwm_monitor {
|
|
|
|
vector<pair<state_ws, label_t>> workspaces;
|
|
|
|
vector<label_t> modes;
|
2016-06-15 03:32:35 +00:00
|
|
|
label_t label;
|
2016-11-03 16:54:26 +00:00
|
|
|
string name;
|
|
|
|
bool focused = false;
|
2016-06-15 03:32:35 +00:00
|
|
|
};
|
2016-05-19 14:41:06 +00:00
|
|
|
|
2016-06-15 03:32:35 +00:00
|
|
|
class bspwm_module : public event_module<bspwm_module> {
|
|
|
|
public:
|
|
|
|
using event_module::event_module;
|
|
|
|
|
2016-11-02 19:22:45 +00:00
|
|
|
void setup();
|
|
|
|
void stop();
|
|
|
|
bool has_event();
|
|
|
|
bool update();
|
2016-11-03 16:54:26 +00:00
|
|
|
string get_output();
|
2016-11-02 19:22:45 +00:00
|
|
|
bool build(builder* builder, string tag) const;
|
|
|
|
bool handle_event(string cmd);
|
|
|
|
bool receive_events() const;
|
2016-06-15 03:32:35 +00:00
|
|
|
|
|
|
|
private:
|
2016-10-12 03:19:29 +00:00
|
|
|
static constexpr auto DEFAULT_WS_ICON = "ws-icon-default";
|
2016-06-15 03:32:35 +00:00
|
|
|
static constexpr auto DEFAULT_WS_LABEL = "%icon% %name%";
|
2016-11-03 16:54:26 +00:00
|
|
|
static constexpr auto DEFAULT_MONITOR_LABEL = "%name%";
|
|
|
|
static constexpr auto TAG_LABEL_MONITOR = "<label-monitor>";
|
2016-06-15 03:32:35 +00:00
|
|
|
static constexpr auto TAG_LABEL_STATE = "<label-state>";
|
|
|
|
static constexpr auto TAG_LABEL_MODE = "<label-mode>";
|
|
|
|
static constexpr auto EVENT_CLICK = "bwm";
|
|
|
|
|
2016-10-11 07:25:32 +00:00
|
|
|
bspwm_util::connection_t m_subscriber;
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-11-03 16:54:26 +00:00
|
|
|
vector<unique_ptr<bspwm_monitor>> m_monitors;
|
|
|
|
|
|
|
|
map<state_mode, label_t> m_modelabels;
|
|
|
|
map<state_ws, label_t> m_statelabels;
|
|
|
|
label_t m_monitorlabel;
|
2016-06-15 03:32:35 +00:00
|
|
|
iconset_t m_icons;
|
2016-11-03 16:54:26 +00:00
|
|
|
bool m_pinworkspaces = true;
|
2016-06-15 03:32:35 +00:00
|
|
|
string m_monitor;
|
|
|
|
unsigned long m_hash;
|
2016-11-03 16:54:26 +00:00
|
|
|
|
|
|
|
// used while formatting output
|
|
|
|
size_t m_index = 0;
|
2016-05-19 14:41:06 +00:00
|
|
|
};
|
|
|
|
}
|
2016-06-15 03:32:35 +00:00
|
|
|
|
|
|
|
LEMONBUDDY_NS_END
|