dein bruder

This commit is contained in:
2025-12-09 22:09:26 +01:00
parent a8ae2d1f0f
commit 25c73f67a7
9 changed files with 119 additions and 60 deletions

47
src/app.cpp Normal file
View File

@@ -0,0 +1,47 @@
#include "app.hpp"
#include <sigc++/sigc++.h>
App::App() {
this->setupServices();
this->app = Gtk::Application::create("org.example.mybar");
app->signal_activate().connect([&]() {
auto display = Gdk::Display::get_default();
auto monitors = display->get_monitors();
for (guint i = 0; i < monitors->get_n_items(); ++i) {
auto monitor = std::dynamic_pointer_cast<Gdk::Monitor>(
monitors->get_object(i));
if (monitor) {
auto hyprlanMonitor = this->hyprlandService.getMonitorById(i);
auto bar = new Bar(monitor->gobj(), hyprlanMonitor);
this->hyprlandService.printMonitor(*hyprlanMonitor); // Debugging output
bar->set_application(app);
bar->show();
bars.push_back(bar);
}
}
});
app->signal_shutdown().connect([&]() {
for (auto bar : bars) {
delete bar;
}
bars.clear();
});
}
void App::setupServices() {
this->hyprlandService.socketEventSignal.connect(sigc::mem_fun(
this->hyprlandService, &HyprlandService::on_hyprland_event));
this->hyprlandService.start();
}
int App::run() {
return this->app->run();
}