-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Integration with other file managers #557
Comments
Passing a path to QuickLook.exe should work -- but only when the user is using MSI or ZIP version of QuickLook (does not work for Windows Store version). The best option is to send a message to a named pipe (code): string PipeName = "QuickLook.App.Pipe." + WindowsIdentity.GetCurrent().User?.Value;
string Toggle = "QuickLook.App.PipeMessages.Toggle";
public static void SendMessage(string pipeMessage, string path = null)
{
if (path == null)
path = "";
try
{
using (var client = new NamedPipeClientStream(".", PipeName, PipeDirection.Out))
{
client.Connect();
using (var writer = new StreamWriter(client))
{
writer.WriteLine($"{pipeMessage}|{path}");
writer.Flush();
}
}
}
catch (Exception e)
{
Debug.WriteLine(e.ToString());
}
} The code above can be used like this: SendMessage(Toggle, "C:\path\to\file.txt"); The preview window will be closed when the same message is sent for the second time. If sending a message is too complicated to your application, you can instead provide something e.g. WM_COPYDATA so I can get the selected file from QuickLook's side, like what I have done for Directory Opus (code). |
Thank you! With the provided code it was 5 minute to integrate. The only place I have trouble with now is how to check if preview window is already open (in case user selects another file, to show preview only if preview window is already opened). I have tried the MainWindowHandle of the "QuickLook" process but it is 0. Is there a proper way to check? |
No, there isn't any direct method to ask QuickLook for that, but it is possible with Windows APIs. I would suggest the following steps:
The |
Great. I did have to additionally use |
I tried using it from the command line and it stops working.
|
@LunarLanding Any exception log? |
I'm developing a file manager and one of users asked about supporting QuickLook. I have tried passing the path to .exe as parameter but that does not work. Is it possible to already pass a file to be previewed in some way?
The text was updated successfully, but these errors were encountered: