You are not logged in.

#1 2018-02-16 14:52:06

bheadmaster
Member
Registered: 2017-10-27
Posts: 43

[SOLVED] How to map a key combination to a unicode character? (X11)

Is there a simple way to map a key combination to a specific unicode character? In particular, I'd like to have a way to add umlauts to wovels when pressed with right alt (and ralt+shift for uppercase) without having to change keyboard layout. I've read the "Keyboard configuration" page on archwiki and searched the forums, but I've only gotten more and more confused.

Is there a simple way to do this?

Last edited by bheadmaster (2018-02-16 15:43:36)


.............|
............/  GNU
........../
__---'''             o  LINUX

Offline

#2 2018-02-16 15:13:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: [SOLVED] How to map a key combination to a unicode character? (X11)

Isn't changing the layout (temporarily) the simple way of doing this?  You can have multiple layouts that you can toggle between with a keypress.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2018-02-16 15:19:20

bheadmaster
Member
Registered: 2017-10-27
Posts: 43

Re: [SOLVED] How to map a key combination to a unicode character? (X11)

Isn't changing the layout (temporarily) the simple way of doing this?

Indeed, but the process of changing the layout is complicated and I couldn't follow through. I get a lot of errors and I believe asking such an question would most likely get me flamed. This way I could have all the keys I need without having to change anything.


.............|
............/  GNU
........../
__---'''             o  LINUX

Offline

#4 2018-02-16 15:20:02

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: [SOLVED] How to map a key combination to a unicode character? (X11)

Other alternatives are to derive your main layout and change the 3rd and 4th level symbols for the desired keys or, even simpler, to use xmodmap (which though has caveats when dealing with dynamic keyboard/layout setups)

Edit: how is changing keyboard layouts "complicated"???

Last edited by seth (2018-02-16 15:20:53)

Offline

#5 2018-02-16 15:35:38

bheadmaster
Member
Registered: 2017-10-27
Posts: 43

Re: [SOLVED] How to map a key combination to a unicode character? (X11)

Edit: how is changing keyboard layouts "complicated"???

Turns out it's not. Simple

setxkbmap de

does it.
*sigh*
I was reading the wrong wiki page the whole time. Sorry for this. Should I delete this thread or...?


.............|
............/  GNU
........../
__---'''             o  LINUX

Offline

#6 2018-02-16 15:39:36

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: [SOLVED] How to map a key combination to a unicode character? (X11)

You can also have several layouts and toggle between them (should be faster than resetting the entire layout)
If you figured a solution and are no longer interested you should edit your first posts subject and mark the thread as [SOLVED]
If you feel embarrassed by the thread, you can click report and ask a mod to delete it.

Offline

#7 2018-02-16 15:43:23

bheadmaster
Member
Registered: 2017-10-27
Posts: 43

Re: [SOLVED] How to map a key combination to a unicode character? (X11)

seth wrote:

You can also have several layouts and toggle between them (should be faster than resetting the entire layout)

I see. Although I'll most likely bind a key in i3wm config to switch between layouts, since all those xkb/x11 stuff frustrates the hell out of me sometimes.
Thank you for your help though. Will mark as solved.


.............|
............/  GNU
........../
__---'''             o  LINUX

Offline

#8 2018-02-16 21:21:23

Alber
Member
From: Spain - España
Registered: 2011-11-11
Posts: 227

Re: [SOLVED] How to map a key combination to a unicode character? (X11)

Have you keyboard layout dead keys? a key that once pressed waits for another to be pressed, and thus show a symbol.

Spanish have four,  dead_acute ´, dead_grave `, dead_circumflex ^, dead_diaresis ¨

You can create a file, ~/.XCompose, and add keystrokes to get an unicode char.
As example:

# .XCompose
<dead_acute> <s>                : "$" dollar
<dead_acute> <b>                : "|" bar
<dead_acute> <n>                : "#" numbersign

See .XCompose to know more.
Read too:
https://wiki.archlinux.org/index.php/Ke … mbinations


Edit:
Alternatively, you can add a compose key.
https://wiki.archlinux.org/index.php/Ke … ompose_key
Or try to add a dead_key in the same way.

Last edited by Alber (2018-02-16 22:05:08)


Because not all of us are native English speakers, try no to use slang or abbreviations, thank you.

Offline

Board footer

Powered by FluxBB