TODO: put all this in nixos configs

This commit is contained in:
matt1432 2023-06-24 12:35:40 +02:00
parent eb5f7a9e50
commit d16051dada
7 changed files with 82 additions and 11 deletions

46
hypr/scripts/autorotate.sh Executable file
View file

@ -0,0 +1,46 @@
#!/usr/bin/env bash
# This script was forked from https://gitlab.com/snippets/1793649 by Fishonadish
SCREEN="eDP-1"
WAYLANDINPUT=("wacom-hid-52eb-finger"
"wacom-hid-52eb-pen")
function rotate_ms {
case $1 in
"normal")
rotate 0
;;
"right-up")
rotate 3
;;
"bottom-up")
rotate 2
;;
"left-up")
rotate 1
;;
esac
}
function rotate {
TARGET_ORIENTATION=$1
echo "Rotating to" $TARGET_ORIENTATION
hyprctl keyword monitor $SCREEN,transform,$TARGET_ORIENTATION
for i in "${WAYLANDINPUT[@]}"
do
hyprctl keyword device:"$i":transform $TARGET_ORIENTATION
done
/home/matt/.config/lisgd/config &
}
while IFS='$\n' read -r line; do
rotation="$(echo $line | sed -En "s/^.*orientation changed: (.*)/\1/p")"
[[ ! -z $rotation ]] && rotate_ms $rotation
done < <(stdbuf -oL monitor-sensor)

View file

@ -5,5 +5,5 @@ gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false
brightnessctl -d tpacpi::kbd_backlight s 2
killall iio-hyprland
killall evtest
killall -r autorotate.sh
killall -r evtest

View file

@ -6,7 +6,7 @@ gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true
brightnessctl -d tpacpi::kbd_backlight s 0
$HOME/.local/bin/iio-hyprland &
$HOME/.config/hypr/scripts/autorotate.sh &
evtest --grab "/dev/input/by-path/platform-i8042-serio-0-event-kbd" &
evtest --grab "/dev/input/by-path/platform-i8042-serio-1-event-mouse" &