summaryrefslogtreecommitdiff
path: root/scripts/Scripts
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-09-05 13:25:00 +0200
committerJulian T <julian@jtle.dk>2020-09-05 13:25:00 +0200
commit8ca4339e3265f108fba5c8cd3cae165f1089f111 (patch)
treed3b7f60e94ab9f0003a5478d46ef03279a0eebc5 /scripts/Scripts
parent6f4e8b5952dcae7d4f755b73974cdbe1767b7b2c (diff)
Added xrotate script
Diffstat (limited to 'scripts/Scripts')
-rwxr-xr-xscripts/Scripts/lc2
-rwxr-xr-xscripts/Scripts/xrotate76
2 files changed, 77 insertions, 1 deletions
diff --git a/scripts/Scripts/lc b/scripts/Scripts/lc
index a58d826..1f6aaab 100755
--- a/scripts/Scripts/lc
+++ b/scripts/Scripts/lc
@@ -59,7 +59,7 @@ handle_stuff() {
vboxmanage startvm "Windows xp"
fi
if [ "$1" = "wall" ]; then
- ~/Scripts/setwall
+ $HOME/Scripts/setwall -A
fi
if [ "$1" = "mic" ]; then
amixer set Capture toggle
diff --git a/scripts/Scripts/xrotate b/scripts/Scripts/xrotate
new file mode 100755
index 0000000..fabe98b
--- /dev/null
+++ b/scripts/Scripts/xrotate
@@ -0,0 +1,76 @@
+#!/usr/bin/env bash
+set -e
+
+function help() {
+ echo "Rotate the screen and mouse input"
+ echo
+ echo "Syntax: ${BINNAME} [<options>] <orientation>"
+ echo "Orientation: normal,inverted,left,right"
+ echo "Options:"
+ echo " -d, --disp <DISPLAY> set for xrandr DISPLAY"
+ echo " -h, --help this help message"
+}
+
+# Fix hardcode
+DISP=LVDS1
+
+BINNAME="xrotate"
+
+# Parse some args
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ -d|--disp)
+ shift
+ DISP=$1
+ shift
+ ;;
+ -h|--help)
+ help
+ exit 0
+ ;;
+ *)
+ if [[ $1 == '-'* ]]; then
+ echo unknown option $1
+ help
+ exit 1
+ fi
+ break
+ ;;
+ esac
+done
+
+O=$1
+
+MOUSE=$(xinput list | grep "slave pointer" | awk '{print $6}' | awk -F '=' '{print $2}')
+
+case $O in
+ normal)
+ echo "Normal"
+ MATRIX="1 0 0 0 1 0 0 0 1"
+ ;;
+ inverted)
+ echo "Inverted"
+ MATRIX="-1 0 0 0 -1 0 0 0 1"
+ ;;
+ left)
+ echo "Left"
+ MATRIX="0 -1 0 1 0 0 0 0 1"
+ ;;
+ right)
+ echo "Right"
+ MATRIX="0 1 0 -1 0 0 0 0 1"
+ ;;
+ *)
+ echo "Not an supported orientation"
+ help
+ exit 1;
+ ;;
+esac
+
+
+set -x
+
+xrandr --output $DISP --rotate $O
+for M in $MOUSE; do
+ xinput set-prop $M "Coordinate Transformation Matrix" $MATRIX
+done