3

I want it like this:

BackSpace -> backslash

Shift + BackSpace -> bar

backslash -> BackSpace

I tried to use xbindkeys and xdotool, but I couldn't get it to work. This is what I had in my .xbindkeysrc file:

"xdotool key bar"
  shift + BackSpace
"xdotool key backslash"
  BackSpace
"xdotool key BackSpace"
  backslash

However, all this would do is make my keys stop working.

1 Answers1

1

it is not possible with xdotool because your are linking two keys together.. system will struggle when you say backslash it reroute to BackSpace & when you say BackSpace again it reroutes to backslash and this loop keep on running

[backslash-->BackSpace-->backslash-->BackSpace-->backslash-->so on-->]

[BackSpace-->backslash-->BackSpace-->backslash-->BackSpace-->so on-->]

your all other keys works if you remove this kind of links..

for example: both of below will work.

"xdotool key space"
  Shift + BackSpace + Release
"xdotool key backslash"
  BackSpace + Release

or

"xdotool key space"
  Shift + BackSpace + Release
"xdotool key BackSpace"
  backslash + Release

the best way is to map the keys with this answer..https://askubuntu.com/a/24930/739431

i have tried it on my keybord and easily swapped backslash & BackSpace keys.

Example:

below are the values for the required keys by running xev command and pressing required keys.

state 0x10. keycode 51 (keysym 0X5c, backslash), same_screen YES,

stat 0X10, keycode 22 (keysym 0xff08, BackSpace), same_screen YES,

$ xmodmap -e "keycode 51 = BackSpace"
$ xmodmap -e "keycode 22 = backslash"
PRATAP
  • 22,460
  • xmodmap -e "keycode 22 = backslash" made it so that I couldn't type the bar key, but I fixed this with xmodmap -e "keycode 22 = backslash bar" – James Wang Dec 15 '18 at 23:20
  • 1
    @James Wang, i have given example in the answer.. your exact key naming can be obtained by xev command. any way you could achieve what you need. i am glad about it. Thank You. – PRATAP Dec 16 '18 at 03:12