This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How do I rebind Caps Lock?

Tags: xmodmap, zenkaku, hankaku, keyboard, rebind, japanese, caps lock xmodmap, zenkaku, hankaku, keyboard, rebind, japanese, caps lock xmodmap, zenkaku, hankaku, keyboard, rebind, japanese, caps lock
(comma "," separated)
aabbqrstp
Registered Member
Posts
13
Karma
0
OS

How do I rebind Caps Lock?

Sat May 22, 2010 7:36 pm
Since I study Japanese and I never use caps lock I want to rebind it to another key that I can use to change input mode in ibus.

I've tried to edit the keyboard variant I'm using (se, at /usr/share/X11/xkb/symbols/se) and add this to it:
Code: Select all
key <CAPS>  {
   type[Group1]="PC_ALT_LEVEL2",
   symbols[Group1]= [ Zenkaku_Hankaku, Kanji ]
};

I got this from the Japanese file, and it is the specification for they key used to switch mode on a Japanese computer (normally 'key <HZTG>' but I changed it to <CAPS>).

However nothing happens. (I've also unsuccessfully tried to rebind it to other keys just to see if I could get anything to happen)

What am I doing wrong?
Is there a better way of doing it?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: How do I rebind Caps Lock?  Topic is solved

Sat May 22, 2010 11:50 pm
You shouldn't be altering files in /usr as they are managed by your package manager, and will be overwritten during updates.

You should use "xmodmap" to make changes to the active keyboard layout.

Code: Select all
xmodmap -e "keysym Caps_Lock = Control_L"


You simply need to change "Control_L" to the appropriate item, which you will need to determine then ensure this command is run on login.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
aabbqrstp
Registered Member
Posts
13
Karma
0
OS

Re: How do I rebind Caps Lock?

Sat May 22, 2010 11:58 pm
Thanks!
I was so set on using setxkbmap somehow that I missed xmodmap.

I got it working now with:
Code: Select all
xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "keysym Caps_Lock = Zenkaku_Hankaku"

.. in case anyone else wonders.

[Edit]
Had to add another line first to disable caps lock.
Pantsu
Registered Member
Posts
3
Karma
0
OS

Re: How do I rebind Caps Lock?

Fri Jun 25, 2010 6:27 pm
aabbqrstp wrote:Thanks!
I was so set on using setxkbmap somehow that I missed xmodmap.

I got it working now with:
Code: Select all
xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "keysym Caps_Lock = Zenkaku_Hankaku"

.. in case anyone else wonders.

[Edit]
Had to add another line first to disable caps lock.

Such a thing would be very handy, since Caps Lock is useless for me as well.
Which file do you have to put this in so it's executed on every login?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: How do I rebind Caps Lock?

Fri Jun 25, 2010 9:36 pm
Simply create a file ending with ".sh" in ~/.kde4/Autostart ( such as rebind-capslock.sh ) and place those lines in that file. After ensuring it is executable, log out and back in again.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
ivan
KDE Developer
Posts
918
Karma
14
OS

Re: How do I rebind Caps Lock?

Fri Jun 25, 2010 10:15 pm
For KDE-way, start
$ kcmshell4 kcm_keyboard
(or find it in system settings)

Go to the 'Advanced' tab -> Ctrl key position -> Make CapsLock an additional Ctrl


Image
shmerl
Registered Member
Posts
251
Karma
1
OS

Re: How do I rebind Caps Lock?

Thu Mar 23, 2017 11:51 pm
Is there a KDE way to rebind CapsLock to Left Alt?
bamboozled
Registered Member
Posts
1
Karma
0

Re: How do I rebind Caps Lock?

Mon Jan 24, 2022 10:20 pm
I want to swap Caps Lock for Escape. Is there a way to do this from KDE or do I have to do it from the terminal?


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], Yahoo [Bot]