Flow.Launcher icon indicating copy to clipboard operation
Flow.Launcher copied to clipboard

Quick Switch

Open taooceros opened this issue 3 years ago • 141 comments

Nothing more than quickswitch. We may integrate flow's path system to this feature instead of relying explorer.

Setup Quick Switch

  1. Quick switch key: Alt+G by default
  2. Quick switch automatically
  3. Quick switch window

Use Quick Switch

  1. Open explorer -> Open file dialog -> Use hotkey to navigate to that path.

  2. Open file dialog -> Query window (quick switch window) fixed under file dialog -> Click results to navigate to the selected path

Quick Switch API

Implement new api interfaces to let plugin be queried on quick switch window for dotnet plugins only.

public interface IAsyncQuickSwitch
{
    /// <summary>
    /// Asynchronous querying for quick switch window
    /// </summary>
    Task<List<QuickSwitchResult>> QueryQuickSwitchAsync(Query query, CancellationToken token);
}
public interface IQuickSwitch : IAsyncQuickSwitch
{
    /// <summary>
    /// Querying for quick switch window
    /// </summary>
    List<QuickSwitchResult> QueryQuickSwitch(Query query);

    Task<List<QuickSwitchResult>> IAsyncQuickSwitch.QueryQuickSwitchAsync(Query query, CancellationToken token) => Task.Run(() => QueryQuickSwitch(query));
}
/// <summary>
/// Describes a result of a <see cref="Query"/> executed by a plugin in quick switch window
/// </summary>
public class QuickSwitchResult : Result
{
    /// <summary>
    /// This holds the path which can be provided by plugin to be navigated to the
    /// file dialog when records in quick switch window is right clicked on a result.
    /// </summary>
    public required string QuickSwitchPath { get; init; }

    // ...
}

Additionally, Explorer plugin already supports quick switch.

Develop third party explorer & dialog

Check Flow.Launcher.Infrastructure.QuickSwitch.Interface.IQuickSwitchExplorer and Flow.Launcher.Infrastructure.QuickSwitch.Interface.IQuickSwitchDialog for more info.

Todos

  • [x] https://github.com/listary/Listary.FileAppPlugin/blob/master/docs%2FGetting%20Started.md
  • [x] Support opening file path.
  • [x] Quick switch automatically issue for save as file dialog from @onesounds: For the Open dialog, the path changes correctly at the time the dialog is opened, even without switching focus to File Explorer. However, for the Save As dialog, the path does not apply immediately when the dialog is opened. It only works after switching focus to File Explorer and then returning.
  • [x] Third party explorer.
  • [x] Third party dialog.
  • [x] In auto mode, the target program still closes when using "Open." (Previously reported issue) on some devices & apps from @onesounds.
  • [x] Dialogs pop up on many other dialog windows.
  • [ ] When the bottom bar mode is active, if a dialog is closed and Flow is exited without being reopened, the window position is saved based on the bottom bar mode location. On the next launch, Flow opens at the last position used by the bottom bar mode.
  • [ ] In the "Save As" dialog, Flow automatically inputs the entire file name, which causes unintended saving.

taooceros avatar Feb 10 '22 03:02 taooceros

Some threading issues seem appearing. Not sure the detailed reason.

taooceros avatar Feb 10 '22 03:02 taooceros

Okay, my main questions would be

  • What's the intended use-case for this? As in, when does a Flow plugin need to navigate in the actual file explorer, instead of opening a new one with the correct path.
  • Would opening a new file explorer window with the desired path, and closing the old one work? Or does that not handle certain cases? (e.g. the file browser/chooser )

stefnotch avatar Jul 15 '22 18:07 stefnotch

Okay, my main questions would be

* What's the intended use-case for this? As in, when does a Flow plugin need to navigate in the actual file explorer, instead of opening a new one with the correct path.

I think the major use case is to sync the path of an opened explorer to a open file dialog to select a file easily.

Would opening a new file explorer window with the desired path, and closing the old one work? Or does that not handle certain cases? (e.g. the file browser/chooser )

Sry I don't get the idea.

taooceros avatar Jul 15 '22 22:07 taooceros

Okay, I understand what this is used for now. I'd have to dig a lot deeper into what the IUIAutomation can do to be able to improve this.

I think the rule of thumb is to avoid sending keyboard events, and instead always use an API if one exists. Keyboard events can be delayed and whatnot.

stefnotch avatar Jul 16 '22 08:07 stefnotch

Okay, I understand what this is used for now. I'd have to dig a lot deeper into what the IUIAutomation can do to be able to improve this.

I think the rule of thumb is to avoid sending keyboard events, and instead always use an API if one exists. Keyboard events can be delayed and whatnot.

Yeah that's what I would like to see. It is possible to use PInvoke directly without IUIAutomation though, so it will be cool if you are familiar with that as well.

Another thing is the original listary seems implement this feature without changing the textbox and sending an enter signal, so I wonder whether you may have some clues about that.

taooceros avatar Jul 16 '22 16:07 taooceros

I tried searching for what I could, but that's apparently quite tricky to hook into. So I don't really have a better solution at the moment.

stefnotch avatar Jul 16 '22 16:07 stefnotch

I tried searching for what I could, but that's apparently quite tricky to hook into. So I don't really have a better solution at the moment.

okay thanks🤣

taooceros avatar Jul 16 '22 16:07 taooceros

There might be a alternate design:

So the file manager has the "quick access" sidebar. Flow could add its own entry there, and that entry always redirects to the currently open folder. An additional advantage might be that it's easier to discover this, compared to a keyboard shortcut.

Screenshot for context:

image

(Note: I have no idea how hard that would be to efficiently pull that off.)

stefnotch avatar Aug 17 '22 13:08 stefnotch

So you mean to add a entry that redirect to the most recent opened explorer path?🤔Interesting

taooceros avatar Aug 17 '22 18:08 taooceros

Yep, spot-on.

stefnotch avatar Aug 17 '22 19:08 stefnotch

Yep, spot-on.

If that's the case, we may be able to create a plugin for it.

taooceros avatar Aug 17 '22 20:08 taooceros

Do you have any docs for that?

taooceros avatar Aug 17 '22 20:08 taooceros

@taooceros I haven't looked into this all that much (just a few cursory google searches)

Programmatic access

Apparently there's a way of programmatically adding folders to the quick access area.

https://stackoverflow.com/questions/30051634/is-it-possible-programmatically-add-folders-to-the-windows-10-quick-access-panel

Special Links folder

https://blogs.msmvps.com/kenlin/2017/06/14/537/

Steps:

  1. Enable a special, built-in folder by setting a value in the system registry. Anything in this folder will land in the "quick access".
  2. Put a shortcut in that folder. (A .lnk shortcut)
  3. And then always update the shortcut's path to point at the currently open file explorer.

Symbolic links or Hardlink

I bet there's some trickery that could be done with those

Extra harddrive

We could add an in-memory harddrive, mount it and provide a single shortcut in there. This might be a tad tricky though, depending on whether there's an easy API/wrapper or not...

stefnotch avatar Aug 17 '22 20:08 stefnotch

Could this be done? I really love this feature.

mcthesw avatar Oct 15 '22 03:10 mcthesw

Yet another option would be to add a "switch to" context menu entry

Sort of like how 7zip has a dynamic context menu, except that we'd populate it with the titles of other explorer windows. image

stefnotch avatar Dec 04 '22 15:12 stefnotch

Apparently Windows 11 can add files to quick access. That might let us pin a program to quick access

Such a program could then update the list of files in the quick access window.

stefnotch avatar Jan 08 '23 11:01 stefnotch

Really hope we can get the quick switch function :( the Ctrl+G in Listary is so useful

rexhibition avatar Oct 06 '23 03:10 rexhibition