primitive game mode toggle for Hyprland
This commit is contained in:
+2
-2
@@ -2,7 +2,7 @@ import QtQuick
|
|||||||
import qs.Config
|
import qs.Config
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: MaterialEasing.standardTime
|
duration: Appearance.anim.durations.normal
|
||||||
easing.bezierCurve: MaterialEasing.standard
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.BezierSpline
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import ZShell
|
||||||
|
import qs.Config
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property alias enabled: props.enabled
|
||||||
|
|
||||||
|
function setHyprConf(): void {
|
||||||
|
Hypr.extras.applyOptions({
|
||||||
|
"animations:enabled": 0,
|
||||||
|
"decoration:shadow:enabled": 0,
|
||||||
|
"decoration:blur:enabled": 0,
|
||||||
|
"general:border_size": 0,
|
||||||
|
"decoration:rounding": 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onEnabledChanged: {
|
||||||
|
if (enabled) {
|
||||||
|
setHyprConf();
|
||||||
|
if (Config.utilities.toasts.gameModeChanged)
|
||||||
|
Toaster.toast(qsTr("Game mode enabled"), qsTr("Disabled Hyprland animations, blur, shadows and corner radius"), "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 {
|
||||||
|
function onConfigReloaded(): void {
|
||||||
|
if (props.enabled)
|
||||||
|
root.setHyprConf();
|
||||||
|
}
|
||||||
|
|
||||||
|
target: Hypr
|
||||||
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
function disable(): void {
|
||||||
|
props.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function enable(): void {
|
||||||
|
props.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isEnabled(): bool {
|
||||||
|
return props.enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggle(): void {
|
||||||
|
props.enabled = !props.enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
target: "gameMode"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import QtQuick.Layouts
|
|||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Config
|
import qs.Config
|
||||||
import qs.Modules
|
import qs.Modules
|
||||||
|
import qs.Helpers
|
||||||
import qs.Daemons
|
import qs.Daemons
|
||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
@@ -79,6 +80,13 @@ CustomRect {
|
|||||||
adapter.enabled = !adapter.enabled;
|
adapter.enabled = !adapter.enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Toggle {
|
||||||
|
checked: GameMode.enabled
|
||||||
|
icon: GameMode.enabled ? "videogame_asset" : "videogame_asset_off"
|
||||||
|
|
||||||
|
onClicked: GameMode.enabled = !GameMode.enabled
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user