Files
dotfiles/.local/bin/screen-layout
T
Daniele Fucini b10970bf36 Keep the wallpaper when movie restores the screen layout
.fehbg now saves its random picks to ~/.cache/wallpapers and redraws them with
--keep; screen-layout passes this through with --keep-wallpaper, used by movie.
2026-10-24 16:31:02 +02:00

27 lines
925 B
Bash
Executable File

#!/bin/bash
# Sets up the outputs, wallpaper and trayer for whatever monitors are connected.
# Called by xmonad at startup and on monitor (dis)connect, and by `movie` on exit.
# --keep-wallpaper redraws the current wallpaper instead of picking new random ones.
if xrandr --query | grep -q '^HDMI-1-0 connected'; then
xrandr --output HDMI-1-0 --preferred --primary --output eDP-1 --right-of HDMI-1-0 --preferred
tray=1
else
xrandr --output eDP-1 --preferred --primary --output HDMI-1-0 --off
tray=0
fi
if [[ $1 == --keep-wallpaper ]]; then
~/.fehbg --keep
else
~/.fehbg
fi
# Replace any running trayer, so there's never more than one
pkill -x trayer
while pgrep -x trayer > /dev/null; do sleep 0.1; done
trayer -l --edge top --align right --SetDockType true \
--SetPartialStrut true --expand true --widthtype request \
--tint 0x232634 --height 18 --monitor "$tray" > /dev/null 2>&1 &
disown