Use left alt as backspace

My finger hurts too much when I press backspace button on my keyboard. (its too far) And as a broke student, I don’t have the cash to build myself a custom keyboard or something.

So I want to use left Alt button as backspace. Using xev I could find that keycode for left alt button is 64 and keycode for backspace button is 22. But I have no idea what to do after that :sweat:

Any help appreciated :pray:

In case its required, I use Dvorak Programmer layout. I activate it using setxkbmap dvp in my i3wm config file. (not the most elegant way). I also have escape swapped with caps lock using setxkbmap -option caps:swapescape, in i3wm config.

Edit : I am using i3wm. No desktop environment.

1 Like

Are you using KDE? You can easily set the capslock as an additional backspace button in your keyboard settings.

Screenshot_20210412_060600

2 Likes

Thanks. But I am using i3wm. Sorry for not mentioning in my post. :pray:

1 Like

i3. . . got it. I’m looking through the i3 documentation. It’ll be some sort of bindsym mod4 (left alt I believe) backspace

wait a minute

can i3 do that?
Bindsym is for defining keyboard shortcuts. For remapping keys, I suppose Xmodmap or something should be used, but I failed to understand its syntax.

I would ASSUME so. . . but I can’t say I’ve ever done that before. I’m looking through documentation now.

Well then I’ll go and look for it. Use your time for something else.

I was looking at 4.3 keybindings section

https://i3wm.org/docs/4.3/userguide.html

1 Like

@fbodymechanic

bindsym [–release] [Modifiers+]keysym command

I know this part. Now the command needs to be a shell script or a shell command. Is it possible to input Backspace character via a shell command? :thinking:

I would just try backspace. There’s GOTTA be a way to script it. Like bindsym keysym and then revert to the backspace key somehow?

I found new solution and problem.

I run this in terminal

xmodmap -e "keycode 64 = BackSpace" 

Now Alt works as backspace but only in terminal and deletes the whole word instead of character. Does not work in firefox.

Edit : In mouse pad it works fine.

In your i3 config you will probably have to release the alt as a modifier from i3 somehow since it should be a default modifier binding.

Also, don’t forget to restart the config.

I use super as modifier. So i3 is not conflicting.

Use xcape, this will backspace on tap, but held it will still be Alt:

xcape -e 'Alt_L=BackSpace'&

Not tested, but should be OK, run from a terminal to test first.

1 Like