You are not logged in.

#1 2011-05-23 22:15:45

Ideka
Member
Registered: 2011-01-19
Posts: 15

[SOLVED] Remapping Caps Lock to Esc and viceversa on ttys.

I have the following code in my /etc/rc.local:

# Swap Esc and CapsLock.
/bin/echo keycode 1 = Caps_Lock | /usr/bin/loadkeys
/bin/echo keycode 58 = Escape | /usr/bin/loadkeys

What it does is remapping Caps Lock to Esc and viceversa. Or rather, that's what it used to do. Now it simply doesn't work.
Running it manually (both as root and as a normal user) doesn't work either, and it returns 0 and outputs nothing.

I suspect this may have to do with the relatively new version of the kbd package, 1.15.3-1. I confirmed this by downgrading to version 1.15.2-1.

Ideas?

Last edited by Ideka (2011-05-26 03:34:22)

Offline

#2 2011-05-23 22:48:28

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Remapping Caps Lock to Esc and viceversa on ttys.

I'm not sure who's the upstream for this package, but maybe you should report it there.

http://mailman.archlinux.org/pipermail/ … 20056.html

Last edited by karol (2011-05-23 22:49:51)

Offline

#3 2011-05-24 00:00:25

Ideka
Member
Registered: 2011-01-19
Posts: 15

Re: [SOLVED] Remapping Caps Lock to Esc and viceversa on ttys.

So you think it's a bug? hmm
I reported it here: http://freshmeat.net/projects/kbd

Thanks.

Last edited by Ideka (2011-05-24 00:01:15)

Offline

#4 2011-05-24 00:25:08

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Remapping Caps Lock to Esc and viceversa on ttys.

I've managed to dump, edit and load some settings, so now it says:

[karol@black ~]$ dumpkeys | grep "keycode   1 "
keycode   1 = Caps_Lock       
    alt    keycode   1 = Meta_Escape     
    shift    alt    keycode   1 = Meta_Escape     
    control    alt    keycode   1 = Meta_Escape  
[karol@black ~]$ dumpkeys | grep "keycode  58 "
keycode  58 = Escape

but nothing changed in the way Esc and Capslock behave.

[karol@black ~]$ /bin/echo keycode 1 = Caps_Lock | /usr/bin/loadkeys -v

Changed 0 keys and 0 strings.
(No change in compose definitions.)
[karol@black ~]$ /bin/echo keycode 58 = Escape | /usr/bin/loadkeys -v

Changed 0 keys and 0 strings.
(No change in compose definitions.)

Last edited by karol (2011-05-24 00:27:54)

Offline

#5 2011-05-26 03:33:09

Ideka
Member
Registered: 2011-01-19
Posts: 15

Re: [SOLVED] Remapping Caps Lock to Esc and viceversa on ttys.

Well, it seems it was a bug after all:

Alexey Gladkov (kbd dev) wrote:

Yes. This is regression. The program code was heavily redesigned.

I fixed this in git. But while you can use this:

echo keycode 1 = Caps_Lock | loadkeys -

smile

Offline

#6 2011-05-26 16:16:48

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Remapping Caps Lock to Esc and viceversa on ttys.

Ideka wrote:

Well, it seems it was a bug after all:

Alexey Gladkov (kbd dev) wrote:

Yes. This is regression. The program code was heavily redesigned.

I fixed this in git. But while you can use this:

echo keycode 1 = Caps_Lock | loadkeys -

smile

Can you post a link? I don't know if I'm getting this right but I've already tried it before and

[karol@black ~]$ echo keycode 1 = Caps_Lock | loadkeys -
Loading <stdin>
Keymap 0: Permission denied
[karol@black ~]$ sudo echo keycode 1 = Caps_Lock | loadkeys -
Loading <stdin>
Keymap 0: Permission denied

I get an error.

Offline

#7 2011-06-27 04:28:13

Ideka
Member
Registered: 2011-01-19
Posts: 15

Re: [SOLVED] Remapping Caps Lock to Esc and viceversa on ttys.

Well, this is a month late but...
By runnig this:

$ sudo echo keycode 1 = Caps_Lock | loadkeys -

you are only running echo as root, not the whole command. You have to do this:

$ echo keycode 1 = Caps_Lock | sudo loadkeys -

Offline

Board footer

Powered by FluxBB