summaryrefslogtreecommitdiff
path: root/scripts/Scripts/screentool
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-02-25 13:56:54 +0100
committerJulian T <julian@jtle.dk>2021-02-25 13:56:54 +0100
commite5db995945c867e7933c331524641c6a873a6cd7 (patch)
treefe56c29601c6869865335f15493d2f58c80eacaf /scripts/Scripts/screentool
parent99ec3749b0683999b5dc2dce783d177dec7823ce (diff)
Changes to i3 and scripts around it
Diffstat (limited to 'scripts/Scripts/screentool')
-rwxr-xr-xscripts/Scripts/screentool35
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/Scripts/screentool b/scripts/Scripts/screentool
new file mode 100755
index 0000000..2d8da9e
--- /dev/null
+++ b/scripts/Scripts/screentool
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+DMENU="rofi -dmenu -i"
+XRANDR="xrandr"
+
+set -e
+
+displays=$(xrandr | awk -F ' ' '/ connected/ {print $1}')
+
+echo "Found displays ${displays}"
+
+# Prompt for display
+chosen=$(echo ${displays} | tr " " "\n" | $DMENU -p "output")
+
+# get action
+action=$(printf "auto\noff" | $DMENU -p "action")
+
+if [ "$action" = "off" ]; then
+ set -x
+ $XRANDR --output $chosen --off
+ exit 0
+fi
+
+# Get position
+where=$(printf "left-of\nright-of\nbelow\nabove\nnone" | $DMENU -p "position")
+
+if [ "$where" = "none" ]; then
+ set -x
+ $XRANDR --output $chosen --auto
+ exit 0
+fi
+
+other=$(echo ${displays} | tr " " "\n" | $DMENU -p "other")
+
+set -x
+$XRANDR --output $chosen --auto --${where} $other