aboutsummaryrefslogtreecommitdiff
path: root/xsessionrc.dot.link
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2020-07-25 09:09:58 -0300
committerSilvio Rhatto <rhatto@riseup.net>2020-07-25 09:09:58 -0300
commit2a90049496c610d2580e10a7b0dc0e1a7d236346 (patch)
treecd7f5da6ce7bf5238bd25539b6600e4e30d9ec8e /xsessionrc.dot.link
parent041f431f16365a6167eba3e346654865b0dd23b7 (diff)
downloadxsession-2a90049496c610d2580e10a7b0dc0e1a7d236346.tar.gz
xsession-2a90049496c610d2580e10a7b0dc0e1a7d236346.tar.bz2
Support for default output display
Diffstat (limited to 'xsessionrc.dot.link')
-rwxr-xr-xxsessionrc.dot.link25
1 files changed, 21 insertions, 4 deletions
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/*