nwg-piotr / nwg-drawer

Application drawer for wlroots-based Wayland compositors
MIT License
250 stars 27 forks source link

Add Filter / Source Selection #34

Open Figuera opened 2 years ago

Figuera commented 2 years ago

Is it possible to add filters to nwg-drawer?

Example: I would like to create a key bind to open a menu that only displays Games application.

In nwggrid I do this by a different feature. There I can select the source folder for the .desktop files. To be honest this is not always exactly what I am looking for since I have to manually maintain all the desktop files. But it is also a good feature to have, for example using it I can not display some useless shortcut that is automatically create under /usr/share/applications.

nwg-piotr commented 2 years ago

create a key bind to open a menu that only displays Games application

You mean: after startup, the grid should look as if you've already clicked the "Games" category button, right? If so, it would be possible to pass an argument, e.g. nwg-drawer -cat game, but there's an important limitation: this would not work in the resident mode. If you once start nwg-drawer with the -r flag, all arguments are being passed only once. Each consecutive nwg-drawer command execution just sends the USR1 signal to the resident instance, to trigger a show/hide action (see Running). On hide, the window is being reverted to the initial state. It means: you would be unable to have separate key binding for various categories, if you want to use resident mode.

Figuera commented 2 years ago

I think that would suffice yes.

Couldn't you send a signal for it to change categories? To be honest I don't usually use the resident mode so it wouldn't affect me.

Figuera commented 2 years ago

Thinking more about it, in my use case it would be ideal that when you pass -cat game the Game category is the ONLY available category. It would be even better if we could pass more than one category to the command "-cat game,office,etc" so only the categories passed are displayed.

I am trying to use the application as my game launcher and use some additional categories to organize it. So it I would have games categories like RPG, FPS and etc. When I activate the launcher, only games are displayed but I can still manage the categories.

nwg-piotr commented 2 years ago

Couldn't you send a signal for it to change categories?

This makes little sense.

The -cat argument may be added, if you confirm it to be the solution to your issue.

Figuera commented 2 years ago

It doesn't I am sorry.

Did you understand my use case? The cat argument as you first propose would help but allowing to pass multiple categories and ignoring entries not on those categories would be what I am looking for.

nwg-piotr commented 2 years ago

Passing multiple categories is not a problem, but be aware, that most of programs have more than one category assigned in their .desktop file.

Figuera commented 2 years ago

Yes, I am aware. I would still have to manage my own .desktop files.

nwg-piotr commented 2 years ago

Alright, I'll take a closer look at the code soon.

nwg-piotr commented 2 years ago

Could you try and build from the cats_filter branch?

Figuera commented 2 years ago

So, under the risk of abusing your patience:

I still would like to have the Categories selection UI when multiple Categories are selected. My idea is to launch nwg-drawer --cats Games and then use the secondary Categories to organize my games in different tabs.

Other than that the proposed the branch is running smoothly, thank you very much.

(By the way, did you recover well from your operation?)

nwg-piotr commented 2 years ago

I'm well, thank you.

I'm not sure how you're going to use the buttons. They only show predefined categories.

Figuera commented 2 years ago

Oh, I see. I was under the impression that the categories were being parsed from the ones defined in the .desktop files. But, I can see now how that would be a challenge to manage.

Well, the update did solve my first problem (create a Category specific launcher) so thank you.

nwg-piotr commented 2 years ago

Yes, I couldn't take them from .desktop files, as many apps have numerous unexpected definitions. We would have a very long list.

Figuera commented 2 years ago

...

Could the categories actually used by the drawer be user defined?

Like a in JSON configuration file?

On Mon, Nov 29, 2021, 08:32 Piotr Miller @.***> wrote:

Yes, I couldn't take them from .desktop files, as many apps have numerous unexpected definitions. We would have a very long list.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nwg-piotr/nwg-drawer/issues/34#issuecomment-981637907, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFLUKC5LY6JT2MFE7T6GMTUON6FPANCNFSM5IRLIPRQ .

nwg-piotr commented 2 years ago

Sorry, not in this program. I did my best to simplify categories, by assigning all the mess to 8 main categories + "Other", to simplify usage in normal use case. You need a dedicated code to meet your expectation.

Figuera commented 2 years ago

Thank you for you support.

nwg-piotr commented 2 years ago

Tell me if the changes on another branch are useful to you. If not, I won't merge, as personally I'm not going to use it ever in my life.

Figuera commented 2 years ago

They are useful as they simulate the way I am using nwggrid right now. It would be useful to have it in the master branch.

nwg-piotr commented 2 years ago

Alright, I'll leave them for you.