From 526261f8409926e325c5e8e326e75980a2f1a26a Mon Sep 17 00:00:00 2001 From: Richard Date: Sun, 3 Feb 2019 14:26:19 +0100 Subject: [PATCH] Added options to choose monitor above or below --- .scripts/i3cmds/displayselect | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.scripts/i3cmds/displayselect b/.scripts/i3cmds/displayselect index e5260142..49180d1e 100755 --- a/.scripts/i3cmds/displayselect +++ b/.scripts/i3cmds/displayselect @@ -34,8 +34,13 @@ twoscreen() { # If multi-monitor is selected and there are two screens. primary=$(echo "$screens" | dmenu -i -p "Select primary display:") secondary=$(echo "$screens" | grep -v "$primary") - direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") - xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0 + direction=$(printf "left\\nright\\nabove\\nbelow" | dmenu -i -p "What side of $primary should $secondary be on?") + + # xrandr uses -of as ending for left and right + if [ "$direction" = "left" ] || [ "$direction" = "right"]; then + $direction=$(printf "%s-of" "$direction") + fi + xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction" "$primary" --auto --scale 1.0x1.0 fi }