forked from Shinonome/dots-hyprland
sidebar: android-style quick toggles & sliders (#2217)
Co-Authored-By: Vague Syntax <173799252+vaguesyntax@users.noreply.github.com>
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
import qs.modules.common
|
||||
import qs.modules.common.widgets
|
||||
import qs.services
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
AndroidQuickToggleButton {
|
||||
id: root
|
||||
|
||||
name: Translation.tr("Game mode")
|
||||
toggled: toggled
|
||||
buttonIcon: "gamepad"
|
||||
|
||||
onClicked: {
|
||||
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"`])
|
||||
} else {
|
||||
Quickshell.execDetached(["hyprctl", "reload"])
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
StyledToolTip {
|
||||
text: Translation.tr("Game mode")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user