Merge branch 'end-4:main' into parallax

This commit is contained in:
Ivan Rosinskii
2026-03-23 08:09:39 +01:00
committed by GitHub
21 changed files with 591 additions and 288 deletions
@@ -0,0 +1,6 @@
import QtQuick
// QtObject that allows stuff to be freely declared inside
QtObject {
default property list<QtObject> data
}
@@ -0,0 +1,63 @@
pragma ComponentBehavior: Bound
import QtQml
import QtQuick
import Quickshell.Io
import qs.services
import "../"
NestableObject {
id: root
required property string key
property alias fetching: fetchProc.running
property bool set
property var value
Component.onCompleted: fetch()
Connections {
target: HyprlandConfig
function onReloaded() {
root.fetch();
}
}
function fetch() {
fetchProc.command = fetchProc.baseCommand.concat([root.key]);
fetchProc.running = true;
}
function setValue(newValue) {
HyprlandConfig.set(root.key, newValue)
}
function reset() {
HyprlandConfig.reset(root.key)
}
Process {
id: fetchProc
property list<string> baseCommand: ["hyprctl", "getoption", "-j"]
stdout: StdioCollector {
onStreamFinished: {
if (text == "no such option")
return;
try {
const obj = JSON.parse(text);
// Note that the value is returned as "<data type>": <value>
// It's the only field that isn't always in the same key so we put it in an else
for (const key in obj) {
if (key == "option")
continue;
else if (key == "set")
root.set = obj[key];
else
root.value = obj[key];
}
} catch (e) {
console.log(`[HyprlandConfigOption] Failed to fetch option "${root.key}":\n - Output: ${text.trim()}\n - Error: ${e}`);
}
}
}
}
}
@@ -8,10 +8,10 @@ QuickToggleModel {
name: Translation.tr("Anti-flashbang")
tooltipText: Translation.tr("Anti-flashbang")
icon: "flash_off"
toggled: Config.options.light.antiFlashbang.enable
toggled: HyprlandAntiFlashbangShader.enabled
mainAction: () => {
Config.options.light.antiFlashbang.enable = !Config.options.light.antiFlashbang.enable;
HyprlandAntiFlashbangShader.toggle()
}
hasMenu: true
}
@@ -1,11 +1,12 @@
import QtQuick
import Quickshell.Io
import qs.modules.common.models.hyprland
import qs.services
QuickToggleModel {
id: root
name: Translation.tr("Game mode")
toggled: toggled
toggled: !confOpt.value
icon: "gamepad"
mainAction: () => {
@@ -34,13 +35,11 @@ QuickToggleModel {
]);
}
}
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
}
HyprlandConfigOption {
id: confOpt
key: "animations:enabled"
}
tooltipText: Translation.tr("Game mode")
}