dein bruder
This commit is contained in:
21
include/app.hpp
Normal file
21
include/app.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "bar/bar.hpp"
|
||||
#include "glibmm/refptr.h"
|
||||
#include "gtkmm/application.h"
|
||||
#include "services/hyprland.hpp"
|
||||
|
||||
class App {
|
||||
public:
|
||||
App();
|
||||
|
||||
int run();
|
||||
private:
|
||||
Glib::RefPtr<Gtk::Application> app;
|
||||
std::vector<Bar*> bars;
|
||||
HyprlandService hyprlandService;
|
||||
|
||||
void setupServices();
|
||||
};
|
||||
@@ -9,11 +9,10 @@
|
||||
class Bar : public Gtk::Window
|
||||
{
|
||||
public:
|
||||
Bar();
|
||||
Bar(GdkMonitor* monitor, HyprlandService::Monitor* hyprlandMonitor);
|
||||
|
||||
protected:
|
||||
Clock clock;
|
||||
HyprlandService hyprland;
|
||||
Gtk::CenterBox main_box{};
|
||||
|
||||
void setup_ui();
|
||||
@@ -1,23 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <glibmm.h>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <sigc++/sigc++.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
|
||||
class HyprlandService
|
||||
{
|
||||
typedef struct WorkspaceState
|
||||
{
|
||||
class HyprlandService {
|
||||
|
||||
public:
|
||||
typedef struct WorkspaceState {
|
||||
int id;
|
||||
bool active;
|
||||
bool focused;
|
||||
bool urgent;
|
||||
} WorkspaceState;
|
||||
|
||||
typedef struct Monitor
|
||||
{
|
||||
typedef struct Monitor {
|
||||
std::map<int, WorkspaceState> workspaceStates;
|
||||
std::string name;
|
||||
int x;
|
||||
@@ -26,7 +25,6 @@ class HyprlandService
|
||||
int focusedWorkspaceId;
|
||||
} Monitor;
|
||||
|
||||
public:
|
||||
HyprlandService();
|
||||
~HyprlandService();
|
||||
|
||||
@@ -36,17 +34,17 @@ class HyprlandService
|
||||
std::cout << "Name: " << mon.name << " (ID: " << mon.id << ")\n";
|
||||
std::cout << "Position: (" << mon.x << ", " << mon.y << ")\n";
|
||||
std::cout << "Focused Workspace ID: " << mon.focusedWorkspaceId << "\n";
|
||||
|
||||
|
||||
std::cout << "Workspaces:\n";
|
||||
if (mon.workspaceStates.empty()) {
|
||||
std::cout << " (None)\n";
|
||||
} else {
|
||||
for (const auto& pair : mon.workspaceStates) {
|
||||
for (const auto &pair : mon.workspaceStates) {
|
||||
const WorkspaceState ws = pair.second;
|
||||
std::cout << " - [ID: " << ws.id << "] "
|
||||
<< "Active: " << (ws.active ? "Yes" : "No") << " | "
|
||||
<< "Focused: " << (ws.focused ? "Yes" : "No") << " | "
|
||||
<< "Urgent: " << (ws.urgent ? "Yes" : "No") << "\n";
|
||||
<< "Active: " << (ws.active ? "Yes" : "No") << " | "
|
||||
<< "Focused: " << (ws.focused ? "Yes" : "No") << " | "
|
||||
<< "Urgent: " << (ws.urgent ? "Yes" : "No") << "\n";
|
||||
}
|
||||
}
|
||||
std::cout << "====================\n";
|
||||
@@ -57,10 +55,12 @@ class HyprlandService
|
||||
void start();
|
||||
void on_hyprland_event(std::string event, std::string data);
|
||||
|
||||
Monitor* getMonitorById(const int &name);
|
||||
|
||||
private:
|
||||
int m_fd = -1;
|
||||
std::string m_buffer;
|
||||
std::map<int, Monitor> monitors;
|
||||
std::map<int, Monitor*> monitors;
|
||||
|
||||
bool on_socket_read(Glib::IOCondition condition);
|
||||
void parse_message(const std::string &line);
|
||||
|
||||
Reference in New Issue
Block a user