Waybar/include/modules/hyprland/window.hpp

66 lines
1.4 KiB
C++
Raw Normal View History

2023-09-02 20:22:26 +00:00
#pragma once
2022-07-01 10:46:28 +00:00
#include <fmt/format.h>
2023-09-02 20:22:26 +00:00
#include <string>
#include "AAppIconLabel.hpp"
2022-07-01 10:46:28 +00: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 10:46:28 +00:00
Window(const std::string&, const waybar::Bar&, const Json::Value&);
2023-10-21 14:52:23 +00:00
~Window() override;
2022-07-01 10:46:28 +00:00
2023-03-02 13:57:07 +00:00
auto update() -> void override;
2022-08-17 19:54:23 +00:00
private:
struct Workspace {
int id;
int windows;
std::string last_window;
std::string last_window_title;
static auto parse(const Json::Value& value) -> Workspace;
};
2023-07-08 19:42:28 +00:00
struct WindowData {
bool floating;
int monitor = -1;
2023-07-08 19:42:28 +00:00
std::string class_name;
std::string initial_class_name;
std::string title;
std::string initial_title;
bool fullscreen;
bool grouped;
2023-07-08 19:42:28 +00:00
static auto parse(const Json::Value&) -> WindowData;
};
static auto getActiveWorkspace(const std::string&) -> Workspace;
static auto getActiveWorkspace() -> Workspace;
void onEvent(const std::string& ev) override;
void queryActiveWorkspace();
void setClass(const std::string&, bool enable);
2022-07-01 10:46:28 +00:00
bool separateOutputs_;
2022-08-17 19:54:23 +00:00
std::mutex mutex_;
2022-07-01 10:46:28 +00:00
const Bar& bar_;
util::JsonParser parser_;
WindowData windowData_;
Workspace workspace_;
std::string soloClass_;
std::string lastSoloClass_;
bool solo_;
bool allFloating_;
bool swallowing_;
bool fullscreen_;
2024-02-26 21:00:16 +00:00
bool focused_;
2022-07-01 10:46:28 +00:00
};
2022-11-09 08:34:19 +00:00
} // namespace waybar::modules::hyprland