Skip to content

feat: add bindm (modifier-only exclusive keybind)#911

Closed
porl wants to merge 1 commit into
mangowm:mainfrom
porl:main
Closed

feat: add bindm (modifier-only exclusive keybind)#911
porl wants to merge 1 commit into
mangowm:mainfrom
porl:main

Conversation

@porl
Copy link
Copy Markdown

@porl porl commented May 10, 2026

Added a bindm config option. This is a modifier-only bind that fires on release but only if no other bind or mousebind used the modifier during that press.

This makes it possible to use a modifier key by itself for things like Super as a launcher trigger but without it firing after other combos:

bind=SUPER,w,spawn,firefox
bindm=SUPER,,spawn,fuzzel        # won't fire after SUPER+w
bindm=SUPER+SHIFT,,spawn,fuzzel # works with mod combos
bindml=SUPER,,spawn,fuzzel       # works on lock screen*

*note: I've only been able to test this in a nested environment at the moment, so whilst I did check the bindml line fires, I didn't check it with a real lock screen. Since it reuses the normal lock-screen logic I assume it should be okay.

Implementation: a mod_used_for_bind flag is set whenever a regular bind or mousebind fires while modifiers are held, and cleared on each modifier key press. bindm binds only fire on modifier release if the flag is unset.

@porl porl changed the title added bindm config option for exclusive mod-only bind feat: add bindm (modifier-only exclusive keybind) May 10, 2026
Comment thread src/config/parse_config.h
config->key_bindings_count++;
}

} else if (regex_match("^bindm[lp]*$", key)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else if (regex_match("^bind[s|l|r|p]*$", key)) {

We already have that on the config a little above, i belive it's a good idea to refractor both of this, somewhere to avoid add new modifier, like a y and then add both bindmy and bindy become hard to do and so maintain

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm definitely happy for someone to take the idea and implement it much cleaner. I just wanted to see if it could work and hopefully get implemented in some way.

@demperor-music
Copy link
Copy Markdown

While i agree with the usecase, i don't think this is the best way to approach this as it only really solves one specific issue while implementing a whole other flag. I think a better approach would be a more generic "e" flag (exclusive), which only triggers if the bind is the only one fired while the modifier has been held down. Due to the nature of this, it would always imply r flag. This would allow for more configurability while also allowing to do the same thing (binde=SUPER,SUPER_L for SUPER-only). This way the second argument to the bind wouldn't always be empty when using this flag, which looks more in line with how other binds are configured

Just a thought for now, i might take a look and try providing some code later.

@DreamMaoMao
Copy link
Copy Markdown
Collaborator

bind=none,Super_L,spawn,rofi -show drun

i think already support now.

@porl
Copy link
Copy Markdown
Author

porl commented May 11, 2026

bind=none,Super_L,spawn,rofi -show drun

i think already support now.

That seems to have the "double-spawn" problem I'm trying to fix though? Does it not behave like that for you?

@porl
Copy link
Copy Markdown
Author

porl commented May 11, 2026

While i agree with the usecase, i don't think this is the best way to approach this as it only really solves one specific issue while implementing a whole other flag. I think a better approach would be a more generic "e" flag (exclusive), which only triggers if the bind is the only one fired while the modifier has been held down. Due to the nature of this, it would always imply r flag. This would allow for more configurability while also allowing to do the same thing (binde=SUPER,SUPER_L for SUPER-only). This way the second argument to the bind wouldn't always be empty when using this flag, which looks more in line with how other binds are configured

Just a thought for now, i might take a look and try providing some code later.

More than happy for someone to allow the same "feature" with a cleaner implementation. I assume mine is super naive but just wanted to at least get the idea working.

@porl
Copy link
Copy Markdown
Author

porl commented May 11, 2026

can confirm #918 works for me. I assume their method is cleaner so I can close this one.

@porl porl closed this May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants