From 98379dfbea29d57a7ca6e599019b3b79c9f9b6a0 Mon Sep 17 00:00:00 2001 From: rick Date: Mon, 5 Feb 2024 22:46:30 +0100 Subject: [PATCH] add rotatex61t --- README.txt | 30 ++++++++++++++++++++++++++++- autotorate | 21 ++++++++++++++++++++ rotateFunction | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ rotatebutton | 24 +++++++++++++++++++++++ 4 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 autotorate create mode 100644 rotateFunction create mode 100644 rotatebutton diff --git a/README.txt b/README.txt index 64648b3..b586d5e 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,32 @@ -Collection de scripts random +Collection de scripts random. Plus vraiment maintenus ni utilisés, il s'agit +de vieux scripts que j'ai fait en 2018/2019/2020 que je souhaite conserver. + +rotatex61t +========== + +Installation +------------ + +Mettez les fichiers dans /home//.bin. Ajoutez le dossier dans le $PATH +si ce n’est pas déjà fait. + +Usage +----- + +rotateFunction +~~~~~~~~~~~~~~ + +Contient les fonctions pour tourner l’écran et le stylet. Chaque rotation a un +numéro attribué qui est sauvegardé dans le fichier +/home//.bin/rotationmode. + +Numéro | position de l’écran 0 | normal 1 | pivoté à droite 3 | pivoté à gauche 4 | à l’envers + +rotatebutton et autotorotate +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +À lier avec le bouton de rotation de l’écran et d’automatiser la rotation lors +du passage en mode tablette. swapiswap ========= diff --git a/autotorate b/autotorate new file mode 100644 index 0000000..0fb96b6 --- /dev/null +++ b/autotorate @@ -0,0 +1,21 @@ +#!/bin/bash + +#*************************# +# autotorate # +# # +# author: rick@gnous.eu # +# licence: GPL3 # +#*************************# + +while [ 1 ] +do + state=$(cat /sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode) + rotateState=$(cat $HOME/.bin/rotationmode) + if [ $state -eq 0 ] && [ $rotateState -eq 4 ] + then + rotateFunction + elif [ $state -eq 1 ] && [ $rotateState -eq 0 ] + then + rotateFunction inverted + fi +done diff --git a/rotateFunction b/rotateFunction new file mode 100644 index 0000000..048f5eb --- /dev/null +++ b/rotateFunction @@ -0,0 +1,52 @@ +#!/bin/bash + +#*************************# +# rotateFunction # +# # +# author: rick@gnous.eu # +# licence: GPL3 # +#*************************# + +# a modifier selon l'id du stylet trouvable dans la commande +# xsetwacom --list devices +idStylus=12 + +# Fonctions permettant de tourner l'écran et le stylet +# Chaque position a un code qui est mit dans le fichier $HOME/.bin/rotationmode +# +# position ecran | code +# ---------------|------ +# normal | 0 +# droite | 1 +# inversé | 4 +# gauche | 3 + +function normal { + echo 0 > $HOME/.bin/rotationmode + xrandr -o normal + xsetwacom set $idStylus Rotate none +} + +function right { + echo 1 > $HOME/.bin/rotationmode + xrandr -o right + xsetwacom set $idStylus Rotate cw +} + +function inverted { + echo 4 > $HOME/.bin/rotationmode + xrandr -o inverted + xsetwacom set $idStylus Rotate half +} + +function left { + echo 3 > $HOME/.bin/rotationmode + xrandr -o left + xsetwacom set $idStylus Rotate ccw +} + +if [ $# -eq 0 ]; then + normal +else + $1 2> /dev/null +fi diff --git a/rotatebutton b/rotatebutton new file mode 100644 index 0000000..73f9742 --- /dev/null +++ b/rotatebutton @@ -0,0 +1,24 @@ +#!/bin/bash + +#*************************# +# rotatebutton # +# # +# author: rick@gnous.eu # +# licence: GPL3 # +#*************************# + +mode=$(cat $HOME/.bin/rotationmode) +case $mode + 0) + rotateFunction right + ;; + 1) + rotateFunction inverted + ;; + 4) + rotateFunction left + ;; + *) + rotateFunction + ;; +esac