commit 6fc70141fccf6b2a2769bb0da19afe5d7c9ee026 Author: guillaume Date: Thu Dec 28 16:37:26 2023 +0100 INIT - add script, bin & README diff --git a/README b/README new file mode 100644 index 0000000..ced71e0 --- /dev/null +++ b/README @@ -0,0 +1,3 @@ +# Install + +[[ -z $(cat ~/bin/dwm-scripts/autostart.sh | grep monitor-rotate) ]] && echo "$(realpath monitor-rotate) &" | tee -a /home/guillaume/bin/dwm-scripts/autostart.sh diff --git a/autorotate b/autorotate new file mode 100755 index 0000000..c4085e7 Binary files /dev/null and b/autorotate differ diff --git a/monitor-rotate b/monitor-rotate new file mode 100755 index 0000000..f2f80ce --- /dev/null +++ b/monitor-rotate @@ -0,0 +1,19 @@ +#!/bin/bash +# +export DISPLAY=:0 +Bin=$(dirname $0)/autorotate + +while IFS= read -r line + do + if [[ ! -z $(echo $line | grep changed | grep -E "normal|right-up|left-up|bottom-up") ]] + then + tOrientation=$(echo $line | awk '{print $NF}') + case $tOrientation in + normal) ${Bin} normal --display eDP-1;; + right-up) ${Bin} right --display eDP-1;; + left-up) ${Bin} left --display eDP-1;; + bottom-up) ${Bin} invert --display eDP-1;; + esac + + fi + done < <(monitor-sensor)