Files
Waybar/include/modules/hyprland/window.hpp
T

68 lines
1.5 KiB
C++
Raw Normal View History

2023-09-02 15:22:26 -05:00
#pragma once
2022-07-01 12:46:28 +02:00
#include <fmt/format.h>
2023-09-02 15:22:26 -05:00
#include <string>
2023-07-10 22:50:58 +02:00
#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 {
2023-07-10 22:50:58 +02:00
class Window : public waybar::AAppIconLabel, public EventHandler {
2021-05-27 15:40:54 +02:00
public:
2022-07-01 12:46:28 +02:00
Window(const std::string&, const waybar::Bar&, const Json::Value&);
2023-10-21 16:52:23 +02:00
~Window() override;
2022-07-01 12:46:28 +02:00
2023-03-02 16:57:07 +03:00
auto update() -> void override;
2022-08-17 21:54:23 +02:00
2021-05-27 15:40:54 +02:00
private:
struct Workspace {
int id = 0;
int windows = 0;
std::string last_window;
std::string last_window_title;
2024-02-25 12:11:22 +01:00
static auto parse(const Json::Value& value) -> Workspace;
};
2023-07-08 21:42:28 +02:00
struct WindowData {
bool floating = false;
2023-07-08 22:05:15 +02:00
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 = false;
bool grouped = false;
2023-07-08 21:42:28 +02:00
static auto parse(const Json::Value&) -> WindowData;
};
2024-02-25 12:11:22 +01:00
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 12:46:28 +02:00
bool separateOutputs_ = false;
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_;
2024-02-25 12:11:22 +01:00
WindowData windowData_;
Workspace workspace_;
2024-02-25 12:11:22 +01:00
std::string soloClass_;
std::string lastSoloClass_;
bool solo_ = false;
bool allFloating_ = false;
bool swallowing_ = false;
bool fullscreen_ = false;
bool focused_ = false;
2025-02-19 00:58:08 +01:00
IPC& m_ipc;
2022-07-01 12:46:28 +02:00
};
2022-11-09 09:34:19 +01:00
} // namespace waybar::modules::hyprland