Skip to content

Instantly share code, notes, and snippets.

@curiousercreative
Created March 31, 2023 17:36
Show Gist options
  • Save curiousercreative/b96c977009e36bad7edf6d25b2e3804f to your computer and use it in GitHub Desktop.
Save curiousercreative/b96c977009e36bad7edf6d25b2e3804f to your computer and use it in GitHub Desktop.
Script to configure displays using xrandr from an enumerated list
#! /usr/bin/env bash
# displays.sh single
# displays.sh stack
# displays.sh split
# displays.sh triple
case $1 in
single)
xrandr \
--output DP-4 --auto --primary \
--output HDMI-0 --off \
--output DP-2 --off
;;
stack | dual | dual-stack)
xrandr \
--output DP-4 --auto --pos 0x2160 --primary \
--output HDMI-0 --auto --pos 720x0 \
--output DP-2 --off
;;
split | dual-split)
xrandr \
--output DP-4 --auto --pos 0x0 --primary \
--output HDMI-0 --off \
--output DP-2 --auto --pos 2560x0
;;
triple)
xrandr \
--output DP-4 --auto --pos 0x2160 --primary \
--output HDMI-0 --auto --pos 720x0 \
--output DP-2 --auto --pos 2560x2160
;;
*)
echo 'please specify a configuration, one of: single, stack, split, triple'
exit 1
esac
exit 0
#! /usr/bin/env bash
vi ~/.local/bin/displays.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment