deine mum
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <glibmm.h>
|
#include <glibmm.h>
|
||||||
#include <map>
|
|
||||||
#include <sigc++/sigc++.h>
|
#include <sigc++/sigc++.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
class HyprlandService
|
class HyprlandService
|
||||||
{
|
{
|
||||||
@@ -29,7 +30,29 @@ class HyprlandService
|
|||||||
HyprlandService();
|
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 start();
|
||||||
void on_hyprland_event(std::string event, std::string data);
|
void on_hyprland_event(std::string event, std::string data);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ Bar::Bar()
|
|||||||
&Clock::onUpdate),
|
&Clock::onUpdate),
|
||||||
1000);
|
1000);
|
||||||
|
|
||||||
hyprland.on_event.connect(
|
hyprland.socketEventSignal.connect(
|
||||||
sigc::mem_fun(this->hyprland, &HyprlandService::on_hyprland_event));
|
sigc::mem_fun(this->hyprland, &HyprlandService::on_hyprland_event));
|
||||||
|
|
||||||
hyprland.start();
|
hyprland.start();
|
||||||
|
|||||||
@@ -25,7 +25,10 @@ HyprlandService::~HyprlandService()
|
|||||||
void HyprlandService::on_hyprland_event(std::string event, std::string data)
|
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()
|
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_name = line.substr(0, split);
|
||||||
std::string event_data = line.substr(split + 2);
|
std::string event_data = line.substr(split + 2);
|
||||||
|
|
||||||
on_event.emit(event_name, event_data);
|
socketEventSignal.emit(event_name, event_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user