From 2a90049496c610d2580e10a7b0dc0e1a7d236346 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 25 Jul 2020 09:09:58 -0300 Subject: Support for default output display --- xsessionrc.dot.link | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'xsessionrc.dot.link') diff --git a/xsessionrc.dot.link b/xsessionrc.dot.link index fd8c199..a77b3a6 100755 --- a/xsessionrc.dot.link +++ b/xsessionrc.dot.link @@ -15,16 +15,33 @@ OSVERSION="`cut -d . -f 1 /etc/debian_version`" # Hostname HOSTNAME="`cat /etc/hostname`" -# Start xscreensaver -if [ -e "/usr/bin/xscreensaver" ]; then - xscreensaver -no-splash & -fi +# Output +# Example: OUTPUT="VGA-1" +OUTPUT="" # Custom config if [ -e "$HOME/.custom/xsession" ]; then . $HOME/.custom/xsession fi +# Set output display if defined in custom configuration +if [ ! -z "$OUTPUT" ] && xrandr | grep -q "^$OUTPUT connected"; then + # Disable all other outputs + for device in `xrandr | grep " connected " | cut -d ' ' -f 1 | xargs`; do + if [ "$device" != "$OUTPUT" ]; then + xrandr --output $device --off + fi + done + + # Turn on the desired device + xrandr --output $OUTPUT --auto +fi + +# Start xscreensaver +if [ -e "/usr/bin/xscreensaver" ]; then + xscreensaver -no-splash & +fi + # Set background if [ "$BACKGROUND" = "all" ]; then feh --bg-scale --randomize $HOME/.config/themes/backgrounds/* -- cgit v1.2.3