#!/usr/bin/env sh # Toggles "game mode": strips animations/blur/shadows/gaps for max performance, # and reloads the config to restore them. # # NOTE: with the Lua config `hyprctl keyword` is gone ("can't work with # non-legacy parsers"); runtime overrides go through `hyprctl eval hl.config{}`. HYPRGAMEMODE=$(hyprctl getoption animations:enabled -j | jq -r '.bool') # Waybar performance FILE="$HOME/.config/waybar/style.css" sed -i 's/\/\* \(.*animation:.*\) \*\//\1/g' $FILE if [ "$HYPRGAMEMODE" = true ]; then sed -i 's/^\(.*animation:.*\)$/\/\* \1 \*\//g' $FILE fi killall waybar "$HOME"/.config/hypr/scripts/bar > /dev/null 2>&1 & # Hyprland performance if [ "$HYPRGAMEMODE" = true ]; then hyprctl eval 'return hl.config({ animations = { enabled = false }, decoration = { rounding = 0, blur = { enabled = false }, shadow = { enabled = false }, }, general = { gaps_in = 0, gaps_out = 0, border_size = 1, }, })' exit fi hyprctl reload > /dev/null 2>&1 &