Hooks: expose to grab the screen name
This commit is contained in:
parent
46bc8939b4
commit
a9affb5ae4
3 changed files with 10 additions and 4 deletions
|
|
@ -47,7 +47,7 @@ ScrollView {
|
||||||
}
|
}
|
||||||
onActionClicked: {
|
onActionClicked: {
|
||||||
if (wallpaperHookInput.text) {
|
if (wallpaperHookInput.text) {
|
||||||
HooksService.executeWallpaperHook("test")
|
HooksService.executeWallpaperHook("test", "test-screen")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -88,6 +88,11 @@ ScrollView {
|
||||||
label: "Hook Command Information"
|
label: "Hook Command Information"
|
||||||
description: "• Commands are executed via shell (sh -c)\n• Commands run in background (detached)\n• Test buttons execute with current values"
|
description: "• Commands are executed via shell (sh -c)\n• Commands run in background (detached)\n• Test buttons execute with current values"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NLabel {
|
||||||
|
label: "Available Parameters"
|
||||||
|
description: "• Wallpaper Hook: $1 = wallpaper path, $2 = screen name\n• Theme Toggle Hook: $1 = true/false (dark mode state)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute wallpaper change hook
|
// Execute wallpaper change hook
|
||||||
function executeWallpaperHook(wallpaperPath) {
|
function executeWallpaperHook(wallpaperPath, screenName) {
|
||||||
if (!Settings.data.hooks?.enabled) {
|
if (!Settings.data.hooks?.enabled) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -28,7 +28,8 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const command = script.replace(/\$1/g, wallpaperPath)
|
let command = script.replace(/\$1/g, wallpaperPath)
|
||||||
|
command = command.replace(/\$2/g, screenName || "")
|
||||||
Quickshell.execDetached(["sh", "-c", command])
|
Quickshell.execDetached(["sh", "-c", command])
|
||||||
Logger.log("HooksService", `Executed wallpaper hook: ${command}`)
|
Logger.log("HooksService", `Executed wallpaper hook: ${command}`)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -288,7 +288,7 @@ Singleton {
|
||||||
|
|
||||||
// Execute wallpaper change hook after the change is complete
|
// Execute wallpaper change hook after the change is complete
|
||||||
if (HooksService) {
|
if (HooksService) {
|
||||||
HooksService.executeWallpaperHook(path)
|
HooksService.executeWallpaperHook(path, screenName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restart the random wallpaper timer
|
// Restart the random wallpaper timer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue