Files
dotfiles/hypr/scripts/performance
Timo bed974bd4d waybar: pin the bar to the main monitor of the active profile
The previous fix listed both profiles' primaries, "output": ["eDP-1",
"DP-1"] -- but DP-1 is the laptop's second monitor too, so the laptop
would have got a bar on it as well as on eDP-1. No static list can express
"the main monitor" when the two machines share an output name.

Resolve it at launch instead. hypr/scripts/bar asks Hyprland for the
monitor at position 0x0 -- the main monitor in both profiles -- writes
{"output": "<name>"} to ~/.cache/waybar-output.jsonc, and execs waybar;
waybar/config.jsonc includes that fragment. autostart/services, the
bar_reload bind and the performance script all go through the wrapper, so
a reload re-resolves after docking. Signals still target the waybar
process, not the wrapper.

Verified all three paths on mainPC: the fragment pins the bar to DP-1
only, an empty fragment falls back to a bar on every output, and a
fragment naming a disconnected output maps nothing (the failure mode this
started from). Config parses on both profiles.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StGBghPW9Dm7z7uj2VNWHr
2026-09-04 16:55:33 +02:00

41 lines
1.0 KiB
Bash
Executable File

#!/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 &