forked from Shinonome/dots-hyprland
47 lines
1.4 KiB
QML
47 lines
1.4 KiB
QML
import QtQuick
|
|
import Quickshell.Io
|
|
import qs.services
|
|
|
|
QuickToggleModel {
|
|
id: root
|
|
name: Translation.tr("Game mode")
|
|
toggled: toggled
|
|
icon: "gamepad"
|
|
|
|
mainAction: () => {
|
|
root.toggled = !root.toggled;
|
|
if (root.toggled) {
|
|
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 {
|
|
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 {
|
|
id: fetchActiveState
|
|
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
|
|
}
|
|
}
|
|
tooltipText: Translation.tr("Game mode")
|
|
}
|