1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
pragma Singleton
import qs.services
import qs.config
import Caelestia
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
id: root
property alias enabled: props.enabled
function setDynamicConfs(): void {
Hypr.extras.applyOptions({
"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
});
}
onEnabledChanged: {
if (enabled) {
setDynamicConfs();
if (Config.utilities.toasts.gameModeChanged)
Toaster.toast(qsTr("Game mode enabled"), qsTr("Disabled Hyprland animations, blur, gaps and shadows"), "gamepad");
} else {
Hypr.extras.message("reload");
if (Config.utilities.toasts.gameModeChanged)
Toaster.toast(qsTr("Game mode disabled"), qsTr("Hyprland settings restored"), "gamepad");
}
}
PersistentProperties {
id: props
property bool enabled: Hypr.options["animations:enabled"] === 0
reloadableId: "gameMode"
}
Connections {
target: Hypr
function onConfigReloaded(): void {
if (props.enabled)
root.setDynamicConfs();
}
}
IpcHandler {
target: "gameMode"
function isEnabled(): bool {
return props.enabled;
}
function toggle(): void {
props.enabled = !props.enabled;
}
function enable(): void {
props.enabled = true;
}
function disable(): void {
props.enabled = false;
}
}
}
|