reddit / emacs
How do I get Alt on Wayland in Emacs?
SequentialDesign · 2022-05-26 17:15
berenddeboer · 2022-05-27 04:10
Try `showkey -a` in a terminal, and see if the key registers.
_viz_ · 2022-05-27 07:33
https://www.reddit.com/r/emacs/comments/uqpdya/sway_emacs_and_the_super_key/
_viz_ · 2022-05-27 07:44
Oh nvm, I read Alt as super for some reason.
xircon · 2022-05-27 09:23
I run sway, all modifiers work and I have hyper assigned to the caps lock key. It should just work!
SequentialDesign · 2022-05-27 09:36
`alt` works? not `meta`, but `alt`?
xircon · 2022-05-27 09:46
All modifiers work, Alt, Meta(super), hyper (which I assigned to the caps lock key) and control.
How did you create the hyper key? Could you have accidently used the wrong mod? What distro are you on?
edit:
This is what I used for hyper
https://forum.endeavouros.com/t/how-to-convert-caps-lock-to-hyper-key/24575
SequentialDesign · 2022-05-27 09:56
I'm going to make fair use of hyper. that will keep the wolves at bay.
`hyper` works fine for me. one thing I saw is that the `alt` mask was removed in newer versions. "no one" used it, apparently.
could you by any chance show how you've set up `alt`? I never had problems in X11, but Wayland is different.
xircon · 2022-05-27 10:13
At work, but I did not do anything, it just works. Something in your config is causing this, either in sway or when you configured hyper.
How did you configure hyper?
SequentialDesign · 2022-05-27 10:22
I added the `hyper` mod in `/usr/share/X11/xkb/symbols/pc`, and that gave me the `hyper` mod. then I updated my keyboard layout with something like `replace right control with hyper`. that worked without problems.
but, when I tried doing the same thing with `alt`, I could only get `meta`, no matter what I tried.
xircon · 2022-05-27 11:23
So, if you undo all the changes, does alt work?
Which mod is hyper on? This is what I used:
```
modifier_map Mod3 { <HYPR> };
```
If you used mod2 this will clash with alt (this is from memory!!!!).
Sorry for the slow replies, at work, on windows and occasionally I am expected to do something :D
SequentialDesign · 2022-05-27 11:50
btw, what version of Emacs are you using?
yeah, I think put it on 3. can't remember. I'm too exhausted to use Linux at the moment. I put `meta` on `1` and `alt` on `5` and then tried switching them. but, still, I only ever got `meta`, never `alt`.
xircon · 2022-05-27 12:08
```
mod1 Alt_L (0x40), Meta_L (0xcd)
mod2 Num_Lock (0x94)
mod3
mod4 Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), ISO_Level3_Shift (0x6c), Mode_switch (0x85), Mode_switch (0xcb)
```
This is from xmodmap, alt & meta are on 1,try putting hyper on 3 and leaving 1 alone.
Emacs-git so version 29.nnn.nn.nn
SequentialDesign · 2022-05-27 12:18
xkb was made for X which uses 5 `mod` levels (it also has shift, lock, and control layers), so I assumed 5 was fair game.
from arch wiki:
> The bits in the state field have pre-defined names: Shift, Lock, Control, Mod1, Mod2, Mod3, Mod4 and Mod5, lowest to highest. Thus, Ctrl+Shift is 0x05, and so on. Client applications typically only check the bits they need, so an application with normal keyboard input and Ctrl+key shortcuts usually makes no distinction between Control and Control+Mod3 states.
SequentialDesign · 2022-05-28 11:15
I want to make sure I understand you. you are getting `alt` to show up as a modifier and `meta` to work as modifier (as it always does) and you are doing this on sway? so both `alt` and `meta` work as separate modifiers in sway for you. is that correct?
xircon · 2022-05-28 19:51
The only thing I did was create hyper, I didn't mess with anything else.
SequentialDesign · 2022-05-28 22:15
I think you might be confusing the Emacs `alt` modifier with the `alt` key. they're not the same.
my post was about getting the Emacs `alt` modifier to work in sway, not about getting the `alt` key to work.
Sudo_Brew · 2022-06-01 11:55
Isn't the `alt` modifier triggered by the `alt` key (without modification)? What's the difference you're alluding to?
I also have had no problems with modifiers on Wayland, and I don't know anything about any of this remapping, so I'm of no help here, just curious about this comment.
SequentialDesign · 2022-06-01 12:05
the `alt` key triggers `meta` in Emacs. to get `alt`, one has to change settings, which is what I do in Windows and Mac.
although, for right now, it doesn't seem to be possible in wayland because the `alt` mask isn't included in the latest GTK build of Emacs.
the above information corresponds to my experience in Sway/Wayland/Fedora 36. but you and xircon get `alt` out of the box. that's amazing. but I couldn't get that behavior. and I did try.