Alacritty - Using super as a modifier?

My internet foo is weak today :smiley: (That will be the half bottle of vodka I had last night), and I am going round in circles.

What I want (super+r) works out of the box in konsole, but cannot get it to work in Alacritty, have fiddled with the config and no dice.

Any ideas?

1 Like

What do you want super+r to do?

Emacs in the terminal (counsel-recentf), works fine in konsole, but have invested a lot of time in and prefer Alacritty.

What do you want to get after you press super+r?
There is an entire section for key bindings in ~/.config/alacritty/alacritty.yml file.
So the minimum is something like this in your config file.

key_bindings:
  - { key: R, mods: Super, action: None }

Where you replace None with your desired action. Also I am not sure if those letters has to be capital like in the example.
Keep in mind that your desktop environment may intercept the shortcut (if you have that setting in your DE enabled) before it reaches alacritty and this config will have no effect.

Is that function of the terminal or Emacs?
If that is something only emacs can do then you have an option to run a command with alacritty key binding (rework example below).

- { key: R, mods: Super, command: { program: "notify-send", args: ["aaa", "bbb"] } }

On the left Alacritty, on the right konsole. I have pressed super+r in each, but only kosole responds and passes the key to emacs.

In emacs I have (global-set-key (kbd "s-r") 'counsel-recentf) set as a keybind. This works perfectly in the gui version and in konsole, but Alacritty does not respond.

I have tried editing the yaml file, but cannot work out what to put in it. Konsole (using xxd) seems to return ^X@sr I cannot translate to anything that works.

So you want to send a key sequence to emacs and not to alacritty itself. This is pretty much specific to the termial which sequence it sends.

First check $TERM value in each terminal.
echo $TERM
Alacritty do not have $TERM set by default I think so try to set it first and run emacs.
TERM=alacritty emacs
If that did not work then start emacs with the value from Konsole - e.g. TERM=Konsole emacs. Does that fix the problem?

You can force alacritty to send a correct character sequence with key-binding in the config file.

key_bindings:
  - { key: R, mods: Super, chars: '^X@sr' }

Only thing is that you have to specify a correct sequence ^X@sr.
Link to some helpful text.

Tried all of that, chars ‘^X@sr’ just send those characters.

If you look at the standard yaml:

 - { key: F12,      mods: Super,   chars: "\x1b[24;3~"      

Sends Super-F12

So I tried "\x1b[72;3~" as R seemed to return 72 (with xdd).

Also with showkey:

showkey -a                   
Press any keys - Ctrl-D will terminate this program

r       114 0162 0x72
^X@sr    24 0030 0x18
         64 0100 0x40
        115 0163 0x73
        114 0162 0x72
^[[24~   27 0033 0x1b
         91 0133 0x5b
         50 0062 0x32
         52 0064 0x34
        126 0176 0x7e

I tried all sorts of combos, but they all send characters to emacs and not the keybind.

Well, can you remap emacs to accept super-F12 and remap alacritty to send super-F12 when you press super-r? :grin:

1 Like

Like it, but no :smiley: :smiley:

It is muscle memory, use it in the gui version. Have posted an issue, will update if I get anywhere.

1 Like

Apparently “It’s not supposed to work.” and my issue way closed :rofl:

3 Likes

There, it’s fixed… next. :rofl:

1 Like

I’m always impressed by virtually everything plasma. It’s really a great experience.

1 Like