Artix Linux Forum

Artix Linux => Installation / Migration / Configuration => Topic started by: shako on 26 October 2021, 18:11:30

Title: Keybindings for touchpad toggle
Post by: shako on 26 October 2021, 18:11:30
Dear all,

I am trying to set up a keybinding for enabling/disabling touchpad in dwm. I followed the instructions provided in the wiki; installing xf86-input-synaptics and creating this touchpad_toggle.sh script (made executable) in /home/artix/.scripts/:

Code: [Select]
!/bin/bash

declare -i ID
ID=`xinput list | grep -Eio '(touchpad|glidepoint)\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
declare -i STATE
STATE=`xinput list-props $ID | grep 'Device Enabled' | awk '{print $4}'`
if [ $STATE -eq 1 ]
then
    xinput disable $ID
else
    xinput enable $ID
fi

I then added these lines in my config.def.h file in my dwm folder:
Code: [Select]
static const char *distouch[] = {"/home/artix/.scripts/touchpad_toggle.sh", NULL };
under /* appearence */
and
Code: [Select]
{ MODKEY|ShiftMask, XK_t, spawn, {.v = distouch } },
under /* modifier */.

After modifying the config.def.h file. I run:
sudo cp config.def.h config.h
sudo make clean install


My intention is to enable/disable the touchpad with Mod+Shift+t by running the abovementioned script, but something is wrong. Perhaps the arguments in the definition of distouch in the appearence section?


Title: Re: Keybindings for touchpad toggle
Post by: calvinh on 26 October 2021, 18:43:50
Dear all,

I am trying to set up a keybinding for enabling/disabling touchpad in dwm. I followed the instructions provided in the wiki; installing xf86-input-synaptics and creating this touchpad_toggle.sh script (made executable) in /home/artix/.scripts/:

Code: [Select]
!/bin/bash

declare -i ID
ID=`xinput list | grep -Eio '(touchpad|glidepoint)\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
declare -i STATE
STATE=`xinput list-props $ID | grep 'Device Enabled' | awk '{print $4}'`
if [ $STATE -eq 1 ]
then
    xinput disable $ID
else
    xinput enable $ID
fi

I then added these lines in my config.def.h file in my dwm folder:
Code: [Select]
static const char *distouch[] = {"/home/artix/.scripts/touchpad_toggle.sh", NULL };
under /* appearence */
and
Code: [Select]
{ MODKEY|ShiftMask, XK_t, spawn, {.v = distouch } },
under /* modifier */.

After modifying the config.def.h file. I run:
sudo cp config.def.h config.h
sudo make clean install


My intention is to enable/disable the touchpad with Mod+Shift+t by running the abovementioned script, but something is wrong. Perhaps the arguments in the definition of distouch in the appearence section?




Does the script itslef work? Did you remember to change its permission to executable? The dwm part looks good to me.