Files
dotfiles/hypr/scripts/move_by_rules
Timo 108ea36cca 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
2026-09-04 15:21:05 +02:00

24 lines
914 B
Bash
Executable File

#!/bin/bash
# Script created by: https://github.com/moguay
# Retrieve the active class of the window
active_class=$(hyprctl -j activewindow | jq '.class')
active_class=$(echo "$active_class" | tr -d \")
# Read the file and store lines containing 'workspace' in an array
grep 'workspace' ~/.config/hypr/themes/luna/rules.conf | while IFS= read -r line; do
workspace_value=$(echo "$line" | sed -n -e 's/^.*workspace \([0-9]*\)[ ,].*$/\1/p')
class_value=$(echo "$line" | sed -n -e 's/^.*class:\s*\(.*\)$/\1/p')
regex=$class_value
if [ -n "$workspace_value" ] && [ -n "$class_value" ]; then
# Compare the retrieved value with the active class of the window
if echo "$active_class" | grep -E "$regex"; then
#echo "The class matches the active class of the window. Workspace value to apply: $workspace_value"
hyprctl dispatch "hl.dsp.window.move({ workspace = $workspace_value })"
fi
fi
done
exit 1