WacomScripts

Differences between revisions 2 and 3
Revision 2 as of 2016-04-24 23:13:08
Size: 431
Editor: zequence
Comment:
Revision 3 as of 2016-04-26 19:43:09
Size: 4583
Editor: autumna
Comment:
Deletions are marked like this. Additions are marked like this.
Line 14: Line 14:
app level thoughts:
 * ideally needs a way to deal with switching layouts automatically based on application used
 * link to calibrator for cintiq users
  * There is one here, ([[https://github.com/tias/xinput_calibrator|xinput-calibrator]] ALso in repos and seems to works fine as of 16.04
 * for button mapping, can be very hard because it is not obvious from xset button what buttons mean
  * [[https://github.com/lubosz/wacom-utility | the old wacom utility]] is still around in some form
 and function even though nobody has made it to a package in a while in my knowledge. (you can test it by downloading the repos and executing wacom_utility.py)


proof of concept commandline script
 * todo: handle nouveau naming of screens
 * todo: handle more screens
 * todo: allow user to set their defaults
 * todo: implement the key setup (including handling many wacom layouts, and multiple layouts per wacom to swap between)
 * todo: generally, a lot of things are hardcoded here.

{{{
#!/bin/bash

#autumna
#2013
#feel free to use it or adopt it to your needs


mydevice="Wacom Intuos4 6x9"
pad="$mydevice pad"
cursor="$mydevice cursor"
stylus="$mydevice stylus"
eraser="$mydevice eraser"

toggle1=$HOME/.wacomscreen.1
toggle2=$HOME/.wacomscreen.2


usage ()
{
  echo "Wacom Setup script of doom - usage"
  echo "setup:Intuos4 screen:Nvidia binary drivers,dualscreen"
  echo ""
  echo "--screen [0,1,2]: screen mode, toggle or"
  echo " 0: both screens, 1: primary(laptop), 2:HDMI"
  echo ""
  echo "--key [profile]: set up leds and buttons"
  
}

button ()
{
echo xsetwacom --set '$pad' button $1 \"$2\"
}

screensetter ()
{
echo xsetwacom --set '$stylus' MapToOutput $1
}

screen()
{

  #how coordinates works - see link below for screen rotation cases
  #http://sourceforge.net/apps/mediawiki/linuxwacom/index.php?title=Dual_and_Multi-Monitor_Set_Up
  #
  #| width 0 x-offset|
  #| 0 height y-offset| all sizes in percentage to total width/height
  #| 0 0 1 |
  #
  # examples:
  # all | top bottom |
  # |1 0 0| | |1 0 0| |1 0 0 | |
  # |0 1 0| | |0 0.5 0| |0 0.5 0.5| |
  # |0 0 1| | |0 0 1| |0 0 1 | |

  #both screens - remove all indicators
  if test "$1" == "0"; then
   if test -e $toggle1; then rm $toggle1; fi
   if test -e $toggle2; then rm $toggle2; fi
   echo "xinput set-prop \"$stylus\" --type=float \"Coordinate Transformation Matrix\" 1 0 0 0 1 0 0 0 1"
   echo "xinput set-prop \"$eraser\" --type=float \"Coordinate Transformation Matrix\" 1 0 0 0 1 0 0 0 1"
  elif test "$1" == "1"; then
   touch $toggle1
   if test -e $toggle2; then rm $toggle2; fi
   echo "xsetwacom --set \"$stylus\" MapToOutput \"Head-0\"" #name of my primary monitor
   echo "xsetwacom --set \"$eraser\" MapToOutput \"Head-0\""
  elif test "$1" == "2"; then
   if test -e $toggle1; then rm $toggle1; fi
   touch $toggle2
   echo "xsetwacom --set \"$stylus\" MapToOutput \"Head-1\"" #name of my primary monitor
   echo "xsetwacom --set \"$eraser\" MapToOutput \"Head-1\""
  else
   echo "wrong argument for -screen: $1"
   usage
  fi
  exit
}

#first
#device list



#script for setting up Wacom buttons and abilities
#for intuos4 6x9 pad

#------------------
# pad
#------------------

echo $mydevice
echo "xsetwacom --get '$pad' button 1"

#set the top buttons.
button 2 "key b"
button 3 "key c"
button 8 "key d"
button 9 "key e"

#wheel
button 1 "key a"

#set the bottom buttons
button 10 "key f"
button 11 "key g"
button 12 "key h"
button 13 "key i"

#check for screen
if test "$1" == "--screen"
 then
 if test ! -e $2
 then
  screen "$2"
 else
  #no arguments, toggle then exit
  if test -e $toggle1; then screen "2" #switch 1->2
  elif test -e $toggle2; then screen "0" #switch 2->0
  else screen "1" #switch 0->1
  fi
 fi

#check for key
elif test "$1" == "--key"
 then
 echo "key!"

else
 echo "wrong argument!"
fi

#if it gets this far either the options were blank or wrong input
usage

}}}

Feature definition for Wacom scripts

Description

Add scripts or better detailed settings for wacom tablets. (most tablet work out of the box, but the settings we provide are very minimalistic)

Technical Implementation

(add one here)

app level thoughts:

  • ideally needs a way to deal with switching layouts automatically based on application used
  • link to calibrator for cintiq users
    • There is one here, (xinput-calibrator ALso in repos and seems to works fine as of 16.04

  • for button mapping, can be very hard because it is not obvious from xset button what buttons mean and function even though nobody has made it to a package in a while in my knowledge. (you can test it by downloading the repos and executing wacom_utility.py)

proof of concept commandline script

  • todo: handle nouveau naming of screens
  • todo: handle more screens
  • todo: allow user to set their defaults
  • todo: implement the key setup (including handling many wacom layouts, and multiple layouts per wacom to swap between)
  • todo: generally, a lot of things are hardcoded here.

#autumna
#2013
#feel free to use it or adopt it to your needs


mydevice="Wacom Intuos4 6x9"
pad="$mydevice pad"
cursor="$mydevice cursor"
stylus="$mydevice stylus"
eraser="$mydevice eraser"

toggle1=$HOME/.wacomscreen.1
toggle2=$HOME/.wacomscreen.2


usage ()
{
  echo "Wacom Setup script of doom - usage"
  echo "setup:Intuos4 screen:Nvidia binary drivers,dualscreen"
  echo ""
  echo "--screen [0,1,2]: screen mode, toggle or"
  echo " 0: both screens, 1: primary(laptop), 2:HDMI"
  echo ""
  echo "--key [profile]: set up leds and buttons"
  
}

button ()
{
echo xsetwacom --set '$pad' button $1 \"$2\"
}

screensetter ()
{
echo xsetwacom --set '$stylus' MapToOutput $1 
}

screen()
{

  #how coordinates works - see link below for screen rotation cases
  #http://sourceforge.net/apps/mediawiki/linuxwacom/index.php?title=Dual_and_Multi-Monitor_Set_Up
  #
  #| width     0      x-offset|      
  #|   0     height   y-offset|       all sizes in percentage to total width/height
  #|   0       0         1    |
  #
  # examples:
  #     all    |    top       bottom    |
  # |1  0  0|  | |1  0  0|  |1  0   0 | |
  # |0  1  0|  | |0 0.5 0|  |0 0.5 0.5| |
  # |0  0  1|  | |0  0  1|  |0  0   1 | |

  #both screens - remove all indicators
  if test "$1" == "0"; then
   if test -e $toggle1; then rm $toggle1; fi
   if test -e $toggle2; then rm $toggle2; fi
   echo "xinput set-prop \"$stylus\" --type=float \"Coordinate Transformation Matrix\" 1 0 0 0 1 0 0 0 1"  
   echo "xinput set-prop \"$eraser\" --type=float \"Coordinate Transformation Matrix\" 1 0 0 0 1 0 0 0 1"
  elif test "$1" == "1"; then
   touch $toggle1
   if test -e $toggle2; then rm $toggle2; fi
   echo "xsetwacom --set \"$stylus\" MapToOutput \"Head-0\"" #name of my primary monitor
   echo "xsetwacom --set \"$eraser\" MapToOutput \"Head-0\""
  elif test "$1" == "2"; then
   if test -e $toggle1; then rm $toggle1; fi
   touch $toggle2
   echo "xsetwacom --set \"$stylus\" MapToOutput \"Head-1\"" #name of my primary monitor
   echo "xsetwacom --set \"$eraser\" MapToOutput \"Head-1\""
  else
   echo "wrong argument for -screen: $1"
   usage
  fi
  exit
} 

#first
#device list



#script for setting up Wacom buttons and abilities
#for intuos4 6x9 pad

#------------------
# pad
#------------------

echo $mydevice
echo "xsetwacom --get '$pad' button 1"

#set the top buttons. 
button 2 "key b"
button 3 "key c"
button 8 "key d"
button 9 "key e"

#wheel
button 1 "key a"

#set the bottom buttons
button 10 "key f"
button 11 "key g"
button 12 "key h"
button 13 "key i"

#check for screen
if test "$1" == "--screen"
 then
 if test ! -e $2  
 then 
  screen "$2"
 else
  #no arguments, toggle then exit
  if test -e $toggle1; then screen "2" #switch 1->2
  elif test -e $toggle2; then screen "0" #switch 2->0
  else screen "1"  #switch 0->1
  fi
 fi

#check for key
elif test "$1" == "--key"
 then
 echo "key!"

else
 echo "wrong argument!"
fi

#if it gets this far either the options were blank or wrong input
usage


CategoryUbuntuStudio CategoryUbuntuStudioOrganization

UbuntuStudio/FeatureDefinitions/WacomScripts (last edited 2017-06-04 14:44:21 by eylul)