From 9684e53aa175b7a7e155342d70e786b405e0e4d8 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Fri, 29 Jan 2021 18:52:57 +0100 Subject: Bash programm update I'm doing it in bash for the moment. I'll 'export' it in perl when the whole project is done in bash. --- README.ms | 2 +- README.pdf | Bin 17422 -> 17473 bytes static_tablet_setup.sh | 57 ++++++++++++++++++++++++++++++++++++++----------- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/README.ms b/README.ms index af78a96..abb192c 100644 --- a/README.ms +++ b/README.ms @@ -12,7 +12,7 @@ Gratacon .PP It's supposed to be a Perl project to help me get a grasp of the language but this constraint might evolve. - +Right now, I'm fully doing it in bash. .PP static_tablet-setup.sh is a script I use everytime I wanna use my H420 tablet and will be used as a guidance for the begining of this project. diff --git a/README.pdf b/README.pdf index 1760240..d80e1f0 100644 Binary files a/README.pdf and b/README.pdf differ diff --git a/static_tablet_setup.sh b/static_tablet_setup.sh index 40e8637..4288650 100755 --- a/static_tablet_setup.sh +++ b/static_tablet_setup.sh @@ -1,38 +1,71 @@ -#!/bin/bash +#!/usr/bin/env bash +#Clythsuriva + +function press_any_key(){ + echo "Press any key to continue or 'q' to exit" + while true ; do + read -r -n 1 k<&1 + if [ "$k" = q ] ; then + exit 1 + elif [ $? ] ; then + return 0 + fi + done +} + # If not done yet, install the wacom library and input driver # xbps-install -Sy libwacom xf86-input-wacom -# +echo "Install the needed packages..." +echo "libwacom :" +xbps-query -l | grep -qw libwacom \ + || sudo xbps-install -S libwacom +echo "xf86-input-wacom :" +xbps-query -l | grep -qw xf86-input-wacom \ + || sudo xbps-install -S xf86-input-wacom +echo "...done." +press_any_key # To see if the tablet and pen are recognized : # xsetwacom list devices -# +echo "Recognized devices :" +xsetwacom list devices +press_any_key # To look at the actual config of a component : # xsetwacom -s get "" all # The s option can be ommitted, I use it because you need it to see button mapping. -# -# To look at the different paramaters you can configure : +echo "Actual configuration of " +press_any_key +# To look at the different parameters you can configure : # xsetwacom list param -# +echo "Parameters :" +press_any_key # To look at the keys you can use for the mapping process : # xsetwacom list modifiers -# +echo "Modifiers :" +press_any_key # # You can look at the disposition and other stuffs of you tablet on /usr/share/libwacom/-.tablet # Exemple, for a Huion H420 : # cat /usr/share/libwacom/huion-h420.tablet # There's also a possibility to see an SVG file of the drawing at /usr/share/libwacom/layouts/-.svg -# +echo "Disposition of your equipment :" +press_any_key # # Setting up the buttons -# +echo "Button setup :" +press_any_key # on the tablet (pad) +echo "Tablet :" xsetwacom set "HUION H420 Pad pad" Button 1 key "ctrl" key "s" #top xsetwacom set "HUION H420 Pad pad" Button 2 key "ctrl" key "shift" key "z" #middle xsetwacom set "HUION H420 Pad pad" Button 3 key "ctrl" key "z" #bot - +press_any_key # on the pen +echo "Pen :" xsetwacom set "HUION H420 stylus" Button 3 key "e" #button facing up (not the click button on the top) - +press_any_key # Matching surface area to resolution of the main screen -xsetwacom set "HUION H420 stylus" MapToOutput eDP-1 #eDP-1 is the screen of the laptop, look at xrandr -q to see the one you want +echo "Matching surface area to the screen :" +xsetwacom set "HUION H420 stylus" MapToOutput eDP-1 #eDP-1 is the screen of my laptop, look at xrandr -q to see the one that you want to use +press_any_key -- cgit v1.2.3