deine mum

This commit is contained in:
2025-12-09 19:41:15 +01:00
parent fb64f542a9
commit a8ae2d1f0f
3 changed files with 31 additions and 5 deletions

View File

@@ -1,9 +1,10 @@
#pragma once
#include <glibmm.h>
#include <map>
#include <sigc++/sigc++.h>
#include <string>
#include <map>
#include <iostream>
class HyprlandService
{
@@ -29,7 +30,29 @@ class HyprlandService
HyprlandService();
~HyprlandService();
sigc::signal<void(std::string, std::string)> on_event;
// For debugging purposes
void printMonitor(const Monitor mon) {
std::cout << "=== Monitor Info ===\n";
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) {
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";
}
}
std::cout << "====================\n";
}
sigc::signal<void(std::string, std::string)> socketEventSignal;
void start();
void on_hyprland_event(std::string event, std::string data);

View File

@@ -32,7 +32,7 @@ Bar::Bar()
&Clock::onUpdate),
1000);
hyprland.on_event.connect(
hyprland.socketEventSignal.connect(
sigc::mem_fun(this->hyprland, &HyprlandService::on_hyprland_event));
hyprland.start();

View File

@@ -25,7 +25,10 @@ HyprlandService::~HyprlandService()
void HyprlandService::on_hyprland_event(std::string event, std::string data)
{
// std::cout << event << " " << data << std::endl;
if (event == "workspacev2")
{
std::cout << event << " " << data << std::endl;
}
}
void HyprlandService::start()
@@ -158,7 +161,7 @@ void HyprlandService::parse_message(const std::string &line)
std::string event_name = line.substr(0, split);
std::string event_data = line.substr(split + 2);
on_event.emit(event_name, event_data);
socketEventSignal.emit(event_name, event_data);
}
}