#pragma once #include "drawtypes/iconset.hpp" #include "drawtypes/label.hpp" #include "modules/meta.hpp" #include "utils/bspwm.hpp" LEMONBUDDY_NS namespace modules { enum class bspwm_flag { WORKSPACE_NONE, WORKSPACE_ACTIVE, WORKSPACE_URGENT, WORKSPACE_EMPTY, WORKSPACE_OCCUPIED, WORKSPACE_DIMMED, // used when the monitor is out of focus MODE_NONE, MODE_LAYOUT_MONOCLE, MODE_LAYOUT_TILED, MODE_STATE_FULLSCREEN, MODE_STATE_FLOATING, MODE_NODE_LOCKED, MODE_NODE_STICKY, MODE_NODE_PRIVATE }; struct bspwm_workspace { bspwm_flag flag; label_t label; bspwm_workspace(bspwm_flag flag, label_t&& label) : flag(flag), label(forward(label)) {} operator bool() { return label && *label; } }; using bspwm_workspace_t = unique_ptr; class bspwm_module : public event_module { public: using event_module::event_module; void setup(); void stop(); bool has_event(); bool update(); bool build(builder* builder, string tag) const; bool handle_event(string cmd); bool receive_events() const; private: static constexpr auto DEFAULT_WS_ICON = "ws-icon-default"; static constexpr auto DEFAULT_WS_LABEL = "%icon% %name%"; static constexpr auto TAG_LABEL_STATE = ""; static constexpr auto TAG_LABEL_MODE = ""; static constexpr auto EVENT_CLICK = "bwm"; bspwm_util::connection_t m_subscriber; map m_modelabels; map m_statelabels; vector m_workspaces; vector m_modes; iconset_t m_icons; string m_monitor; unsigned long m_hash; }; } LEMONBUDDY_NS_END