Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
making caps lock behave like a modifier key [xmodmap]?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
indietrash
Guru
Guru


Joined: 17 Sep 2008
Posts: 353
Location: Norway

PostPosted: Fri Aug 27, 2010 8:49 am    Post subject: making caps lock behave like a modifier key [xmodmap]? Reply with quote

how would I go about making caps lock behave like it's a hyper key using xmodmap? I would also like to remap caps lock to alt gr as well, but my main priority is gaining a new modifier key in exchange for caps lock.

why the hyper key? because I already have ctrl, alt, shift and super, and I would like another one for managing windows in openbox. caps lock + hjkl and caps lock + f1-f12 for changing workspaces, caps lock + alt + hjkl and caps lock + alt + f1-f12 for moving stuff to workspaces - and possibly more.
Back to top
View user's profile Send private message
indietrash
Guru
Guru


Joined: 17 Sep 2008
Posts: 353
Location: Norway

PostPosted: Fri Aug 27, 2010 9:11 am    Post subject: Reply with quote

here's info for my caps lock key:
Code:
    root 0x15a, subw 0x0, time 144211, (140,37), root:(806,398),
    state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

and this is my alt gr key:
Code:
    root 0x15a, subw 0x0, time 144698, (140,37), root:(806,398),
    state 0x2, keycode 113 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3256

PostPosted: Fri Aug 27, 2010 9:24 am    Post subject: Reply with quote

Here. This might be useful:
http://www.terminally-incoherent.com/blog/2007/08/02/remapping-the-caps-lock-key/
_________________
emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/
Back to top
View user's profile Send private message
indietrash
Guru
Guru


Joined: 17 Sep 2008
Posts: 353
Location: Norway

PostPosted: Fri Aug 27, 2010 12:40 pm    Post subject: Reply with quote

I've seen that, but I've been unsuccessful in using it.

here's what I attempted:
Code:

        remove Lock = Caps_Lock
        keysym Caps_Lock = Hyper_L
        add Mod5 = Hyper_L


this gave the following errors:
Code:

alexander@lolwabbit ~ $ xmodmap test
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  118 (X_SetModifierMapping)
  Value in failed request:  0x17
  Serial number of failed request:  14
  Current serial number in output stream:  14


my caps lock now functions like a shift key that only capitalises letters. this means I can't hold it to mark text or anything equivalent, it merely functions for capitalising letters (like shift), to the extent of my knowledge. in openbox's rc.xml I have a keybind for H-j. this does not happen with my current setting.

here's xev's output regarding my key at its present state:
Code:

    root 0x15a, subw 0x0, time 12699801, (272,243), root:(938,604),
    state 0x0, keycode 66 (keysym 0xffed, Hyper_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3256

PostPosted: Fri Aug 27, 2010 1:40 pm    Post subject: Reply with quote

I am not very familiar with xmodmap (which is part of the reason why I simply pointed you to a webpage). But, from your xev output it seems like xmodmap has correctly mapped Caps Lock to Hyper_L :!:
Quote:
state 0x0, keycode 66 (keysym 0xffed, Hyper_L), same_screen YES,
Perhaps the subsequent behavior of "Hyper_L" as only shift is the intended behavior?
_________________
emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/
Back to top
View user's profile Send private message
indietrash
Guru
Guru


Joined: 17 Sep 2008
Posts: 353
Location: Norway

PostPosted: Fri Aug 27, 2010 5:15 pm    Post subject: Reply with quote

that might be. I am however not interested in the default behaviour of the button. I want to use it as a modifier key in my openbox key-binds, to which it does not work.
Back to top
View user's profile Send private message
qstbn
n00b
n00b


Joined: 20 Aug 2010
Posts: 4
Location: NZ

PostPosted: Fri Sep 03, 2010 8:58 am    Post subject: Reply with quote

Hey

This has been a regular quest for me, I hope I can help.

With a fresh, default keyboard map working, I tried following this example
http://blacketernal.wordpress.com/set-up-key-mappings-with-xmodmap/

and now I have this code at the end of the modmap file I'd like to use
Code:

add shift = Shift_L Shift_R
add control = Control_L Control_R
add mod1 = Alt_L Alt_R Meta_L
add mod2 = Num_Lock
add mod3 = Hyper_L
add mod4 = Super_L Super_R Super_L
add mod5 = ISO_Level3_Shift Mode_switch
keysym Alt_R = Mode_switch


this allows me to have a keybind in the keyboard section of ~/.config/openbox/rc.xml such as this (i created it randomly):
Code:

<keybind key="H-A-g">
      <action name="Execute">
        <command>grpn</command>
      </action>
</keybind>


Let me know if that example works for you, because I'd like to know more about it, as I'm a Caps/Ctrl swapper, and change keyboards often.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum