diff --git a/src/Compositor.cpp b/src/Compositor.cpp index a82bbd1c..a4a322d8 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1,6 +1,7 @@ #include "Compositor.hpp" #include "helpers/Splashes.hpp" #include +#include "debug/HyprCtl.hpp" int handleCritSignal(int signo, void* data) { Debug::log(LOG, "Hyprland received signal %d", signo); @@ -1477,4 +1478,21 @@ CWindow* CCompositor::getWindowByRegex(const std::string& regexp) { } return nullptr; +} + +wl_event_source* hyprCtlTickSource = nullptr; + +int hyprCtlTick(void* data) { + HyprCtl::tickHyprCtl(); // so that we dont get that race condition multithread bullshit + + wl_event_source_timer_update(hyprCtlTickSource, 16); // tick it 60/s, should be enough. +} + +void CCompositor::startHyprCtlTick() { + if (hyprCtlTickSource) + return; + + hyprCtlTickSource = wl_event_loop_add_timer(m_sWLEventLoop, hyprCtlTick, nullptr); + + wl_event_source_timer_update(hyprCtlTickSource, 16); } \ No newline at end of file diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 0357e08f..fd40d911 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -154,9 +154,11 @@ public: std::string explicitConfigPath; + void startHyprCtlTick(); + private: void initAllSignals(); - void setRandomSplash(); + void setRandomSplash(); }; diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 7d7c2dfa..b30c0392 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -592,16 +592,7 @@ void HyprCtl::tickHyprCtl() { } std::string getRequestFromThread(std::string rq) { - // we need to do something to wake hyprland up if VFR is enabled - - static auto *const PNOVFR = &g_pConfigManager->getConfigValuePtr("misc:no_vfr")->intValue; - - // TODO: is this safe...? - // this might be a race condition - // tested with 2 instances of `watch -n 0.1 hyprctl splash` and seems to not crash so I'll take that as a yes - if (!*PNOVFR) - g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_vMonitors.front().get()); - + while (HyprCtl::request != "" || HyprCtl::requestMade || HyprCtl::requestReady) { std::this_thread::sleep_for(std::chrono::milliseconds(5)); } diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 5f3560e1..770f42b0 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -120,8 +120,6 @@ void Events::listener_monitorFrame(void* owner, void* data) { g_pCompositor->sanityCheckWorkspaces(); g_pAnimationManager->tick(); - HyprCtl::tickHyprCtl(); // so that we dont get that race condition multithread bullshit - g_pConfigManager->dispatchExecOnce(); // We exec-once when at least one monitor starts refreshing, meaning stuff has init'd if (g_pConfigManager->m_bWantsMonitorReload) diff --git a/src/managers/ThreadManager.cpp b/src/managers/ThreadManager.cpp index 3ca4d550..e419911e 100644 --- a/src/managers/ThreadManager.cpp +++ b/src/managers/ThreadManager.cpp @@ -19,6 +19,8 @@ CThreadManager::CThreadManager() { HyprCtl::startHyprCtlSocket(); + g_pCompositor->startHyprCtlTick(); + m_esConfigTimer = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, handleTimer, this); wl_event_source_timer_update(m_esConfigTimer, 1000);