Skip to content

Instantly share code, notes, and snippets.

@mheap
Created February 24, 2015 15:34
Show Gist options
  • Save mheap/4569935a60d5afb63ef8 to your computer and use it in GitHub Desktop.
Save mheap/4569935a60d5afb63ef8 to your computer and use it in GitHub Desktop.
Session startup script for a Dell XPS 15. Enables/disables screens automatically
# Set up some variables we need
test -z "`xrandr | grep '^HDMI1 connected'`" && HDMI_ON=1
test -z "`xrandr | grep '^DP1 connected'`" && DP_ON=1
# Both on, I'm probably at work
if [[ -z "$HDMI_ON" ]] && [[ -z "$DP_ON" ]]; then
bash ~/.screenlayout/work-desk.sh
# Only the HDMI on
elif [[ -z "$HDMI_ON" ]]; then
bash ~/.screenlayout/home-desk.sh
# Or, we're just on the laptop
else
bash ~/.screenlayout/laptop-only.sh
fi
#!/bin/sh
xrandr --output VIRTUAL1 --off --output eDP1 --mode 3200x1800 --pos 0x0 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --primary --mode 1920x1080 --pos 3200x0 --rotate normal --output VGA1 --off
#!/bin/sh
xrandr --output VIRTUAL1 --off --output eDP1 --mode 3200x1800 --pos 0x0 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --off --output VGA1 --off
#!/bin/sh
xrandr --output VIRTUAL1 --off --output eDP1 --mode 3200x1800 --pos 0x0 --rotate normal --output DP1 --mode 2560x1440 --pos 3200x0 --rotate normal --primary --output HDMI2 --off --output HDMI1 --mode 1920x1200 --pos 5760x0 --rotate normal --output VGA1 --off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment