hyprland: port scripts off hyprlang hyprctl syntax

With the Lua config, `hyprctl dispatch` evaluates Lua rather than the
hyprlang dispatcher strings, and `hyprctl keyword` is refused outright
("can't work with non-legacy parsers"). Three scripts still used the old
forms and silently failed.

- toggle_floating (SUPER+W): rewritten around hl.dsp.window.{float,resize,
  center}. The Lua resize dispatcher takes absolute pixels only, so the
  70% is resolved against the logical size of the window's monitor, and
  fullscreen is left first since resize is a no-op while fullscreen.
  Floats every window at 70%x70% now, not just 50%x55% for kitty.
- performance: runtime overrides via `hyprctl eval hl.config{}`; drop the
  removed decoration:drop_shadow for decoration:shadow:enabled; read the
  gamemode flag from `getoption -j` (.bool), which the awk on line 2 had
  been picking the "set:" line out of.
- move_by_rules: movetoworkspace -> hl.dsp.window.move{workspace=N}.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StGBghPW9Dm7z7uj2VNWHr
This commit is contained in:
2026-09-04 15:21:05 +02:00
parent 900cea0188
commit 108ea36cca
3 changed files with 40 additions and 35 deletions

View File

@@ -1,12 +1,18 @@
#!/usr/bin/env sh
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==2{print $2}')
# 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" = 1 ]; then
if [ "$HYPRGAMEMODE" = true ]; then
sed -i 's/^\(.*animation:.*\)$/\/\* \1 \*\//g' $FILE
fi
@@ -14,15 +20,20 @@ killall waybar
waybar > /dev/null 2>&1 &
# Hyprland performance
if [ "$HYPRGAMEMODE" = 1 ]; then
hyprctl --batch "\
keyword animations:enabled 0;\
keyword decoration:drop_shadow 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"
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