shell - Xsetwacom works fine, but won't run inside a bash script -


i decided set simple bash script automatically setup wacom tablet, i'm having issues. here's file:

#!/bin/bash  #used setup wacom tablet (intous draw) xsetwacom --list echo "setting wacom tablet..." sudo modprobe -r wacom sudo modprobe -r wacom_w8001 sudo modprobe wacom sudo modprobe wacom_w8001 echo "configuring pen buttons..." xsetwacom set "wacom intuos s 2 pen stylus" button 2 key +space echo "configuring tablet buttons..." xsetwacom set "wacom intuos s 2 pad pad" button 1 key +ctrl z -ctrl xsetwacom set "wacom intuos s 2 pad pad" button 3 key +ctrl xsetwacom set "wacom intuos s 2 pad pad" button 8 key +ctrl +shift z -shift -ctrl xsetwacom set "wacom intuos s 2 pad pad" button 9 key +alt +shift +ctrl k -ctrl -shift - alt echo "mapping tablet dvi-0..." xsetwacom set "wacom intuos s 2 pen stylus" maptooutput dvi-0 echo "done!" exit 0 

if enter these commands manually, work fine, no errors, once put them bash script , run it, following errors:

wacom intuos s 2 pen stylus         id: 13  type: stylus     wacom intuos s 2 pad pad            id: 14  type: pad        setting wacom tablet... configuring pen buttons... cannot find device 'wacom intuos s 2 pen stylus'. configuring tablet buttons... cannot find device 'wacom intuos s 2 pad pad'. cannot find device 'wacom intuos s 2 pad pad'. cannot find device 'wacom intuos s 2 pad pad'. cannot find device 'wacom intuos s 2 pad pad'. mapping tablet dvi-0... cannot find device 'wacom intuos s 2 pen stylus'. done! 

the first command lists available devices (to make sure it's connected), , others setup buttons , map monitor. i've made sure spelling correct, , commands written correctly, still doesn't work. using sudo doesn't either. xsetwacom doesn't need root permissions.

sorry all, found solution. xsetwacom can't run of these commands rapidly. adding sleep command script seemed trick. here's new code:

#!/bin/bash  #used setup wacom tablet (intous draw) echo "setting wacom tablet..." sudo modprobe -r wacom sudo modprobe -r wacom_w8001 sudo modprobe wacom sudo modprobe wacom_w8001 echo "configuring pen buttons..." sleep 0.1 xsetwacom set "wacom intuos s 2 pen stylus" button 2 key +space echo "configuring tablet buttons..." sleep 0.1 xsetwacom set "wacom intuos s 2 pad pad" button 1 key +ctrl z -ctrl sleep 0.1 xsetwacom set "wacom intuos s 2 pad pad" button 3 key +ctrl sleep 0.1 xsetwacom set "wacom intuos s 2 pad pad" button 8 key +ctrl +shift z -shift -ctrl sleep 0.1 xsetwacom set "wacom intuos s 2 pad pad" button 9 key +alt +shift +ctrl k -ctrl -shift - alt echo "mapping tablet dvi-0..." sleep 0.1 xsetwacom set "wacom intuos s 2 pen stylus" maptooutput dvi-0 echo "done!" exit 0 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -