#pragma once #include #include #include #include "config.hpp" #include "modules/base.hpp" #include "drawtypes/icon.hpp" #include "drawtypes/label.hpp" namespace modules { namespace i3 { enum Flag { WORKSPACE_NONE, WORKSPACE_FOCUSED, WORKSPACE_UNFOCUSED, WORKSPACE_VISIBLE, WORKSPACE_URGENT, // used when the monitor is unfocused WORKSPACE_DIMMED, }; struct Workspace { int idx; Flag flag; std::unique_ptr label; Workspace(int idx, Flag flag, std::unique_ptr label) { this->idx = idx; this->flag = flag; this->label.swap(label); } operator bool() { return this->label && *this->label; } }; } DefineModule(i3Module, EventModule) { static constexpr auto TAG_LABEL_STATE = ""; static constexpr auto EVENT_CLICK = "i3"; std::unique_ptr ipc; // std::map> mode_labels; std::map> state_labels; std::vector> workspaces; // std::vector*> modes; std::unique_ptr icons; std::string monitor; bool local_workspaces = true; std::size_t workspace_name_strip_nchars = 0; int ipc_fd = -1; public: i3Module(std::string name, std::string monitor); ~i3Module(); void start(); bool has_event(); bool update(); bool build(Builder *builder, std::string tag); bool handle_command(std::string cmd); bool register_for_events() const { return true; } }; }