Add movie mode for watching videos on the external monitor
The screen layout and trayer setup moved from xmonad.hs to a shared screen-layout script. lf opens videos with movie.
This commit is contained in:
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Plays videos on the external monitor only, with the laptop screen off.
|
||||
# Opened from lf for video/* files; restores the normal layout when mpv exits.
|
||||
|
||||
# Single-screen mode only makes sense with the external monitor plugged in
|
||||
if ! xrandr --query | grep -q '^HDMI-1-0 connected'; then
|
||||
exec mpv "$@"
|
||||
fi
|
||||
|
||||
trap ~/.local/bin/screen-layout EXIT
|
||||
trap 'exit 130' INT TERM HUP
|
||||
|
||||
xrandr --output eDP-1 --off
|
||||
mpv "$@"
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/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.
|
||||
|
||||
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
|
||||
|
||||
~/.fehbg
|
||||
|
||||
# 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
|
||||
Reference in New Issue
Block a user