Revert "[Bin] Begin to fix wacom-setup, still bugged, see TODO"
This reverts commit 84de2cce7e
.
Attempt to fix everything
This commit is contained in:
parent
ea9a5a4d24
commit
87af1db5af
@ -342,15 +342,7 @@ to one screen.
|
|||||||
We need some variables in order to correctly set our tablet. First, let’s get
|
We need some variables in order to correctly set our tablet. First, let’s get
|
||||||
declare what the name of our tablet is, and what the name of its touchpad is.
|
declare what the name of our tablet is, and what the name of its touchpad is.
|
||||||
#+BEGIN_SRC fish
|
#+BEGIN_SRC fish
|
||||||
set -g DEVICE "Wacom Co.,Ltd. Bamboo Pad, USB stylus"
|
set -g DEVICE "Wacom USB Bamboo PAD Pen stylus"
|
||||||
set -g DEVICETOUCH "Wacom USB Bamboo PAD Finger touch"
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
We will also modify two settings: the speed of the cursor on the touchpad, and
|
|
||||||
the scroll speed. Let’s declare the name of these two settings.
|
|
||||||
#+BEGIN_SRC fish
|
|
||||||
set -g WACOMPROPTOUCHSPEED "Device Accel Velocity Scaling"
|
|
||||||
set -g WACOMPROPSCROLLPSEED "ScrollDistance"
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
To get the correct values for the area it can cover, we’ll need to reset our
|
To get the correct values for the area it can cover, we’ll need to reset our
|
||||||
@ -361,7 +353,7 @@ xsetwacom set "$DEVICE" ResetArea
|
|||||||
|
|
||||||
Now we can get the X and Y areas.
|
Now we can get the X and Y areas.
|
||||||
#+BEGIN_SRC fish
|
#+BEGIN_SRC fish
|
||||||
set -l AREATOT (xsetwacom get "$DEVICE" Area)
|
set -g AREATOT (xsetwacom get "$DEVICE" Area)
|
||||||
set -g AREAX (echo $AREATOT | awk '{print $3}')
|
set -g AREAX (echo $AREATOT | awk '{print $3}')
|
||||||
set -g AREAY (echo $AREATOT | awk '{print $4}')
|
set -g AREAY (echo $AREATOT | awk '{print $4}')
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
@ -373,47 +365,42 @@ Now we can get the X and Y areas.
|
|||||||
This function will allow us to select the screen on which the tablet will be
|
This function will allow us to select the screen on which the tablet will be
|
||||||
active. We can also select the option “desktop” so that all screens are
|
active. We can also select the option “desktop” so that all screens are
|
||||||
selected. Let’s declare our function.
|
selected. Let’s declare our function.
|
||||||
#+BEGIN_SRC fish
|
#+BEGIN_SRC fish :noweb yes
|
||||||
function set_screen
|
function set_screen
|
||||||
|
<<wacom-screen-get-displays>>
|
||||||
|
<<wacom-screens-select-screen>>
|
||||||
|
<<wacom-screen-get-position>>
|
||||||
|
<<wacom-screen-get-dimensions>>
|
||||||
|
end
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
First, let’s set what screens are available, including the desktop option.
|
First, let’s set what screens are available, including the desktop option.
|
||||||
#+BEGIN_SRC fish
|
#+NAME: wacom-screen-get-displays
|
||||||
|
#+BEGIN_SRC fish :tangle no
|
||||||
set CONNECTED_DISPLAYS (xrandr -q --current | \
|
set CONNECTED_DISPLAYS (xrandr -q --current | \
|
||||||
sed -n 's/^\([^ ]\+\) connected .*/\1/p') desktop
|
sed -n 's/^\([^ ]\+\) connected .*/\1/p') desktop
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Now, let’s select the one we wish to use using rofi.
|
Now, let’s select the one we wish to use using rofi.
|
||||||
#+BEGIN_SRC fish
|
#+NAME: wacom-screens-select-screen
|
||||||
|
#+BEGIN_SRC fish :tangle no
|
||||||
set -g SCREEN (for d in $CONNECTED_DISPLAYS
|
set -g SCREEN (for d in $CONNECTED_DISPLAYS
|
||||||
echo $d
|
echo $d
|
||||||
end | rofi -dmenu -i -p "Select your dispaly" | tr -d '\n')
|
end | rofi -dmenu -i -p "Select your dispaly" | tr -d '\n')
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Now, let’s get the resolution of our selected screen.
|
We can now get the position of our screen.
|
||||||
#+BEGIN_SRC fish
|
#+NAME: wacom-screen-get-position
|
||||||
set -l LINE (xrandr -q --current | if [ "$SCREEN" = "desktop" ]
|
#+BEGIN_SRC fish :tangle no
|
||||||
sed -n 's/^Screen 0:.*, current \([0-9]\+\) x \([0-9]\+\),.*/\1 \2/p'
|
set -g POSITION (xrandr -q --current | sed -nr "s/^$SCREEN connected (primary )*([0-9x\+]+).*/\2/p")
|
||||||
else
|
|
||||||
sed -n "s/^$SCREEN"' connected \(primary \)\{0,1\}\([0-9]\+\)x\([0-9]\+\)+.*/\2 \3/p'
|
|
||||||
end)
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
From that, let’s get the vertical and horizontal resolution of our screen.
|
We’ll also get the width and height of the screen so we can set correctly the
|
||||||
#+BEGIN_SRC fish
|
drawing area of the tablet.
|
||||||
echo $LINE | read -g WIDTH HEIGHT
|
#+NAME: wacom-screen-get-dimensions
|
||||||
#+END_SRC
|
#+BEGIN_SRC fish :tangle no
|
||||||
|
set -g HEIGHT (echo $POSITION | sed -nr 's/[0-9]+x([0-9]+).*/\1/p')
|
||||||
If any of our ~WIDTH~ ou ~HEIGHT~ it empty, we’ll have to abort the script.
|
set -g WIDTH (echo $POSITION | sed -nr 's/([0-9]+)x.*/\1/p')
|
||||||
#+BEGIN_SRC fish
|
|
||||||
if test -z $WIDTH || test -z $HEIGHT
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
Let’s close our function now.
|
|
||||||
#+BEGIN_SRC fish
|
|
||||||
end
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** Adjust the tablet
|
*** Adjust the tablet
|
||||||
@ -422,14 +409,19 @@ end
|
|||||||
:END:
|
:END:
|
||||||
This function will take care of adjusting our tablet to our screen. Let’s
|
This function will take care of adjusting our tablet to our screen. Let’s
|
||||||
declare our function.
|
declare our function.
|
||||||
#+BEGIN_SRC fish
|
#+BEGIN_SRC fish :noweb yes
|
||||||
function adjust_device
|
function adjust_device
|
||||||
|
<<wacom-tablet-set-ration-area>>
|
||||||
|
<<wacom-tablet-set-new-area>>
|
||||||
|
<<wacom-tablet-set-device-area-and-screen>>
|
||||||
|
end
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
If our screen is too high or too wide for our tablet, we will have to adjust the
|
If our screen is too high or too wide for our tablet, we will have to adjust the
|
||||||
height or width of the area used by the tablet. So let’s get the theoretical new
|
height or width of the area used by the tablet. So let’s get the theoretical new
|
||||||
height and width of the area.
|
height and width of the area.
|
||||||
#+BEGIN_SRC fish
|
#+NAME: wacom-tablet-set-ration-area
|
||||||
|
#+BEGIN_SRC fish :tangle no
|
||||||
set RATIOAREAY (math ceil \($AREAX \* $HEIGHT \/ $WIDTH\))
|
set RATIOAREAY (math ceil \($AREAX \* $HEIGHT \/ $WIDTH\))
|
||||||
set RATIOAREAX (math ceil \($AREAY \* $WIDTH \/ $HEIGHT\))
|
set RATIOAREAX (math ceil \($AREAY \* $WIDTH \/ $HEIGHT\))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
@ -438,7 +430,8 @@ Now, if the current height of the tablet’s area is greater than the theoretica
|
|||||||
new area, it means the current area is too high. Otherwise, it should be the
|
new area, it means the current area is too high. Otherwise, it should be the
|
||||||
other way around. Let’s set =NEWAREAX= and =NEWAREAY= that will be used to set
|
other way around. Let’s set =NEWAREAX= and =NEWAREAY= that will be used to set
|
||||||
the new area for the tablet.
|
the new area for the tablet.
|
||||||
#+BEGIN_SRC fish
|
#+NAME: wacom-tablet-set-new-area
|
||||||
|
#+BEGIN_SRC fish :tangle no
|
||||||
if test $AREAY -gt $RATIOAREAY
|
if test $AREAY -gt $RATIOAREAY
|
||||||
set -g NEWAREAX $AREAX
|
set -g NEWAREAX $AREAX
|
||||||
set -g NEWAREAY $RATIOAREAY
|
set -g NEWAREAY $RATIOAREAY
|
||||||
@ -449,24 +442,9 @@ the new area for the tablet.
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Alright, now let’s set the new area with these new variables.
|
Alright, now let’s set the new area with these new variables.
|
||||||
#+BEGIN_SRC fish
|
#+NAME: wacom-tablet-set-device-area-and-screen
|
||||||
|
#+BEGIN_SRC fish :tangle no
|
||||||
xsetwacom set "$DEVICE" Area 0 0 $NEWAREAX $NEWAREAY
|
xsetwacom set "$DEVICE" Area 0 0 $NEWAREAX $NEWAREAY
|
||||||
xsetwacom set "$DEVICE" MapToOutput "$SCREEN"
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
Let’s slow down the cursor’s speed on the touchpad.
|
|
||||||
#+BEGIN_SRC fish
|
|
||||||
xinput set-float-prop $DEVICETOUCH $WACOMPROPTOUCHSPEED 0.5
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
Let’s also slow down the scroll speed of the touchpad.
|
|
||||||
#+BEGIN_SRC fish
|
|
||||||
xsetwacom set $DEVICETOUCH $WACOMPROPSCROLLPSEED "90"
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
Now, let’s close the function.
|
|
||||||
#+BEGIN_SRC fish
|
|
||||||
end
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** Lauch the functions
|
*** Lauch the functions
|
||||||
@ -480,19 +458,6 @@ sequencially.
|
|||||||
adjust_device
|
adjust_device
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** TODO Fix this script :noexport:
|
|
||||||
:PROPERTIES:
|
|
||||||
:CUSTOM_ID: cli-utilities-Wacom-setup-Fix-this-script-76ddec7c
|
|
||||||
:END:
|
|
||||||
When running this script, I get the following error:
|
|
||||||
#+BEGIN_SRC text
|
|
||||||
Unable to find an output 'HDMI1'.
|
|
||||||
unable to find device Wacom USB Bamboo PAD Finger touch
|
|
||||||
Cannot find device 'Wacom USB Bamboo PAD Finger touch'.
|
|
||||||
#+END_SRC
|
|
||||||
The first one is caused by ~xsetwacom~. The second one, I do not know where I
|
|
||||||
should find ~Wacom USB Bamboo PAD Finger touch~.
|
|
||||||
|
|
||||||
* Emacs stuff
|
* Emacs stuff
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: Emacs-stuff-8e76efd4
|
:CUSTOM_ID: Emacs-stuff-8e76efd4
|
||||||
|
Loading…
Reference in New Issue
Block a user