#include "app.hpp" #include #include #include "services/dbus/notification.hpp" #include "services/dbus/mpris.hpp" #include "services/textureCache.hpp" App::App() { this->app = Gtk::Application::create("org.example.mybar"); this->setupServices(); this->hyprlandService = HyprlandService::getInstance(); this->notificationService = std::make_shared(); this->mprisController = std::make_shared(); 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( monitors->get_object(i) ); if (monitor) { auto bar = std::make_shared(monitor->gobj()); bar->set_application(app); bar->show(); std::string monitorName = monitor->get_connector(); bar->addLeftWidget(hyprlandService->getWorkspaceIndicatorsForMonitor(monitorName)); hyprlandService->addBar(bar, monitorName); bars.push_back(bar); } } }); app->signal_shutdown().connect([&]() { this->trayService->stop(); }); } void App::setupServices() { TextureCacheService::getInstance()->pruneCache(); this->trayService->start(); } int App::run() { return this->app->run(); }