You are not logged in.
I like to swap my Esc and CapsLock key on my keybaord and I can achieve that with
setxkbmap -option caps:swapescapeI've also placed it on my xintirc and it works fine when I first turn my computer on. But if I unplug my keyboard(I switch between devices) the effect is gone.
So i want to run that command when I plug in my keyboard
The output of
lsusbis as follows:
Bus 002 Device 035: ID 258a:002a SINO WEALTH Gaming KB I am sure this is the correct device. Because if I unplug that keyboard and run lsusb that line goes missing. I've created a file
/etc/udev/rules.d/00-usb-keyboard.rulesand in there I have
ACTION=="add", SUBSYSTEMS=="usb", ATTR{idVendor}=="258a", ATTR(idProduct}=="002a",
RUN+=" /bin/bash -c 'setxkbmap -option caps:swapescape' "But it has no affect what so ever. What am I doing wrong here? The file name "00-usb-keyboard.rules" is something that I've randomly put, could that be the problem?
Last edited by nikinbaidarr (2021-08-05 17:42:15)
Offline
Wrong user and missing authority and display, https://gist.github.com/AladW/de1c5676d93d05a5a0e1
Also the approach is likely wrong, you can apply layout (options) to match specific devices only, https://wiki.archlinux.org/title/Xorg/K … tion_files
Edit: MatchProduct/MatchVendor - lookup "xinput list" for the product string.
Last edited by seth (2021-08-05 09:27:46)
Offline
Also the approach is likely wrong, you can apply layout (options) to match specific devices only, https://wiki.archlinux.org/title/Xorg/K … tion_files
We were right. My approach was definitely incorrect.
I added the following block in /etx/X11/xorg.conf.d file:
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
# Option "XkbLayout" "cz,us"
Option "XkbModel" "pc104"
# Option "XkbVariant" ",dvorak"
Option "XkbOptions" "caps:swapescape"
EndSectionNow it is perfectly working. Although could you suggest a way to achieve similar key swapping on the linux terminal as in not just on the xserver?
Offline
Were we… ;-)
I would assume that you have to derive your own layout in /usr/share/kbd/keymaps/i386/ - either include or copy an existing one.
And: you'll probably have to go w/ a udev rule if you want that setting to be dynamic (and automatic)
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline
Hahaha I meant to say You. Your were right lol.
Yeah I will mark this as solved now.
Offline