make game mode persistent

This commit is contained in:
end-4
2026-03-18 08:23:44 +01:00
parent c538505f94
commit 3ca94d1e70
5 changed files with 170 additions and 11 deletions
@@ -1,11 +1,6 @@
import QtQuick
import Quickshell
import Quickshell.Io
import qs
import qs.services
import qs.modules.common
import qs.modules.common.functions
import qs.modules.common.widgets
QuickToggleModel {
id: root
@@ -14,11 +9,29 @@ QuickToggleModel {
icon: "gamepad"
mainAction: () => {
root.toggled = !root.toggled
root.toggled = !root.toggled;
if (root.toggled) {
Quickshell.execDetached(["bash", "-c", `hyprctl --batch "keyword animations:enabled 0; keyword decoration:shadow:enabled 0; keyword decoration:blur:enabled 0; keyword general:gaps_in 0; keyword general:gaps_out 0; keyword general:border_size 1; keyword decoration:rounding 0; keyword general:allow_tearing 1"`])
HyprlandConfig.setMany({
"animations:enabled": 0,
"decoration:shadow:enabled": 0,
"decoration:blur:enabled": 0,
"general:gaps_in": 0,
"general:gaps_out": 0,
"general:border_size": 1,
"decoration:rounding": 0,
"general:allow_tearing": 1
});
} else {
Quickshell.execDetached(["hyprctl", "reload"])
HyprlandConfig.resetMany([ //
"animations:enabled", //
"decoration:shadow:enabled", //
"decoration:blur:enabled", //
"general:gaps_in", //
"general:gaps_out", //
"general:border_size", //
"decoration:rounding", //
"general:allow_tearing", //
]);
}
}
Process {
@@ -26,7 +39,7 @@ QuickToggleModel {
running: true
command: ["bash", "-c", `test "$(hyprctl getoption animations:enabled -j | jq ".int")" -ne 0`]
onExited: (exitCode, exitStatus) => {
root.toggled = exitCode !== 0 // Inverted because enabled = nonzero exit
root.toggled = exitCode !== 0; // Inverted because enabled = nonzero exit
}
}
tooltipText: Translation.tr("Game mode")