Skip to content

Commit 3058d42

Browse files
authored
Open recycle bin & this pc in Files when set as default explorer (#7408)
1 parent 0b23566 commit 3058d42

File tree

8 files changed

+10
-9
lines changed

8 files changed

+10
-9
lines changed
Binary file not shown.
Binary file not shown.

src/Files.Launcher/MessageHandlers/Win32MessageHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ public void Initialize(PipeStream connection)
2626

2727
private void DetectIsSetAsDefaultFileManager()
2828
{
29-
using var subkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Classes\Directory\shell");
30-
ApplicationData.Current.LocalSettings.Values["IsSetAsDefaultFileManager"] = subkey?.GetValue(string.Empty) as string == "openinfiles";
29+
using var subkey = Registry.ClassesRoot.OpenSubKey(@"Folder\shell\open\command");
30+
var command = (string)subkey?.GetValue(string.Empty);
31+
ApplicationData.Current.LocalSettings.Values["IsSetAsDefaultFileManager"] = !string.IsNullOrEmpty(command) && command.Contains("files.exe");
3132
}
3233

3334
private void DetectIsSetAsOpenFileDialog()

src/Files/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ public static void SaveSessionTabs() // Enumerates through all tabs and gets the
544544
}
545545
else
546546
{
547-
var defaultArg = new TabItemArguments() { InitialPageType = typeof(PaneHolderPage), NavigationArg = "NewTab".GetLocalized() };
547+
var defaultArg = new TabItemArguments() { InitialPageType = typeof(PaneHolderPage), NavigationArg = "Home".GetLocalized() };
548548
return defaultArg.Serialize();
549549
}
550550
}).ToList();

src/Files/Helpers/CommonPaths.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ public static class CommonPaths
2727

2828
public static Dictionary<string, string> ShellPlaces = new Dictionary<string, string>() {
2929
{ "::{645FF040-5081-101B-9F08-00AA002F954E}", RecycleBinPath },
30-
{ "::{5E5F29CE-E0A8-49D3-AF32-7A7BDC173478}", "NewTab".GetLocalized() /*MyComputerPath*/ },
31-
{ "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "NewTab".GetLocalized() /*MyComputerPath*/ },
30+
{ "::{5E5F29CE-E0A8-49D3-AF32-7A7BDC173478}", "Home".GetLocalized() /*MyComputerPath*/ },
31+
{ "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "Home".GetLocalized() /*MyComputerPath*/ },
3232
{ "::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", NetworkFolderPath },
3333
{ "::{208D2C60-3AEA-1069-A2D7-08002B30309D}", NetworkFolderPath },
3434
{ RecycleBinPath.ToUpperInvariant(), RecycleBinPath },
35-
{ MyComputerPath.ToUpperInvariant(), "NewTab".GetLocalized() /*MyComputerPath*/ },
35+
{ MyComputerPath.ToUpperInvariant(), "Home".GetLocalized() /*MyComputerPath*/ },
3636
{ NetworkFolderPath.ToUpperInvariant(), NetworkFolderPath },
3737
};
3838
}

src/Files/Helpers/MultitaskingTabsHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static async Task MoveTabToNewWindow(TabItem tab, IMultitaskingControl mu
3939
}
4040
else
4141
{
42-
await NavigationHelpers.OpenPathInNewWindowAsync("NewTab".GetLocalized());
42+
await NavigationHelpers.OpenPathInNewWindowAsync("Home".GetLocalized());
4343
}
4444
}
4545

src/Files/ViewModels/MainPageViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public static async Task UpdateTabInfo(TabItem tabItem, object navigationArg)
258258
string tabLocationHeader;
259259
var iconSource = new Microsoft.UI.Xaml.Controls.ImageIconSource();
260260

261-
if (currentPath == null || currentPath == "Home".GetLocalized())
261+
if (string.IsNullOrEmpty(currentPath) || currentPath == "Home".GetLocalized())
262262
{
263263
tabLocationHeader = "Home".GetLocalized();
264264
iconSource.ImageSource = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:///Assets/FluentIcons/Home.png"));

src/Files/Views/ColumnShellPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public ColumnShellPage()
155155
FlowDirection = FlowDirection.RightToLeft;
156156
}
157157

158-
//NavigationToolbar.PathControlDisplayText = "NewTab".GetLocalized();
158+
//NavigationToolbar.PathControlDisplayText = "Home".GetLocalized();
159159
//NavigationToolbar.CanGoBack = false;
160160
//NavigationToolbar.CanGoForward = false;
161161
//NavigationToolbar.SearchBox.QueryChanged += ColumnShellPage_QueryChanged;

0 commit comments

Comments
 (0)