Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public string Theme
public double? SettingWindowTop { get; set; } = null;
public double? SettingWindowLeft { get; set; } = null;
public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal;

public int CustomExplorerIndex { get; set; } = 0;

[JsonIgnore]
Expand Down Expand Up @@ -132,6 +131,14 @@ public CustomExplorerViewModel CustomExplorer
Path = "Files",
DirectoryArgument = "-select \"%d\"",
FileArgument = "-select \"%f\""
},
new()
{
Name = "QTTabBar",
Path = "Explorer",
DirectoryArgument = "\"%d\"",
FileArgument = "\"%f\"",
Editable = false
}
};

Expand Down
45 changes: 32 additions & 13 deletions Flow.Launcher/PublicAPIInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Collections.Specialized;
using Flow.Launcher.Infrastructure.UserSettings;

namespace Flow.Launcher
{
Expand Down Expand Up @@ -228,21 +229,39 @@ public void SavePluginSettings()

public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null)
{
using var explorer = new Process();
var customExplorerList = _settingsVM.Settings.CustomExplorerList;
var explorerInfo = _settingsVM.Settings.CustomExplorer;
explorer.StartInfo = new ProcessStartInfo

var qttabbarIndex = customExplorerList.FindIndex(e => e.Name.Equals("QTTABBAR", StringComparison.OrdinalIgnoreCase));
var isQttabbarSelected = qttabbarIndex == _settingsVM.Settings.CustomExplorerIndex;

if (isQttabbarSelected)
{
FileName = explorerInfo.Path,
UseShellExecute = true,
Arguments = FileNameOrFilePath is null
? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath)
: explorerInfo.FileArgument
.Replace("%d", DirectoryPath)
.Replace("%f",
Path.IsPathRooted(FileNameOrFilePath) ? FileNameOrFilePath : Path.Combine(DirectoryPath, FileNameOrFilePath)
)
};
explorer.Start();
Process.Start(new ProcessStartInfo
{
FileName = DirectoryPath,
UseShellExecute = true,
Verb = "open",
Arguments = FileNameOrFilePath
});
}
else
{
using var explorer = new Process();
explorer.StartInfo = new ProcessStartInfo
{
FileName = explorerInfo.Path,
UseShellExecute = true,
Arguments = FileNameOrFilePath is null
? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath)
: explorerInfo.FileArgument
.Replace("%d", DirectoryPath)
.Replace("%f",
Path.IsPathRooted(FileNameOrFilePath) ? FileNameOrFilePath : Path.Combine(DirectoryPath, FileNameOrFilePath)
)
};
explorer.Start();
}
}

private void OpenUri(Uri uri, bool? inPrivate = null)
Expand Down