blob: b9692d985bfa33c8637194934042f4b335cc5ebb (
plain) (
blame)
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
77
78
79
80
|
#!/usr/bin/env bash
# ==================================================
# KoolDots (2026)
# Project URL: https://github.com/LinuxBeginnings
# License: GNU GPLv3
# SPDX-License-Identifier: GPL-3.0-or-later
# ==================================================
# Game Mode. Turning off all animations
notif="${XDG_CONFIG_HOME:-$HOME/.config}/swaync/images/ja.png"
SCRIPTSDIR="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts"
# shellcheck source=/dev/null
. "$SCRIPTSDIR/WallpaperCmd.sh"
# Detect active Hyprland config mode (Lua entrypoint vs legacy .conf includes)
config_home="${XDG_CONFIG_HOME:-${XDG_CONFIG_HOME:-$HOME/.config}}"
hypr_dir="$config_home/hypr"
lua_entry="$hypr_dir/hyprland.lua"
legacy_lua_entry="$config_home/hyprland.lua"
if [[ -f "$lua_entry" || -f "$legacy_lua_entry" ]]; then
hypr_config_mode="lua"
else
hypr_config_mode="conf"
fi
# Check if animations are currently enabled
HYPRGAMEMODE=$(hyprctl getoption animations:enabled -j | jq -r '.bool' 2>/dev/null)
if [[ "$HYPRGAMEMODE" == "null" || -z "$HYPRGAMEMODE" ]]; then
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
fi
if [ "$HYPRGAMEMODE" = "true" ] || [ "$HYPRGAMEMODE" = "1" ] ; then
# ENABLE Game Mode (Disable animations/decorations)
if [[ "$hypr_config_mode" == "lua" ]]; then
hyprctl eval "hl.config({
animations = { enabled = false },
decoration = { shadow = { enabled = false }, blur = { enabled = false }, rounding = 0 },
general = { gaps_in = 0, gaps_out = 0, border_size = 1 }
})"
hyprctl eval "hl.window_rule({ name = 'gamemode-opacity', match = { class = '.*' }, opacity = 1.0 })"
else
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"
hyprctl keyword "windowrule opacity 1 override 1 override 1 override, ^(.*)$"
fi
"$WWW_CMD" kill
notify-send -e -u low -i "$notif" " Gamemode:" " enabled"
sleep 0.1
exit
else
# DISABLE Game Mode (Restore animations/decorations)
hyprctl reload
# Restore wallpaper using the official daemon script
if [[ -x "${SCRIPTSDIR}/WallpaperDaemon.sh" ]]; then
"${SCRIPTSDIR}/WallpaperDaemon.sh" &
fi
sleep 0.1
if [[ -x "${SCRIPTSDIR}/WallustSwww.sh" ]]; then
"${SCRIPTSDIR}/WallustSwww.sh"
fi
sleep 0.5
# Refresh UI components
if [[ -x "${SCRIPTSDIR}/Refresh.sh" ]]; then
"${SCRIPTSDIR}/Refresh.sh"
fi
notify-send -e -u normal -i "$notif" " Gamemode:" " disabled"
exit
fi
|