Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customisable keybindings #101

Open
philj56 opened this issue May 9, 2023 · 7 comments
Open

Customisable keybindings #101

philj56 opened this issue May 9, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@philj56
Copy link
Owner

philj56 commented May 9, 2023

I've been meaning to look into customisable keybindings for a while, but I'm not sure what the best way is / if it's actually necessary.

Pros

  • Don't need to change tofi to add a new keybinding.
  • People may want non-standard mappings of existing bindings.

Cons

  • Significant extra complexity - need names for actions, keybinding parser, data structures for holding bindings.
  • Potential option bloat, depending on how it's implemented - there are already a lot of options.
  • I feel like most people aren't going to have conflicting expectations about which bindings do what; so as long as tofi covers all the expected keybindings, the need for customisation is probably very limited. The main motivator in my eyes is for people who have different expectations about what should happen when they switch keyboard layouts — should the bindings follow the physical keys, or the "logical" keys? It might be easy to handle this with a single extra option.

The options I plan to look into, then, are:

  • No customisation, but a --physical-keybindings flag or similar - this is my preferred option, unless a lot of people really want customisation.
  • Sway/Hyprland style bindings, e.g. --binding=Ctrl+c,close
    • Nice, because this is probably how it'd be organised internally (i.e. from binding -> action, not action -> binding)
    • Needs lots of lines for bindings in a config file (currently there are 25 keybindings in tofi)
  • rofi style bindings, e.g. --bind-delete-word=Ctrl+w,Ctrl+Backspace
    • I don't like this due to the number of options it adds (and it makes less sense to me)
    • However it does make the config file a bit simpler (8 lines)
@philj56 philj56 added the enhancement New feature or request label May 9, 2023
@philj56
Copy link
Owner Author

philj56 commented Jul 16, 2023

I've added a --physical-keybindings option in 47a7f68, which defaults to true. Hopefully this is enough for nearly everyone's use case.

@hilaolu
Copy link

hilaolu commented Aug 24, 2023

can't wait for this feature

@hilaolu
Copy link

hilaolu commented Sep 1, 2023

when will next version release?

@mb720
Copy link

mb720 commented Dec 15, 2023

Would this also allow to resize tofi's font while it's displaying?

@s1n7ax
Copy link

s1n7ax commented May 30, 2024

Anyone have any idea how to use --physical-keybindings. I have no clue what following supposed to mean

	# If true, use physical keys for shortcuts, regardless of the current
	# keyboard layout. If false, use the current layout's keys.
	physical-keybindings = true

@MahouShoujoMivutilde
Copy link

MahouShoujoMivutilde commented May 31, 2024

It means to use keycodes instead of keysyms, so if you switch your keyboard layout (e.g. latin to cyrillic) your hotkeys still work.

But if you have e.g. dvorak set on X11 / wayland compositor level it'll still respond to hotkeys according to how your physical keys on a keyboard are. But if you don't want that - you can set the option to false.

Discussion #41 (comment)

@hvhaugwitz
Copy link

I was just about to create a new feature request for remapping C-j to Confirm (as seen in emacs, rofi, dmenu and other tools); but I think it is time to start providing Sway/Hyprland style key bindings (as mentioned above) instead of adding more and more default key bindings (see for example #97 or #135).

To avoid an overfilled default configuration I would suggest to only bind one key per action by default and leave customization to the users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants