Skip to content

Add context menu #9

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

Open
jjw24 opened this issue Jan 21, 2025 · 14 comments
Open

Add context menu #9

jjw24 opened this issue Jan 21, 2025 · 14 comments
Assignees
Labels
enhancement New feature or request

Comments

@jjw24
Copy link

jjw24 commented Jan 21, 2025

Maybe consider adding context menu so users can go to context menu on a todo for things like editing or completing that particular item. Otherwise need to re-type or edit the query.

See Explorer plugin as a code example https://github.com/Flow-Launcher/Flow.Launcher/blob/dev/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs.

@Or1g3n
Copy link
Owner

Or1g3n commented Jan 22, 2025

That's a great idea! I'll incorporate this for sure. Thanks for the example as well!

@Or1g3n Or1g3n self-assigned this Jan 22, 2025
@Or1g3n Or1g3n added the enhancement New feature or request label Jan 22, 2025
@Or1g3n
Copy link
Owner

Or1g3n commented Feb 1, 2025

@jjw24
I have this mostly working, however, what I would like to do is after the action within the context menu is completed, exit the context menu and go back to previous result set (same action that occurs when user enters into the context menu but then goes back by manually pressing the escape key).

I looked through the various API options and tried change query, requery, showmainwindow, but nothing worked. Appreciate any help/guidance! Thanks.

@jjw24
Copy link
Author

jjw24 commented Feb 2, 2025

The return back to query result from context menu is from this code, which is only triggered when the query search window is hidden after triggering the action. I am guessing in your code your context menu is set to not hide after selection?

I don't see why we cannot add the same behaviour even when the query search window is not hidden after context menu result action and also create an API call for it. Could you please create an issue for this.

In the meantime if it's possible, save your query string before the context menu so you can use the change query API to return/change back to the previous result via the original query. This API call should work, when I had a look it is re-query call that doesn't run if it's in the context menu.

Let me know how this goes.

@Or1g3n
Copy link
Owner

Or1g3n commented Feb 3, 2025

Thanks @jjw24!

Yes, since this is more of an item management plugin vs. typical fuzzy finder, I mostly avoid exiting the flowlauncher UI after command execution (some exceptions) so the user doesn't have to re-open each time.

I noticed the code you sent is within the ViewModel class, forgive my ignorance, but when I leveraged the code you provided from the Explorer plugin, I removed the import of ViewModel because I wasn't sure of its significance and the code seemed to work without it. I searched the API reference docs but couldn't find a definition. Is there a doc or docstring in code that explains what this class does?

In the meantime, I will do my best to incorporate it back in based on your link and also do as you say with caching the original query so I can then revert back. I can definitely put in an issue for adding the return back to query behavior when window is not hidden.

Thanks for your help!

@Or1g3n
Copy link
Owner

Or1g3n commented Feb 3, 2025

@jjw24 Flow-Launcher/Flow.Launcher#3222 created!

@jjw24
Copy link
Author

jjw24 commented Feb 5, 2025

I noticed the code you sent is within the ViewModel class, forgive my ignorance, but when I leveraged the code you provided from the Explorer plugin, I removed the import of ViewModel because I wasn't sure of its significance and the code seemed to work without it. I searched the API reference docs but couldn't find a definition. Is there a doc or docstring in code that explains what this class does?

Plugins won't be able to access flow's ViewModel directly, they will only be able to do actions (some are originating in the ViewModel) via the API. Are you referring to Explorer's own ViewModel?

Let know how you go with the ChangeQuery API.

@Or1g3n
Copy link
Owner

Or1g3n commented Feb 6, 2025

@jjw24 Thanks for claryifying that, I may have conflated the two because when I pulled some code from the original example you provided based on Explorer, I noticed it pulled in ViewModel but I wasn't exactly sure what this was doing and after removing it, it didn't seem to cause any issues (these lines). Then when you sent the code that triggers exiting the context menu, I noticed that happened to be in a class called ViewModel so I was thinking maybe that code I originally removed was actually required.

At any rate, I tried to use the ChangeQuery api action (for testing purposes just hardcoded the query) which does run, however, it runs against the contextmenu result rather than exiting the contextmenu and requerying as expected.

I pushed the dev branch for this feature if you want to see what I have thus far:
https://github.com/Or1g3n/Flow.Launcher.Plugin.Todos/blob/contextmenu/ContextMenu.cs

FYI, I am an absolute noob when it comes to C#. In my day job, most of my time is spent in SQL and Python. I really like this plugin and since it seemed simple enough, saw it as a great opportunity to learn something new. Just some context in case you see anything egregious in there lol.

@Or1g3n
Copy link
Owner

Or1g3n commented Feb 8, 2025

@jjw24 FYI, Jack Ye commented on the recent issue I submitted (link to issue) for adding the go back API action and it appears this feature may have already been merged recently back in November 24 (link to pr). I am pretty sure this is exactly what I was hoping to accomplish but wanted to confirm with you first before cancelling the issue you requested me to put in.

If this does meet the exact need, do you have an anticipated timeline for when the new version release of Flow.Launcher.Plugin would be available in the NuGet repo?

@jjw24
Copy link
Author

jjw24 commented Feb 8, 2025

@jjw24 Thanks for claryifying that, I may have conflated the two because when I pulled some code from the original example you provided based on Explorer, I noticed it pulled in ViewModel but I wasn't exactly sure what this was doing and after removing it, it didn't seem to cause any issues (these lines). Then when you sent the code that triggers exiting the context menu, I noticed that happened to be in a class called ViewModel so I was thinking maybe that code I originally removed was actually required.

At any rate, I tried to use the ChangeQuery api action (for testing purposes just hardcoded the query) which does run, however, it runs against the contextmenu result rather than exiting the contextmenu and requerying as expected.

I pushed the dev branch for this feature if you want to see what I have thus far: https://github.com/Or1g3n/Flow.Launcher.Plugin.Todos/blob/contextmenu/ContextMenu.cs

FYI, I am an absolute noob when it comes to C#. In my day job, most of my time is spent in SQL and Python. I really like this plugin and since it seemed simple enough, saw it as a great opportunity to learn something new. Just some context in case you see anything egregious in there lol.

I will take a look when I get free time, this does sound like the right behaviour.

@jjw24
Copy link
Author

jjw24 commented Feb 8, 2025

@jjw24 FYI, Jack Ye commented on the recent issue I submitted (link to issue) for adding the go back API action and it appears this feature may have already been merged recently back in November 24 (link to pr). I am pretty sure this is exactly what I was hoping to accomplish but wanted to confirm with you first before cancelling the issue you requested me to put in.

If this does meet the exact need, do you have an anticipated timeline for when the new version release of Flow.Launcher.Plugin would be available in the NuGet repo?

Apologies I forgot about that feature, that does address the issue.

In terms of timeline, I had come across some issues when I tested the dev branch, so at the current stage I am not comfortable releasing it. I will take another look and test, and will get back to you on a timeline.

@Or1g3n
Copy link
Owner

Or1g3n commented Feb 9, 2025

@jjw24 FYI, Jack Ye commented on the recent issue I submitted (link to issue) for adding the go back API action and it appears this feature may have already been merged recently back in November 24 (link to pr). I am pretty sure this is exactly what I was hoping to accomplish but wanted to confirm with you first before cancelling the issue you requested me to put in.
If this does meet the exact need, do you have an anticipated timeline for when the new version release of Flow.Launcher.Plugin would be available in the NuGet repo?

Apologies I forgot about that feature, that does address the issue.

In terms of timeline, I had come across some issues when I tested the dev branch, so at the current stage I am not comfortable releasing it. I will take another look and test, and will get back to you on a timeline.

Okay, fantastic, I will go ahead and cancel the issue I put in the other day. Appreciate your help on this and no rush. I will mark this issue as on-hold for the time being awaiting the next flow api release.

@Or1g3n
Copy link
Owner

Or1g3n commented Apr 4, 2025

@jjw24 Howdy, hope all is well! Just wanted to touch base to see if you anticipate the new api being released soon in Nuget.

@jjw24
Copy link
Author

jjw24 commented Apr 4, 2025

Hi @Or1g3n, all is well, hope you too.

v1.20.0 has alot of new exciting things the guys have put together, will aim to complete testing and release it by end of this month.

@Or1g3n
Copy link
Owner

Or1g3n commented Apr 4, 2025

Hi @Or1g3n, all is well, hope you too.

v1.20.0 has alot of new exciting things the guys have put together, will aim to complete testing and release it by end of this month.

That's great to hear on both accounts! Sounds like an exciting release, appreciate the update!

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

2 participants