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

Add Filter / Source Selection #34

Open
Figuera opened this issue Nov 22, 2021 · 19 comments
Open

Add Filter / Source Selection #34

Figuera opened this issue Nov 22, 2021 · 19 comments

Comments

@Figuera
Copy link

Figuera commented Nov 22, 2021

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
Copy link
Owner

nwg-piotr commented Nov 23, 2021

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
Copy link
Author

Figuera commented Nov 23, 2021

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
Copy link
Author

Figuera commented Nov 23, 2021

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
Copy link
Owner

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
Copy link
Author

Figuera commented Nov 23, 2021

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
Copy link
Owner

nwg-piotr commented Nov 23, 2021

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
Copy link
Author

Figuera commented Nov 23, 2021

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

@nwg-piotr
Copy link
Owner

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

nwg-piotr added a commit that referenced this issue Nov 29, 2021
@nwg-piotr
Copy link
Owner

Could you try and build from the cats_filter branch?

@Figuera
Copy link
Author

Figuera commented Nov 29, 2021

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
Copy link
Owner

I'm well, thank you.

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

@Figuera
Copy link
Author

Figuera commented Nov 29, 2021

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
Copy link
Owner

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

@Figuera
Copy link
Author

Figuera commented Nov 29, 2021 via email

@nwg-piotr
Copy link
Owner

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
Copy link
Author

Figuera commented Nov 29, 2021

Thank you for you support.

@nwg-piotr
Copy link
Owner

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
Copy link
Author

Figuera commented Nov 30, 2021

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
Copy link
Owner

Alright, I'll leave them for you.

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

No branches or pull requests

2 participants