From 3413c4a463c090fd64830a0aea2cd1e08ac1f673 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Sat, 26 Nov 2016 09:38:55 +0100 Subject: [PATCH] wip(xworkspaces): Monitor support --- include/modules/xworkspaces.hpp | 29 +++-- include/x11/ewmh.hpp | 3 + include/x11/randr.hpp | 2 + src/modules/bspwm.cpp | 1 + src/modules/xworkspaces.cpp | 206 +++++++++++++++++--------------- src/x11/ewmh.cpp | 14 +++ src/x11/randr.cpp | 8 ++ 7 files changed, 161 insertions(+), 102 deletions(-) diff --git a/include/modules/xworkspaces.hpp b/include/modules/xworkspaces.hpp index e76ed350..eb54885c 100644 --- a/include/modules/xworkspaces.hpp +++ b/include/modules/xworkspaces.hpp @@ -3,6 +3,7 @@ #include #include "components/config.hpp" +#include "components/types.hpp" #include "modules/meta/static_module.hpp" #include "x11/events.hpp" #include "x11/ewmh.hpp" @@ -22,10 +23,17 @@ namespace modules { OCCUPIED, }; - struct desktop { - explicit desktop(string&& name, desktop_state state) : name(name), state(state) {} + enum class viewport_state { + NONE, + FOCUSED, + UNFOCUSED, + }; + + struct viewport { + position pos; string name; - desktop_state state{desktop_state::NONE}; + vector> desktops; + viewport_state state; label_t label; }; @@ -37,6 +45,7 @@ namespace modules { xworkspaces_module(const bar_settings& bar, const logger& logger, const config& config, string name); void setup(); + void start(); void teardown(); void handle(const evt::property_notify& evt); void update(); @@ -49,18 +58,22 @@ namespace modules { private: static constexpr const char* DEFAULT_ICON{"icon-default"}; - static constexpr const char* DEFAULT_LABEL{"%icon% %name%"}; + static constexpr const char* DEFAULT_LABEL_STATE{"%icon% %name%"}; + static constexpr const char* DEFAULT_LABEL_MONITOR{"%name%"}; - static constexpr const char* TAG_LABEL{"