#!/bin/bash ## Touch ring toggle script ## ## Bind Button 1 (button center of touch ring) to the script. Ceci est fait dans l'interface graphique d'xbindkeys. Voir commentaire à ce sujet. ## ## Technique du "rc.local", ne marche que si la tablette est branchée au moment du boot de l'ordi. ## To allow script to select mode status LEDs edit rc.local to change root ## only permissions on the sysfs status_led0_select file: ## gksudo gedit /etc/rc.local ## Add the following comment and command (before 'exit 0'): ## # Change permissions on status_led0_select file so being root isn't ## # required to switch Wacom touch ring mode status LEDs. ## /bin/chmod 666 /sys/bus/usb/devices/2-7:1.0/wacom_led/status_led0_select ## # OR (chez moi il y en a deux, il faut tester l'un et l'autre pour trouver le bon) ## /bin/chmod 666 /sys/bus/usb/devices/2-7:1.1/wacom_led/status_led0_select ## ## Cette technique modifiant le fichier "rc.local" ne fonctionne que lorsque la tablette est branchée dès le boot du PC. Une autre technique existe si vous souhaitez pouvoir brancher votre tablette en cours de cession, ## mais il faudra alors rentrer votre mot de passe administrateur à chaque fois... Pour cela décommenter la ligne sudo bin/chmod 666 dans le script "intuos.sh" ## Pour vérifier que les droits sont acquis : ## ls -l /sys/bus/usb/devices/2-7:1.0/wacom_led/status_led0_select ## Si réponse est la suivante, les droits ne sont pas acquis, et il faut donc passer par sudo : ## -rw------- 1 root root 4096 Mar 6 12:10 /sys/bus/usb/devices/3-2:1.0/wacom_led/status_led0_select ## ## ## Intuos - status_led0_select file = the left (only) ring status LEDs. ## Cintiq - status_led1_select = the left ring; status_led0_select = ## the right ring status LEDs. Same for the touchstrips. ## ## For mode state notification use: ## sudo apt-get install libnotify-bin ## Otherwise comment (#) out the notify-send lines. If libnotify-bin ## installed see 'man notify-send' for details. # check if mode_state file exists, if not create it and set to 0 if [ ! -f /tmp/mode_state ]; then echo 0 > /tmp/mode_state fi # read mode state value from temporary file MODE=`cat /tmp/mode_state` # select touch ring mode status LED for current mode state echo $MODE > /sys/bus/usb/devices/2-7:1.0/wacom_led/status_led0_select # for DEVICE use the pad "device name" from 'xinput list' #DEVICE="Wacom Intuos4 6x9 pad" DEVICE="Wacom Intuos5 touch L Pen pad" # set touch ring function option and notification for the 4 toggled modes if [ "$MODE" == 0 ]; then xsetwacom set "$DEVICE" AbsWheelUp key minus # scroll up xsetwacom set "$DEVICE" AbsWheelDown key plus # scroll down notify-send -t 1500 "Mode 1: Scroll up or down." elif [ "$MODE" == 1 ]; then xsetwacom set "$DEVICE" AbsWheelUp key d # increase brush radius (must be mapped in GIMP) xsetwacom set "$DEVICE" AbsWheelDown key i # decrease brush radius (must be mapped in GIMP) notify-send -t 1500 "Mode 2: Increase or decrease brush size in Gimp" elif [ "$MODE" == 2 ]; then xsetwacom set "$DEVICE" AbsWheelUp key a # zoom in xsetwacom set "$DEVICE" AbsWheelDown key b # zoom out notify-send -t 1500 "Mode 3: Zoom in or out in Gimp." elif [ "$MODE" == 3 ]; then xsetwacom set "$DEVICE" AbsWheelUp key c # select previous layer xsetwacom set "$DEVICE" AbsWheelDown key e # select next layer notify-send -t 1500 "Mode 4: Select previous or next layer in Gimp" fi # toggle button increment counter MODE=$((MODE += 1)) # set next mode state if (( "$MODE" > 3 )); then # roll over to 0, only 4 mode states available echo 0 > /tmp/mode_state else echo $MODE > /tmp/mode_state fi