sxhkd icon indicating copy to clipboard operation
sxhkd copied to clipboard

Can't assign command on hotkey consist of single `super` key

Open KGOH opened this issue 6 years ago • 10 comments

Can't assign command on hotkey consist of single super key

super{+ @space,_}
    {,tdrop -ma -h 400 -w -9 -x 4 -y 4 -s dropdown }termite

I expect to execute tdrop -ma -h 400 -w -9 -x 4 -y 4 -s dropdown termite after single press of super key, but nothing happens

KGOH avatar Sep 03 '18 20:09 KGOH

try using the keysym of your modifier as reported by xev (Super_L on my end) instead of super, thats working for me.

matrss avatar Dec 05 '18 16:12 matrss

Related to this issue, I managed to use @Super_L just like you suggested (without any modifier).

The problem is that other commands which use super as modifier will get triggered as soon as I let go of Super_L. This doesn't happen if i have commands for the following combinations for example: super + @space super + ctrl + space

Meaning the following key sequence super + space + ctrl + (up)space triggers the second command only (as I would expect, and was expecting in the case of the single @Super_L).

PedDavid avatar Apr 17 '19 23:04 PedDavid

I don't know if it's relevant, but i encountered a similar situation and found a possible solution to the problem of @PedDavid . I wanted to bind a command to a quick double press of the super key.

I made the following command (same for the left key): ~Super_R ; ~Super_R using the built in ~ character passed before a keysim to propagate the keypress to other clients (and it would seem to itself too, recycling it, see below).

This way i can even chain together different commands, meaning that if i have super + Return to open a terminal and the double stroke above mapped to, say do_something() i can (down)Super_R + (up)Super_R [end first chord] + (down)Super_R [do_something()] + Return [open terminal]

and what would happen is that my first command is executed but the second stroke is passed anyway to the next command which opens a terminal.

Haven't really throughly tested it against super fast inputs or complex combinations, but in my setup has been working flawlessly

ghyatzo avatar May 26 '19 17:05 ghyatzo

Maybe I wasn't clear on the specific problem I'm experiencing.

The problem is that I want to use the following command:

@Super_L

But using it means it gets triggered after performing other commands, for example:

super + Return

if I do the following sequence:

(down)super + Return /* Triggers wanted command */ (up)Super_L /* Triggers unwanted command */

PedDavid avatar May 28 '19 20:05 PedDavid

@PedDavid Well, in your case then it is working exactly as expected. The default reading mode is on the press event.

Besides, trying to map a command to the single release of the super key without it interfering with other commands all mapped around the super key is a bit too much to ask. I'd suggest adding a chord, so that the single release doesn't trigger the command right away. Otherwise, change your other commands to work around other modifier keys.

As of now the only way i can think would be to implement a way to ignore the other event. for example (i'm adding a ! just like you would add a @): !super + Return would ignore the subsequent release event avoiding the @Super_L stroke to be registered. The problem is that if you have multiple commands starting with super you then would need to run a match on all possible commands starting with super and checking if the release event is to be registered, adding quite a bit of complexity to the program.

ghyatzo avatar May 28 '19 20:05 ghyatzo

I understand if it doesn't work (although I really wanted it to :stuck_out_tongue:). It simply doesn't seem consistent with the behavior reported in my first comment:

This doesn't happen if i have commands for the following combinations for example: super + @space super + ctrl + space

Meaning the following key sequence super + space + ctrl + (up)space triggers the second command only (as I would expect, and was expecting in the case of the single @Super_L).

PedDavid avatar May 29 '19 09:05 PedDavid

@PedDavid using the ksuperkey program you can bind the super press in the way you wish without affecting other sxhkd bindings. I agree it's annoying sxhkd can't do this itself.

jazoom avatar Aug 31 '19 00:08 jazoom

I use the xcape program to trigger actions on modifier press and release without any other keypresses in between. I too would rather handle this with just sxhkd but I haven't tried to make it work yet (found this issue searching for a way).

focusaurus avatar Jan 02 '20 05:01 focusaurus

Would also like to see something like this in sxhkd.

Jackojc avatar Sep 15 '21 20:09 Jackojc

Try using alt + F1

Deathemonic avatar Nov 29 '21 08:11 Deathemonic