You are not logged in.

#1 2020-09-01 14:30:13

jerryDaBaaws
Member
Registered: 2020-06-08
Posts: 115

Run script through udev rule

I am mapping
super_R to Alt+F2
and
Super_L to Alt+F1
using xcape, but somehow Super_R mapping works once and then breaks after I connect to an external keyboard everytime ,   remapping xmodmap and xcape using below script work, but now if I run the script using udev rule, nothing is happening, I looked over to similar posts on forum, but couldn't make any sense of them
How to fix this permission issue with udev ?
udev rule

ATTRS{idVendor}=="258a", ATTRS{idProduct}=="1006", RUN+="/home/kushy/.scripts/ext_keyboard.sh"

script

export DISPLAY=:0
export XAUTHORITY=/home/kushy/.Xauthority
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
killall -9 xcape
while pgrep -u $UID -x xcape >/dev/null; do sleep 0.5; done
/usr/bin/xmodmap /home/kushy/.xmodmap
/usr/bin/xcape -e "Super_R=Alt_L|F2" 
/usr/bin/xcape -e "Super_L=Alt_L|F1"  
dunstify   -u normal "Ext keyboard connected"

ps: script does get executed on keyboard connection as I can log output to a file from the script

Offline

Board footer

Powered by FluxBB