refactor gamemodetoggle's config option fetching

This commit is contained in:
end-4
2026-03-19 12:31:30 +01:00
parent 08b7b393cb
commit 5ac40d5445
3 changed files with 84 additions and 10 deletions
@@ -3,7 +3,7 @@ pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
import qs.modules.common
import qs.modules.common.functions
@@ -14,6 +14,8 @@ import qs.modules.common.functions
Singleton {
id: root
signal reloaded()
readonly property string configuratorScriptPath: Quickshell.shellPath("scripts/hyprland/hyprconfigurator.py")
readonly property string shellOverridesPath: FileUtils.trimFileProtocol(`${Directories.config}/hypr/hyprland/shellOverrides/main.conf`)
@@ -39,7 +41,7 @@ Singleton {
])
}
function resetMany(keys: var) {
function resetMany(keys: list<string>) {
let args = ""
for (let i = 0; i < keys.length; i++) {
args += `--reset "${keys[i]}" `
@@ -48,4 +50,14 @@ Singleton {
`${root.configuratorScriptPath} --file ${root.shellOverridesPath} ${args}` //
])
}
Connections {
target: Hyprland
function onRawEvent(event) {
if (event.name == "configreloaded") {
root.reloaded()
}
}
}
}