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

Saved filters for maximum filtering efficiency #179

Closed
Oroumov opened this issue Jun 25, 2021 · 24 comments
Closed

Saved filters for maximum filtering efficiency #179

Oroumov opened this issue Jun 25, 2021 · 24 comments
Assignees

Comments

@Oroumov
Copy link

Oroumov commented Jun 25, 2021

Hi guys !

First let me say that I've read the "Search bar filtering improvements" topic and can't wait for it to happen. It will be fantastic when looking deep into the list.

The feature I'd like to request is something similar to what todotxt.net does today, which I would call Saved filters.

I often happen to look at my Todolist from the same angles (every couple days, "show me all A priorities for +ProjectB", or every evening, "show me all @home" items), so I need to switch between a few "set of filters".

I'd like to be able to do this "(Priority A) AND (+ProjectB)" search once, why not by text but also mostly with the current filter view clicking which is wonderful, and then I'd like to save this under "Filter1" (with or without a dedicated name, doesn't matter)
Next time I'm switching, then in the same filter view, instead of clicking on Prio A then on ProjectB, and so on, I can click on Filter 1 and boom, it's all filtered (and maybe I can even use a shortcut, like Ctrl-x to view my Saved Filter X ?). Too many dreams here :)

Does that make sense ?

Cheers,
O.

@ransome1
Copy link
Owner

@Oroumov there has been a PoC for something like this from @freder, which you can see here on an animated screenshot: #106

But I there is so much on sleeks backlog, that I havn't found anytime to evaluate yet if this can be a potential feature for sleek.

@zerodat
Copy link
Collaborator

zerodat commented Jun 25, 2021

@Oroumov thank you for the comment. This is one of the reasons that I wanted to create the filter query language: so that we could store a set of named search queries that define different "reports" or "views". I like to look at my todos from various perspectives like you do: what important tasks are coming due? what are the items I need to do at home? I've enjoyed using programs like orgzly that support this feature.

@Oroumov
Copy link
Author

Oroumov commented Jun 29, 2021

Hi both
@ransome1 thanks for pointing me out to #106, that's exactly the kind of thing I had in mind.
and thanks @zerodat for the filter query language, I've been trying it out in 1.0.8 and it works great so far... if there's a way to somehow save these, that will be fantastic ! :)

@9z0
Copy link

9z0 commented Jul 9, 2021

You should be able to put the saved filters buttons in one of multiple places, for example above Priority buttons, or even in the left strip (below the "Open" icon) for quick access.

This should add great flexibility to sleek in helping group multiple types of todos in one file (instead of having to split them over multiple files for clarity). I am even thinking of having a custom "theme" or list background color based on which filter button is active, etc, but that is a bit early :)

I've enjoyed using programs like orgzly that support this feature.

Yeah, definitely!

@ransome1 ransome1 moved this to Todo in sleek 2.x Sep 3, 2023
Repository owner deleted a comment from github-actions bot Sep 3, 2023
Repository owner deleted a comment from github-actions bot Dec 3, 2023
@ransome1 ransome1 moved this from Backlog to In Progress in sleek 2.x Jan 13, 2024
@ransome1
Copy link
Owner

ransome1 commented Jan 13, 2024

@Oroumov @9z0 @zerodat @carvid @JensErat @visvital @strannik46 @louwers @vise890 @shbach @tomdaly @mhofherr @freder

Although I really don't want to focus on features at the moment and instead contribute my little spare time fully on bug fixing and refactoring, I thought this feature request might be very valuable and maybe even a low hanging fruit. A first proof of concept can be found here: https://github.com/ransome1/sleek/releases/tag/v2.0.7-rc.1

Based off your requirements I implemented an autocomplete function to the search field.

If you type something and the string does not match any existing search filters, the autocomplete container will give you an option to create a search filter. It would look like this:
Screenshot 2024-01-13 at 2 45 28 PM

If you click on the row or if you select the row using your keyboard and press the Enter key, it will create a search filter. This filter is persisted in your user data and will survive a restart.

Now, if the search field is empty and you don't have previously saved filters, nothing will happen.

If at least one filter is available, you will be presented a list of your persisted filters once you put focus on the search field.
Screenshot 2024-01-13 at 2 53 53 PM

You can either click on each row or select it using your keyboard and press the Enter key. This will replace the search field's content with the selected filter value.

Persisted filters have a Minus icon prepending them. If you click on these, you will delete the filter from your user data.

If you already have persisted filters and your input does not match those, you will again see the option to create a new search filter. This new filter will then be added at the 1st position in your persisted search filter array. However I am not sure if this ideal.

Keyboard shortcuts might come in handy, but I have not yet implemented anything here. Maybe we could solve it similar to the file selection. Here you use Cmd or Ctrl plus 1 to 9 to select them in the order they appear in the file tabs. Another possibility is what you @Oroumov proposed. Simply opening the autocomplete container and pre-selecting the first filter. Then you could use the arrow keys to select the desired one. I am very happy to discuss this.

Please feel free to download the latest developer pre-release and start playing around with it. It is simple, but it should work. It will most likely have some minor (hopefully no major) glitches. I am looking forward to your feedback.

Another thing which is still open is the Add as todo button in this context. If a selected filter has been pasted to the search field, it will most likely not make a lot of sense to show this button, what do you think?

@andrei-a-papou in another thread you mentioned you like to use keyboard navigation. Maybe this feature could then also be for you since it is suppose to increase efficiency.

@andrei-a-papou
Copy link

@ransome1 Thanks for mentioning me, I think it's a much-needed feature. On Android, I use Simpletask (a todo.txt app) and sync some todos with sleek on desktop. I frequently use saved filters in Simpletask (including scripted Lua-based ones) so it's awesome sleek now has this feature as well!

Quick feedback: would it be possible to add a confirmation dialog when deleting an existing filter? That way precious saved searches (potentially complex ones) will not be as easily deletable. In the meantime I'll back up filters.json.

@ransome1
Copy link
Owner

@andrei-a-papou thanks for your feedback. A confirm dialog can easily be implemented here.

@amariusz
Copy link
Collaborator

amariusz commented Jan 14, 2024

I'm also glad this feature is becoming available. However, in current form I find that it tends to get in the way by obscuring the item(s) being filtered. It requires user to press escape or enter each time the query is changed.

There could be a toggle in preferences like "Show filters while typing". When it's OFF I'd suggest the following behavior - make it in the form of dropdown menu with icon like 🔻 indicating there are some autocompletions available to be expanded. Pressing down key would expand the menu showing suggestions. Pressing it second time would highlight first row. Alternatively ➕ icon indicating there's no autocompletion but query can be added as filter.

Thanks!

@ransome1
Copy link
Owner

ransome1 commented Jan 14, 2024

@bughunter2 since I am collecting feedback for the search filter function here, it might be a good idea to merge discussions about #542 with this thread.

I enhanced this proof of concept with a notification function as described in your proposal: https://github.com/ransome1/sleek/releases/tag/v2.0.7-rc.3

It works the way I described earlier. First you create a search filter. By default notifications for this filter are disabled. Only after clicking the alarm bell, the notification for this particular search filter will be enabled.

Now if there is already a matching todo, it will of course trigger one notification right away.

Once a new todo is created (either with sleek, by hand in the text file or in whatever way), that matches the search filter, it will trigger a new notification.

In both cases only once and duplicates will be suppressed.

Obviously there is a case, where a todo is due within the notification threshold range and a search filter match at the same time. This will of course only trigger one notification.

I think this screenshot illustrates, how it works. I'm looking forward for your feedback.
Screenshot 2024-01-14 at 11 03 48 PM

@bughunter2
Copy link

@ransome1 The way the feature is implemented seems good, UI wise. But I'm not sure if it will work for the use case that I had in mind. Hopefully you can shine some light on this? For example: say you wish to only get notifications for certain todo items, but wish to disable notifications for all other todo items, is that possible? I'd imagine the user would have to disable notifications in the app in order to prevent notifications for the usual 'due' date notifications, but that would disable the new search filter notifications as well I guess, no?

Off-topic (and somewhat on-topic): When clicking the minus (-) button to remove a search filter, there's no 'are you sure' confirmation prompt. Not a big deal, per se. But... it reminded me; whenever I'm editing a todo item, sometimes I ponder for a bit or switch to another program. Then come back to Sleek and accidentally click outside the editor window, and everything I entered is lost since the editor window closes. Should I file a separate issue for that?

@ransome1
Copy link
Owner

@bughunter2 you're right, I have misinterpreted your initial requirement.

To satisfy it this feature would need to change. For instance by enabling the notifications for each search filter by default, but not in order to actually send out a notification when a filter matches. A match would only be the pre-condition for sending out regular due date based notifications.

The exclusion you had in mind, can then be achieved by simply disabling the notifications for matches of that particular search filter.

I think this feature is not self explanatory to be honest. If implemented it should be disabled by default. Only enabling it in settings would show the alert icon in the search filter.

But I'm very open for discussions in this round. Maybe we can design it a bit more intuitive.

About your other suggestion; @andrei-a-papou did already proposed this earlier. A prompt dialog will be added in a future release.

@bughunter2
Copy link

@ransome1 That's all right, I'm glad we're having an open discussion about it.

My initial response yesterday was 'wonderful', but I agree with you it's not the most self-explanatory.
What 'extra functionality' do the search filter notifications currently give users? I'm not sure. Perhaps using them as pre-conditions for regular due date notifications is a better idea.

Maybe there are various ideas that can be explored:

Using search filters for notifications: powerful feature, flexible, maybe not the most intuitive.

Or, individual todo item notifications by adding a +notify or other token to the todo item itself: this is intuitive for users, simple to implement, but not the most powerful or flexible.

Also, the search filters (afaik) don't include any way of negating, right? You can't express this in a search filter: "I want to turn off notifications for all items that do NOT have +notify in them".

If such functionality were to be included in search filters, it would allow for very powerful expressions. In that case, Sleek could have a checkbox 'advanced notifications', which would then 'reveal' some default search expressions that mimick the default notification behavior. But that might be a lot of work, and sooner or later Sleek would include a kernel and drivers and you have a new OS. ;-) Partly serious, partly joking.

Just sharing some thoughts. But I guess the issue remains:

Let's say you want to disable all notifications except those with priority (A), how could we capture that in search expressions? I'm not sure how we would do that with the way search filter notifications are implemented currently. Even if search filter notifications are modified so they are merely pre-conditions for regular due date notifications, it's unclear to me how one could disable notifications for all items except those with priority (A). The priority here is just an example and could be anything else, such as a particular context or project.

If search filters could use negations, it would be possible to define a search filter that says "priority must NOT be (A)". Then, this pre-condition would fail for all other todo items and hence they would be excluded from notifications.

Which of these paths (if any at all) should be taken, I don't know.

But using search filters to define pre-conditions for notifications, as you explained, seems very useful.

Thank you for taking the time to have this discussion.
In the end it's all about making Sleek even better.

@ransome1
Copy link
Owner

ransome1 commented Jan 15, 2024

Also, the search filters (afaik) don't include any way of negating, right? You can't express this in a search filter: "I want to turn off notifications for all items that do NOT have +notify in them".

The advanced search offers this kind of filtering: https://github.com/ransome1/sleek/wiki/Filter-Expressions-for-Advanced-Search#logical-operators

Let's say you want to disable all notifications except those with priority (A)

There are several ways to achieve this, for example:

  • pri!=A
  • !(A)
  • NOT(A)

it's unclear to me how one could disable notifications for all items except those with priority (A)

I changed the logic of the notification part of the search filters a little bit. It now works more or less like you initially described it in your feature request.

Let's assume we create a todo Todo due:tomorrow. This will trigger a notification right away since tomorrow falls into the default notification threshold range for due dates.
Screenshot 2024-01-15 at 9 56 08 PM

Next, let's create a filter, which would match that todo due: > today
Screenshot 2024-01-15 at 9 59 36 PM

If you toggle the alert bell icon, sleek should suppress todos, which are

  1. suppose to trigger a due notification
  2. match the search filter
Screenshot 2024-01-15 at 10 01 27 PM

Let's create a new todo Todo due:in 2 days:
Screenshot 2024-01-15 at 10 02 05 PM

Usually this would have triggered a notification, but it did not. Feel free to play around with the new logic and let me know what you think: https://github.com/ransome1/sleek/releases/tag/v2.0.7-rc.4

FYI @Oroumov @9z0 @zerodat @carvid @JensErat @visvital @strannik46 @louwers @vise890 @shbach @tomdaly @mhofherr @freder @andrei-a-papou @amariusz

@ransome1
Copy link
Owner

@ransome1 Thanks for mentioning me, I think it's a much-needed feature. On Android, I use Simpletask (a todo.txt app) and sync some todos with sleek on desktop. I frequently use saved filters in Simpletask (including scripted Lua-based ones) so it's awesome sleek now has this feature as well!

Quick feedback: would it be possible to add a confirmation dialog when deleting an existing filter? That way precious saved searches (potentially complex ones) will not be as easily deletable. In the meantime I'll back up filters.json.

A confirm dialog / prompt has been added to the function: https://github.com/ransome1/sleek/releases/tag/v2.0.7-rc.4

@ransome1
Copy link
Owner

There could be a toggle in preferences like "Show filters while typing". When it's OFF I'd suggest the following behavior - make it in the form of dropdown menu with icon like 🔻 indicating there are some autocompletions available to be expanded. Pressing down key would expand the menu showing suggestions. Pressing it second time would highlight first row. Alternatively ➕ icon indicating there's no autocompletion but query can be added as filter.

Except for a dedicated setting, it is more or less like this now and can be tested in https://github.com/ransome1/sleek/releases/tag/v2.0.7-rc.4

You will now find an arrow down icon on the left side of the search text field. If you have no filters created the icon is disabled and cannot be interacted with. If you have a filter already created, the icon will be enabled and it should be clear you can now press on it.

But let's go back to the state where there is no search filter available yet and the visual indicator is disabled. If you now start typing something, it will be enabled. You can now either press Arrow Down key on your keyboard or click the respective icon. Both will show the search filter container and present the option to create a filter based off your input.

If you now have a filter created, the logic doesn't change. Under no circumstances should the box open by just typing character. This must be explicitly triggered by the icon click, Arrow Down key or a keyboard shortcut, which is Cmd or Ctrl and Shift and f. This will add focus to the search field (if you did not have it there already) and open the search filter container. The 1st entry is highlighted already, but the search text field won't have lost focus. @Oroumov this is not exactly the keyboard shortcut you were describing, but it might be a bit more easy like this to discover and access this function.

Good enough to play around with I'd say.

@bughunter2
Copy link

@ransome1

The advanced search offers this kind of filtering: https://github.com/ransome1/sleek/wiki/Filter-Expressions-for-Advanced-Search#logical-operators

Oh I wasn't aware. Thank you for enlightening me.

I changed the logic of the notification part of the search filters a little bit. It know works more or less like you initially described it in your feature request, I believe.

I've played around with it, and I quite like it.

Keep up the good work! /doffs hat as a gesture of respect

@amariusz
Copy link
Collaborator

You will now find an arrow down icon on the left side of the search text field. If you have no filters created the icon is disabled and cannot be interacted with. If you have a filter already created, the icon will be enabled and it should be clear you can now press on it.

Works like a charm! Thanks!

Ctrl+Shift+f seems to have no action, but I don't mind. Down arrow is very convenient.

@ransome1
Copy link
Owner

Ctrl+Shift+f seems to have no action, but I don't mind. Down arrow is very convenient.

Thanks for pointing it out, fixed it.

@andrei-a-papou
Copy link

@ransome1 Would it be possible to also use Up arrow to hide the dropdown?

@amariusz
Copy link
Collaborator

That would be confusing IMO. Up/down keys should cycle the list while it's expanded.
What's wrong with Escape key?

@ransome1
Copy link
Owner

This has been released with 2.0.7: https://github.com/ransome1/sleek/releases/tag/v2.0.7

Since @Oroumov is not responding anymore, I will close this issue and clean up. If anything does not work as expected, please re-open and continue the discussion here.

@github-project-automation github-project-automation bot moved this from In Progress to Done in sleek 2.x Jan 21, 2024
@ransome1 ransome1 unpinned this issue Jan 22, 2024
@andrei-a-papou
Copy link

andrei-a-papou commented Jan 25, 2024

That would be confusing IMO. Up/down keys should cycle the list while it's expanded. What's wrong with Escape key?

It seems intuitive to me :) Initially, the triangle icon point down, so you hit Down arrow to reveal the list. The triangle icon is now pointing up, so you should be able to hit Up arrow to hide the list.

So it seems it would (A) align well with the logic of the triangle icon and (B) allow users to easily hide the list with minimum effort, as Up arrow and Down arrow are super-close. Escape is OK too, but you have to use the other hand for it, it's just not as fast in terms of a keyboard-driven workflow I'm trying to adopt.

Also, IMO the Up arrow shortcut would not interfere with cycling through the dropdown list -- it would simply hide it once you reach the top.

It's no big deal but I thought I'd share my feedback.

@amariusz
Copy link
Collaborator

Also, IMO the Up arrow shortcut would not interfere with cycling through the dropdown list -- it would simply hide it once you reach the top.

Hiding the list while moving up is not really cycling IMO :)

Escape is OK too, but you have to use the other hand for it, it's just not as fast in terms of a keyboard-driven workflow I'm trying to adopt.

Unless you're a left-handed person using the mouse with your left hand, I still don't see how esc is slower :)

Let's agree to disagree! ;)

@andrei-a-papou
Copy link

@amariusz It's no big deal for me, this Up arrow thing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

7 participants