waybar/include/modules/hyprland/window.hpp

61 lines
1.4 KiB
C++
Raw Permalink Normal View History

2022-07-01 12:46:28 +02:00
#include <fmt/format.h>
#include "AAppIconLabel.hpp"
2022-07-01 12:46:28 +02:00
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "util/json.hpp"
namespace waybar::modules::hyprland {
class Window : public waybar::AAppIconLabel, public EventHandler {
public:
2022-07-01 12:46:28 +02:00
Window(const std::string&, const waybar::Bar&, const Json::Value&);
2023-03-02 14:57:07 +01:00
virtual ~Window();
2022-07-01 12:46:28 +02:00
2023-03-02 14:57:07 +01:00
auto update() -> void override;
2022-08-17 21:54:23 +02:00
private:
struct Workspace {
int id;
int windows;
std::string last_window;
std::string last_window_title;
static auto parse(const Json::Value&) -> Workspace;
};
2023-07-08 21:42:28 +02:00
struct WindowData {
bool floating;
int monitor = -1;
2023-07-08 21:42:28 +02:00
std::string class_name;
std::string initial_class_name;
std::string title;
std::string initial_title;
bool fullscreen;
bool grouped;
2023-07-08 21:42:28 +02:00
static auto parse(const Json::Value&) -> WindowData;
};
auto getActiveWorkspace(const std::string&) -> Workspace;
auto getActiveWorkspace() -> Workspace;
2023-03-02 14:57:07 +01:00
void onEvent(const std::string&) override;
void queryActiveWorkspace();
void setClass(const std::string&, bool enable);
2022-07-01 12:46:28 +02:00
bool separate_outputs;
2022-08-17 21:54:23 +02:00
std::mutex mutex_;
2022-07-01 12:46:28 +02:00
const Bar& bar_;
util::JsonParser parser_;
2023-07-08 21:42:28 +02:00
WindowData window_data_;
Workspace workspace_;
std::string solo_class_;
std::string last_solo_class_;
bool solo_;
bool all_floating_;
bool swallowing_;
bool fullscreen_;
2022-07-01 12:46:28 +02:00
};
2022-11-09 09:34:19 +01:00
} // namespace waybar::modules::hyprland