Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: Keybindings for touchpad toggle (Read 503 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Keybindings for touchpad toggle

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?



 

Re: Keybindings for touchpad toggle

Reply #1
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.