Skip to content

Commit

Permalink
Removed auto hide taskbar workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 committed Sep 12, 2024
1 parent e7025f3 commit cfc3a45
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
14 changes: 0 additions & 14 deletions src/Files.App/Data/Items/WindowEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,6 @@ public bool IsMaximizable

if (AppWindow.Presenter is OverlappedPresenter overlapped)
overlapped.IsMaximizable = value;

if (value)
{
// WORKAROUND:
// https://github.com/microsoft/microsoft-ui-xaml/issues/8431
// NOTE:
// Indicates to the Shell that the window should not be treated as full-screen
// not to mess up the taskbar when being full-screen mode.
// This property should only be set if the "Automatically hide the taskbar" in Windows 11,
// or "Automatically hide the taskbar in desktop mode" in Windows 10 is enabled.
// Setting this property when the setting is disabled will result in the taskbar overlapping the application.
if (AppLifecycleHelper.IsAutoHideTaskbarEnabled())
Win32PInvoke.SetPropW(WindowHandle, "NonRudeHWND", new IntPtr(1));
}
}
}

Expand Down
25 changes: 0 additions & 25 deletions src/Files.App/Helpers/Application/AppLifecycleHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Sentry;
using Sentry.Protocol;
using System.IO;
using System.Security;
using System.Text;
using Windows.ApplicationModel;
using Windows.Storage;
Expand Down Expand Up @@ -347,30 +346,6 @@ public static void HandleAppUnhandledException(Exception? ex, bool showToastNoti
Process.GetCurrentProcess().Kill();
}

/// <summary>
/// Checks if the taskbar is set to auto-hide.
/// </summary>
public static bool IsAutoHideTaskbarEnabled()
{
try
{
const string registryKey = @"Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3";
const string valueName = "Settings";

using var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(registryKey);

var value = key?.GetValue(valueName) as byte[];

// The least significant bit of the 9th byte controls the auto-hide setting
return value != null && ((value[8] & 0x01) == 1);
}
catch (SecurityException)
{
// Handle edge case where OpenSubKey results in SecurityException
return false;
}
}

/// <summary>
/// Updates the visibility of the system tray icon
/// </summary>
Expand Down

0 comments on commit cfc3a45

Please sign in to comment.