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>
|
|
|
|
|
2023-07-10 20:50:58 +00:00
|
|
|
#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 {
|
|
|
|
|
2023-07-10 20:50:58 +00:00
|
|
|
class Window : public waybar::AAppIconLabel, public EventHandler {
|
2021-05-27 13:40:54 +00:00
|
|
|
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
|
|
|
|
2021-05-27 13:40:54 +00:00
|
|
|
private:
|
2023-06-19 20:08:03 +00:00
|
|
|
struct Workspace {
|
2023-06-19 21:42:19 +00:00
|
|
|
int id;
|
2023-06-19 20:08:03 +00:00
|
|
|
int windows;
|
|
|
|
std::string last_window;
|
|
|
|
std::string last_window_title;
|
|
|
|
|
2024-02-25 11:11:22 +00:00
|
|
|
static auto parse(const Json::Value& value) -> Workspace;
|
2023-06-19 20:08:03 +00:00
|
|
|
};
|
|
|
|
|
2023-07-08 19:42:28 +00:00
|
|
|
struct WindowData {
|
|
|
|
bool floating;
|
2023-07-08 20:05:15 +00:00
|
|
|
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;
|
2023-07-12 16:01:45 +00:00
|
|
|
bool fullscreen;
|
|
|
|
bool grouped;
|
2023-07-08 19:42:28 +00:00
|
|
|
|
|
|
|
static auto parse(const Json::Value&) -> WindowData;
|
|
|
|
};
|
|
|
|
|
2024-02-25 11:11:22 +00:00
|
|
|
static auto getActiveWorkspace(const std::string&) -> Workspace;
|
|
|
|
static auto getActiveWorkspace() -> Workspace;
|
|
|
|
void onEvent(const std::string& ev) override;
|
2023-06-19 20:08:03 +00:00
|
|
|
void queryActiveWorkspace();
|
|
|
|
void setClass(const std::string&, bool enable);
|
2022-07-01 10:46:28 +00:00
|
|
|
|
2024-02-25 11:11:22 +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_;
|
2024-02-25 11:11:22 +00:00
|
|
|
WindowData windowData_;
|
2023-06-19 20:08:03 +00:00
|
|
|
Workspace workspace_;
|
2024-02-25 11:11:22 +00:00
|
|
|
std::string soloClass_;
|
|
|
|
std::string lastSoloClass_;
|
2023-06-20 00:23:03 +00:00
|
|
|
bool solo_;
|
2024-02-25 11:11:22 +00:00
|
|
|
bool allFloating_;
|
2023-07-12 16:01:45 +00:00
|
|
|
bool swallowing_;
|
2023-06-20 00:23:03 +00:00
|
|
|
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
|