| View previous topic :: View next topic |
| Author |
Message |
Zebbeman n00b


Joined: 14 Jun 2003 Posts: 56
|
Posted: Fri Nov 06, 2009 10:23 pm Post subject: [solved] Trademark™ character with key combination |
|
|
Hi,
I want to use a key combination to get the Trademark™ sign. I am using Openbox, so I tried to find a way to bind ctrl+t to the ™ code (U+2122, 0xE2 or equivalent) in rc.xml but I did not understand how to do that. Does anyone know how to make ctrl+t printing a ™ sign? It does not have to be in rc.xml, any suggestion is welcome.
Last edited by Zebbeman on Tue Nov 17, 2009 5:22 pm; edited 1 time in total |
|
| Back to top |
|
 |
Chris W l33t


Joined: 25 Jun 2002 Posts: 960 Location: Brisbane, Australia
|
Posted: Sat Nov 07, 2009 7:42 am Post subject: |
|
|
You could use the Compose key mechanism in X. | Code: |
$ xmodmap -e "keysym Menu = Multi_key"
|
Sets the Menu key (assuming a Windows keyboard) as the Compose or Multi-key. Then pressing and releasing the keys one at a time: generates the ™ code at least on my machine. As a bonus, typing accented Latin characters is also done this way: | Code: |
Menu ' a
Menu ` a
Menu ~ e | áàẽ ...
You might already have something mapped to Compose key have a look at: | Code: |
$ xmodmap -pk | grep Multi_key
|
You should be able to make the change permanent with a ~/.Xmodmap file containing just the "keysym Menu = Multi_key" string or by putting the full command in another startup file (.xinitrc or the like).
Another approach is to use a key as "Mode_switch" and a free modifier: | Code: |
$ xmodmap
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
|
mod 3 is free, and I'll use my right Windows key (keycode 134, found using xev): | Code: |
$ xmodmap -e 'keycode 134 = Mode_switch'
$ xmodmap -e 'clear mod3'
$ xmodmap -e 'add mod3 = Mode_switch'
|
then: | Code: |
$ xmodmap -e 'keycode 28 = t T trademark trademark'
|
Pressing Mode_Switch+t (together) should get you the ™ symbol. _________________ Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein |
|
| Back to top |
|
 |
Zebbeman n00b


Joined: 14 Jun 2003 Posts: 56
|
Posted: Sat Nov 07, 2009 11:04 am Post subject: |
|
|
Thanks! Works perfect!
Is there any way to add this to Alt Gr + t? I tried, of course, replacing 134 with 108 but all my other ©® and such disappeared  |
|
| Back to top |
|
 |
Chris W l33t


Joined: 25 Jun 2002 Posts: 960 Location: Brisbane, Australia
|
Posted: Sat Nov 07, 2009 10:30 pm Post subject: |
|
|
I assume that AltGr+c and AltGr+r currently give you the copyright and registered symbols before the tweaks above. You'd have to look at your xmodmap output (before tweaks) to see the mappings for the C, R, T and Alt keys: | Code: |
$ xmodmap
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Mode_switch (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
$ xmodmap -pke | egrep '[crt] [CRT]|108'
keycode 27 = r R r R r R
keycode 28 = t T t T t T
keycode 54 = c C c C c C
keycode 108 = Alt_R Meta_R Alt_R Meta_R Alt_R Meta_R
|
I'd guess that AltGR (may be an alias for Alt_R) is already mapped as the Mode_switch key and to mod1, 2, 3, or 4 (not 5), and that your mappings look something like: | Code: |
keycode 27 = r R registered registered r R
keycode 28 = t T t T t T
keycode 54 = c C copyright copyright c C
keycode 108 = Mode_switch
|
in which case a simple: | Code: |
xmodmap -e 'keycode 28 = t T trademark trademark t T'
|
should see you good.
For my locale the symbols that the Multi_key compose approach can build is in /usr/share/X11/locale/en_US.UTF-8/Compose. The copyright and registered symbols are | Code: |
<Multi_key> <o> <c> : "©" copyright # COPYRIGHT SIGN
<Multi_key> <o> <C> : "©" copyright # COPYRIGHT SIGN
<Multi_key> <O> <c> : "©" copyright # COPYRIGHT SIGN
<Multi_key> <O> <C> : "©" copyright # COPYRIGHT SIGN
<Multi_key> <o> <r> : "®" registered # REGISTERED SIGN
<Multi_key> <o> <R> : "®" registered # REGISTERED SIGN
<Multi_key> <O> <r> : "®" registered # REGISTERED SIGN
<Multi_key> <O> <R> : "®" registered # REGISTERED SIGN
|
so they are still available this way. _________________ Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein |
|
| Back to top |
|
 |
Zebbeman n00b


Joined: 14 Jun 2003 Posts: 56
|
Posted: Tue Nov 17, 2009 5:21 pm Post subject: |
|
|
Thanks again!
It did not work exactly like you wrote, but almost. I changed:
xmodmap -e 'keycode 28 = t T trademark trademark t T'
to:
xmodmap -e 'keycode 28 = t T t T trademark trademark'
Zebbeman™ |
|
| Back to top |
|
 |
Chris W l33t


Joined: 25 Jun 2002 Posts: 960 Location: Brisbane, Australia
|
Posted: Tue Nov 17, 2009 9:26 pm Post subject: |
|
|
Your AltGr key would seem to be mapped to the ISO_Level3_Shift keysym, which is why the 5th and 6th modifiers were needed rather than the 3rd/4th which are controlled by the Mode_Switch keysym. The doco on this stuff is truly confusing.
Anyway, good to see you going. _________________ Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein |
|
| Back to top |
|
 |
|
|
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
|
|