diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json
index 5c21b5823..d4a9575f4 100644
--- a/Assets/Translations/en.json
+++ b/Assets/Translations/en.json
@@ -1221,7 +1221,10 @@
},
"hooks": {
"info-command-info-description": "• Commands are executed via shell (sh -lc)
• Commands run in background (detached)
• Test buttons execute with current values",
- "info-parameters-description": "• Wallpaper hook: $1 = wallpaper path, $2 = screen name, $3 = theme (dark/light)
• Theme toggle hook: $1 = true/false (Dark Mode state)
• Screen lock/unlock hooks: $1 = lock/unlock (screen lock state)
• Performance mode hooks: No parameters
• Session hook: $1 = action (shutdown/reboot)",
+ "color-generation-description": "Command to be executed when color generation completes (e.g. after wallpaper-based theming).",
+ "color-generation-label": "Colors generated",
+ "color-generation-placeholder": "e.g. notify-send \"Colors\" \"Generated\"",
+ "info-parameters-description": "• Wallpaper hook: $1 = wallpaper path, $2 = screen name, $3 = theme (dark/light)
• Color generation hook: $1 = theme (dark/light)
• Theme toggle hook: $1 = true/false (Dark Mode state)
• Screen lock/unlock hooks: $1 = lock/unlock (screen lock state)
• Performance mode hooks: No parameters
• Session hook: $1 = action (shutdown/reboot)",
"info-parameters-label": "Available parameters",
"noctalia-started-description": "Command to execute when Noctalia has finished loading.",
"noctalia-started-label": "Noctalia started",
diff --git a/Commons/Settings.qml b/Commons/Settings.qml
index fe44e8bab..c2936257f 100644
--- a/Commons/Settings.qml
+++ b/Commons/Settings.qml
@@ -738,6 +738,7 @@ Singleton {
property string performanceModeDisabled: ""
property string startup: ""
property string session: ""
+ property string colorGeneration: ""
}
// plugins
diff --git a/Modules/Panels/Settings/Tabs/Hooks/HooksListSubTab.qml b/Modules/Panels/Settings/Tabs/Hooks/HooksListSubTab.qml
index 3540c598d..9e434c05a 100644
--- a/Modules/Panels/Settings/Tabs/Hooks/HooksListSubTab.qml
+++ b/Modules/Panels/Settings/Tabs/Hooks/HooksListSubTab.qml
@@ -72,6 +72,20 @@ ColumnLayout {
})
}
+ // Color Generation Hook
+ HookRow {
+ label: I18n.tr("panels.hooks.color-generation-label")
+ description: I18n.tr("panels.hooks.color-generation-description")
+ value: Settings.data.hooks.colorGeneration
+ onEditClicked: openEdit(label, description, I18n.tr("panels.hooks.color-generation-placeholder"), value, newValue => {
+ Settings.data.hooks.colorGeneration = newValue;
+ Settings.saveImmediate();
+ }, val => {
+ if (val)
+ Quickshell.execDetached(["sh", "-lc", val.replace("$1", "dark")]);
+ })
+ }
+
// Theme Hook
HookRow {
label: I18n.tr("panels.hooks.theme-changed-label")
diff --git a/Services/Control/HooksService.qml b/Services/Control/HooksService.qml
index d179d7b9c..c11c8c74b 100644
--- a/Services/Control/HooksService.qml
+++ b/Services/Control/HooksService.qml
@@ -55,6 +55,7 @@ Singleton {
root.pendingWallpaperHook = null;
executeWallpaperHook(hook.path, hook.screenName);
}
+ executeColorGenerationHook();
}
}
@@ -225,6 +226,27 @@ Singleton {
}
}
+ // Execute color generation hook
+ function executeColorGenerationHook() {
+ if (!Settings.data.hooks?.enabled) {
+ return;
+ }
+
+ const script = Settings.data.hooks?.colorGeneration;
+ if (!script || script === "") {
+ return;
+ }
+
+ try {
+ const theme = Settings.data.colorSchemes.darkMode ? "dark" : "light";
+ const command = script.replace(/\$1/g, theme);
+ Quickshell.execDetached(["sh", "-lc", command]);
+ Logger.d("HooksService", `Executed color generation hook: ${command}`);
+ } catch (e) {
+ Logger.e("HooksService", `Failed to execute color generation hook: ${e}`);
+ }
+ }
+
// Blocking power hook infrastructure
property var pendingPowerCallback: null