Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion RetroBar/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ private static bool SingleInstanceCheck()
return false;
}
}
}
}
6 changes: 6 additions & 0 deletions RetroBar/PropertiesWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@
<CheckBox IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=AutoHide, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource enable_auto_hide}" />
</CheckBox>
<CheckBox IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=EnableTaskbarToggleHotkey, UpdateSourceTrigger=PropertyChanged}">
<Label Content="Enable Alt+T to toggle taskbar" />
</CheckBox>
<CheckBox IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=DisableAnimations, UpdateSourceTrigger=PropertyChanged}">
<Label Content="Disable AutoHide animation" />
</CheckBox>
<CheckBox x:Name="cbShowBadges"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowTaskBadges, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource show_badges}" />
Expand Down
26 changes: 21 additions & 5 deletions RetroBar/Taskbar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,20 +274,36 @@ protected override void OnAutoHideAnimationBegin(bool isHiding)
// Prevent focus indicators and tooltips while hidden
ResetControlFocus();

if (!isHiding && Opacity < 1)
if (!isHiding)
{
Opacity = 1;
OnPropertyChanged(nameof(Opacity));
if (Settings.Instance.DisableAnimations)
{
// Instantly snap to full opacity
Opacity = 1;
}
else if (Opacity < 1)
{
Opacity = 1;
OnPropertyChanged(nameof(Opacity));
}
}
}

protected override void OnAutoHideAnimationComplete(bool isHiding)
{
base.OnAutoHideAnimationComplete(isHiding);

if (isHiding && Settings.Instance.AutoHideTransparent && AllowsTransparency && AllowAutoHide)
if (isHiding)
{
Opacity = 0.01;
if (Settings.Instance.DisableAnimations)
{
Opacity = 0; // Instantly hide
}
else if (Settings.Instance.AutoHideTransparent && AllowsTransparency && AllowAutoHide)
{
Opacity = 0.01; // Subtle transparency
}

OnPropertyChanged(nameof(Opacity));
}
}
Expand Down
49 changes: 49 additions & 0 deletions RetroBar/Utilities/HotkeyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using ManagedShell.Common.Logging;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using static ManagedShell.Interop.NativeMethods;

Expand All @@ -14,6 +15,7 @@ public class HotkeyManager : IDisposable
{
private readonly HotkeyListenerWindow _listenerWindow;

private const int TOGGLE_TASKBAR_HOTKEY_ID = 9999;
public HotkeyManager()
{
_listenerWindow = new HotkeyListenerWindow(this);
Expand Down Expand Up @@ -57,6 +59,15 @@ private void Settings_PropertyChanged(object sender, System.ComponentModel.Prope
_listenerWindow.UnregisterHotkeys();
}
}
if (Settings.Instance.EnableTaskbarToggleHotkey)
{
_listenerWindow.RegisterToggleAutoHide();
}
else if (!Settings.Instance.EnableTaskbarToggleHotkey)
{
_listenerWindow.UnregisterHotkeys();
ShellLogger.Debug("Alt+T toggle is disabled by settings.");
}
}
#endregion

Expand All @@ -81,6 +92,13 @@ protected override void WndProc(ref Message m)
if (m.Msg == (int)WM.HOTKEY)
{
int hotkeyId = m.WParam.ToInt32();
if (hotkeyId == TOGGLE_TASKBAR_HOTKEY_ID)
{
// Toggle built-in AutoHide setting
Settings.Instance.AutoHide = !Settings.Instance.AutoHide;
ShellLogger.Debug($"HotkeyManager: Alt+T toggled AutoHide to {Settings.Instance.AutoHide}");
return;
}
if (_registeredHotkeys.Contains(hotkeyId))
{
_manager.TaskbarHotkeyPressed?.Invoke(this, new TaskbarHotkeyEventArgs { index = hotkeyId });
Expand Down Expand Up @@ -124,6 +142,37 @@ public void RegisterHotkeys()
}
}

public void RegisterToggleAutoHide()
{
ShellLogger.Debug("HotkeyManager: Registering toggle autohide hotkey");
// Register Alt+T for toggling taskbar
bool altTRegistered = RegisterHotKey(
Handle,
TOGGLE_TASKBAR_HOTKEY_ID,
(uint)(MOD.ALT | MOD.NOREPEAT),
(uint)VK.KEY_T);

if (altTRegistered)
{
_registeredHotkeys.Add(TOGGLE_TASKBAR_HOTKEY_ID);
ShellLogger.Info("HotkeyManager: Registered Alt+T for AutoHide toggle");
}
else if (Settings.Instance.EnableTaskbarToggleHotkey)
{
ShellLogger.Info("HotkeyManager: Autohide toggled using Alt+T");
}
else
{
ShellLogger.Warning("HotkeyManager: FAILED to register Alt+T for AutoHide toggle");
}
}

public void UnregisterToggleAutoHide()
{
UnregisterHotKey(Handle, 9999);
ShellLogger.Info($"HotkeyManager: Unregistered Alt+T for AutoHide toggle");
}

private void LoadExplorerResources()
{
// Initialize with empty table as fallback
Expand Down
14 changes: 14 additions & 0 deletions RetroBar/Utilities/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,20 @@ public bool AutoHide
set => Set(ref _autoHide, value);
}

private bool _enableTaskbarToggleHotkey = false;
public bool EnableTaskbarToggleHotkey
{
get => _enableTaskbarToggleHotkey;
set => Set(ref _enableTaskbarToggleHotkey, value);
}

private bool _disableAnimations = false;
public bool DisableAnimations
{
get => _disableAnimations;
set => Set(ref _disableAnimations, value);
}

private bool _lockTaskbar = false;
public bool LockTaskbar
{
Expand Down