kando icon indicating copy to clipboard operation
kando copied to clipboard

Support for application-title dependent menus

Open Crunchbits opened this issue 1 year ago • 2 comments

I know that there are plans to implement application dependent menus, but I think it would also be nice to add support for application-title dependent menus. That is to say different menus depending on the title of the focused program window. For example, this would be helpful for having different menus depending on the current website you are on(such as google, youtube, gmail, etc.)

If implemented, the title detection could have different options where the text you configure has to either match exactly, show at the start, or show at the end of the focused window's title.

Crunchbits avatar Aug 22 '23 07:08 Crunchbits

That's a good idea and should definitely be possible to implement!

Schneegans avatar Aug 22 '23 15:08 Schneegans

until you can do this i have a solution that I've used. Using BTT you can set a keyboard shortcut to trigger another keyboard shortcut with conditions. Set a condition that if the focused window title contains "string_of_your_choice" it will trigger a certain keyboard input. then set different menus in the menus config file setting shortcuts for each one.

for example when i hit right option in finder BTT triggers Cmd+Ctrl+M and that brings up a finder specific menu. When I hit right option in any other application it triggers Cmd+Ctrl+K which brings up a global menu.

hamishC0 avatar Mar 25 '24 14:03 hamishC0

This will be definitely one of the next issues to tackles. @ClearStaff volunteered to look into this, so I'll add some information here! I think that this can be implemented in two separate pull requests:

1: The backend side of things

Each backend already brings the possibility to query the name of the currently running app and window. So this is already implemented. We "only" need to choose the correct menu based on this. Currently, the menu for a given shortcut is chosen here (it simply takes the first one). The info object in this line contains the name of the window and app of the currently focused window. So some refactoring will be required to have the information where we need it. But it should be possible.

And of course, we need to add a setting to the menu for the app-name filter. The menu type is defined here.

2: The menu-editor side of things

This will be not exactly easy. However, I already posted mockups of how this could look like several months ago: https://storage.ko-fi.com/cdn/useruploads/34eab0ee-cb9f-4353-a71c-ba7003091189_editor1.png

Maybe we could implement this in a similar fashion, but maybe we have better ideas!

Schneegans avatar Jun 07 '24 19:06 Schneegans

Btw, you can also join our Discord server to discuss this in detail!

https://discord.gg/hZwbVSDkhy

Schneegans avatar Jun 07 '24 19:06 Schneegans

Progress info: i already have a working prototype on my local PC, i have to separate changes into smaller ones and then discuss changes with Schneegans. So if going from prototype to release will be as smooth as creating prototype you can expect this feature to land in some nearby future.

https://github.com/kando-menu/kando/assets/5238901/cbc91851-9eed-40c0-ac44-c0d0350b8fd9

ClearStaff avatar Jun 10 '24 09:06 ClearStaff

Just got a try to Kando, can't wait to see this feature in life. It will gonna boost all my workflows 🖤

cogscides avatar Jun 13 '24 15:06 cogscides

I started working on the editor for the conditions:

image

Schneegans avatar Jun 15 '24 05:06 Schneegans