From 09bafd05a197dd1ca0b3e7e84213088f234c2fb6 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 30 Nov 2021 20:10:37 +0100 Subject: [PATCH] added exec-once --- example/hypr.conf | 5 +++++ src/config/ConfigManager.cpp | 8 ++++++++ src/config/ConfigManager.hpp | 2 ++ 3 files changed, 15 insertions(+) diff --git a/example/hypr.conf b/example/hypr.conf index 77cd364..6cf666d 100644 --- a/example/hypr.conf +++ b/example/hypr.conf @@ -9,6 +9,11 @@ gaps_out=20 rounding=0 max_fps=60 # max fps for updates of config & animations + +# Execs +# exec-once=/home/me/MyEpicShellScript # will exec the script only when the WM launches +# exec=/home/me/MyEpicShellScript # will exec the script every time the config is reloaded + # Bar config Bar { height=20 diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 090189f..6e59245 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -35,6 +35,10 @@ void ConfigManager::init() { configValues["anim.speed"].floatValue = 1; configValues["anim.enabled"].intValue = 1; + if (!g_pWindowManager->statusBar) { + isFirstLaunch = true; + } + loadConfigLoadVars(); applyKeybindsToX(); } @@ -257,6 +261,9 @@ void parseLine(std::string& line) { } else if (COMMAND == "exec") { handleRawExec(COMMAND, VALUE); return; + } else if (COMMAND == "exec-once" && ConfigManager::isFirstLaunch) { + handleRawExec(COMMAND, VALUE); + return; } else if (COMMAND == "status_command") { handleStatusCommand(COMMAND, VALUE); return; @@ -315,6 +322,7 @@ void ConfigManager::loadConfigLoadVars() { } loadBar = true; + isFirstLaunch = false; } void ConfigManager::applyKeybindsToX() { diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index c617d9e..18bdd28 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -17,6 +17,8 @@ namespace ConfigManager { inline bool isBar = false; // If true we send the command to the bar parser + inline bool isFirstLaunch = false; + void init(); void loadConfigLoadVars(); void tick();