Author Topic: Send Compose/AltGr key with Soarer's mod?  (Read 1713 times)

0 Members and 1 Guest are viewing this topic.

Offline Logg

  • Thread Starter
  • Posts: 6
Send Compose/AltGr key with Soarer's mod?
« on: Thu, 01 February 2018, 08:19:19 »
I want to be able to make special characters on linux, and read on https://en.wikipedia.org/wiki/Compose_key that the Compose key used on Sun keyboards still works in Xorg. Looking at Soarer's codes.html, there are some keycodes special to the Sun keyboard, but not a compose key. Does anyone know if it's implemented but hiding, or what my other options are? Apparently Right-Shift + AltGr is also supported as a default "compose" key in Xorg, but I don't see a keycode/name for AltGr either, and RSHIFT+RALT doesn't work. :(

Offline Logg

  • Thread Starter
  • Posts: 6
Re: Send Compose/AltGr key with Soarer's mod?
« Reply #1 on: Thu, 01 February 2018, 09:26:24 »
to partially answer my own question, I made a macro to just test every key

Code: [Select]
#  macro EXTRA_F9
# PUSH_META CLEAR_META all
#    PRESS PAD_EQUALS
#    PRESS F13
#    PRESS F14
#    PRESS F15
#    PRESS F16
#    PRESS F17
#    PRESS F18
#    PRESS F19
#    PRESS F20
#    PRESS F21
#    PRESS F22
#    PRESS F23
#    PRESS F24
#    PRESS EXECUTE
#    PRESS HELP
#    PRESS MENU
#    PRESS SELECT
#    PRESS STOP
#    PRESS AGAIN
#    PRESS UNDO
#    PRESS CUT
#    PRESS PASTE
#    PRESS FIND
#    PRESS MUTE
#    PRESS VOLUME_UP
#    PRESS VOLUME_DOWN
#    PRESS LOCKING_CAPS_LOCK
#    PRESS LOCKING_NUM_LOCK
#    PRESS LOCKING_SCROLL_LOCK
#    PRESS PAD_COMMA
#    PRESS EQUAL_SIGN
#    PRESS INTERNATIONAL_1
#    PRESS INTERNATIONAL_2
#    PRESS INTERNATIONAL_3
#    PRESS INTERNATIONAL_4
#    PRESS INTERNATIONAL_5
#    PRESS INTERNATIONAL_6
#    PRESS INTERNATIONAL_7
#    PRESS INTERNATIONAL_8
#    PRESS INTERNATIONAL_9
#    PRESS LANG_1
#    PRESS LANG_2
#    PRESS LANG_3
#    PRESS LANG_4
#    PRESS LANG_5
#    PRESS LANG_6
#    PRESS LANG_7
#    PRESS LANG_8
#    PRESS LANG_9
#    PRESS ALTERNATE_ERASE
#    PRESS SYSREQ_ATTN
#    PRESS CANCEL
#    PRESS CLEAR
#    PRESS PRIOR
#    PRESS RETURN
#    PRESS SEPARATOR
#    PRESS OUT
#    PRESS OPER
#    PRESS CLEAR_AGAIN
#    PRESS CRSEL_PROPS
#    PRESS EXSEL
#    POP_ALL_META
#  endmacro

and none of them are altgr or compose. I asked in IRC if anyone had a keyboard with a real AltGr on it that would be willing to press it and give the results of "xev | grep keycode" and their output was

state 0x0, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES
compare that to my american Alt_R key:
state 0x18, keycode 108 (keysym 0xffea, Alt_R), same_screen YES

They have the same keycode, but a different keysym.

So I googled ISO_Level3_Shift and found that you can run the command xmodmap -pk | grep ISO_Level3_Shift to find out what keycodes your system maps to each name. I found out that on my system, that key symbol will be output with keycode 92. None of the keysymbols in the spoiler, nor Europe_2 output keycode 92

I still don't know how I can get fancy symbols to be produced out of this keyboard. I need to be able to press keycode 92, but all the questionable keysymbols on code.html aren't 92.

Offline Findecanor

  • Posts: 5040
  • Location: Koriko
Re: Send Compose/AltGr key with Soarer's mod?
« Reply #2 on: Thu, 01 February 2018, 17:18:10 »
At the USB level, right Alt is the same code as Alt Gr. The Menu key on PC keyboards has same code as the Compose key on Sun keyboards that talk USB -- so that is the code that I would have chosen if I was Soarer.

Then what the key actually does, that is X configuration. X has its own code space.

I run Ubuntu Mate, and in System->Preferences->Hardware->Keyboard, I click Layout and then in "Options", I choose "Location of Compose Key" to be "Menu".
On my system, right Alt is not on keycode 92 but on keycode 108. "Menu" is on keycode 135. The Compose key is called "Multi_key" under X.

Try this:
xmodmap -e "keycode 135 = Multi_key Multi_key Multi_key Multi_key"

I tried mapping Shift+Alt Gr to Multi_key but that didn't work...
« Last Edit: Thu, 01 February 2018, 17:25:04 by Findecanor »
🍉

Offline Logg

  • Thread Starter
  • Posts: 6
Re: Send Compose/AltGr key with Soarer's mod?
« Reply #3 on: Fri, 02 February 2018, 00:11:52 »
Thanks for the advice on doing AltGr in software, but I'm not aiming to find a way to have a specific computer's software configuration allow special characters. (actually my Alt_R is keycode 108 too).

If there is a way to send keycode 92, then a generic hardware solution is possible. It would work on any linux computer I plug the keyboard into, as long as they agree that keycode 92 maps to ISO_Level3_Shift.

It seems like sending arbitrary keycodes is not a documented feature of Soarer's firmware... So I'm wondering if there is any solution that would allow me to keep all the features that Soarer's offers + able to send keycode 92.

Offline JohanAR

  • Posts: 71
  • Location: Sweden
Re: Send Compose/AltGr key with Soarer's mod?
« Reply #4 on: Fri, 02 February 2018, 08:56:36 »
edit: NVM I forgot a step in my first comment, updating:

The codes you can send from your keyboard are the ones listed in section 10 of this document. Linux translates these codes into the keycodes you see in xkb/keycodes/evdev so there is no AltGr in the USB HID protocol, only RAlt which maps to keycode 108, as you noted. The only way you can get AltGr is to load a keymap which maps it, for example us(intl) variant, or give a lvl3 option to setxkbmap. It's the same with compose, you'll have to give a compose option to setxkbmap (or use xmodmap as Findecanor suggested):

setxkbmap -option compose:menu

Check /usr/share/X11/xkb/rules/base.lst for all the options you have.

In addition, rshift+AltGr does not map to compose for me, tried in both Xfce and i3, I get level 4 if I keep them held and they have no effect if I press and release them. Checking the Wikipedia article's source it says that it's the default in Gnome desktop, or at least that it was in Ubuntu 10.04. So I don't think it has anything to do with X.
« Last Edit: Fri, 02 February 2018, 15:21:47 by JohanAR »

Offline Logg

  • Thread Starter
  • Posts: 6
Re: Send Compose/AltGr key with Soarer's mod?
« Reply #5 on: Sat, 03 February 2018, 05:49:06 »
Thanks for the reply Johan. Is the consensus really that there is no way to do this, even though there is a keycode (92) which maps to ISO_Level3_Shift by default in X? (see my above reply) To me it seems like there should be a way to send any keycode that exists...

Code: [Select]
$xmodmap -pk | grep ISO_Level3_Shift
     92    0xfe03 (ISO_Level3_Shift) 0x0000 (NoSymbol) 0xfe03 (ISO_Level3_Shift)
« Last Edit: Sat, 03 February 2018, 05:50:55 by Logg »

Offline JohanAR

  • Posts: 71
  • Location: Sweden
Re: Send Compose/AltGr key with Soarer's mod?
« Reply #6 on: Mon, 05 February 2018, 05:40:39 »
I'm not an xkb expert, I just read up a little on this when I built some keyboards, so I can't say it's 100% impossible though I really think it is.. From my understanding it works like this:

Keyboard -> USB HID -> keycodes -> symbols -> Apps

The keycodes depend on what physical keys the keyboard has, though I think all USB keyboards use evdev unless you manually set something else. The symbol table depends on what language the user has chosen (US, Swedish..) but Linux also provide variants (US international, Swedish without dead keys, dvorak, etc..) by default. In addition Linux/xkb has different options (turn Menu into Compose, swap Ctrl and Caps-lock, and many others) that can be combined with your symbol table.

AFAIK your problem is that there's nothing your keyboard can send over USB which will be translated to keycode 92

Offline Logg

  • Thread Starter
  • Posts: 6
Re: Send Compose/AltGr key with Soarer's mod?
« Reply #7 on: Mon, 05 February 2018, 10:48:25 »
Well, it certainly seems that way... Thanks for the explanation Johan. I'll take your suggestion of mapping compose to menu.

Maybe I'll set a key on a different layer to type that mapping...  :rolleyes: