diff --git a/RetroBar/Controls/ShowDesktopButton.xaml b/RetroBar/Controls/ShowDesktopButton.xaml
new file mode 100644
index 00000000..30d01f08
--- /dev/null
+++ b/RetroBar/Controls/ShowDesktopButton.xaml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/RetroBar/Controls/ShowDesktopButton.xaml.cs b/RetroBar/Controls/ShowDesktopButton.xaml.cs
new file mode 100644
index 00000000..adde9db9
--- /dev/null
+++ b/RetroBar/Controls/ShowDesktopButton.xaml.cs
@@ -0,0 +1,132 @@
+using ManagedShell.Common.Helpers;
+using ManagedShell.Interop;
+using ManagedShell.WindowsTasks;
+using RetroBar.Utilities;
+using System;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace RetroBar.Controls
+{
+ ///
+ /// Interaction logic for ShowDesktopButton.xaml
+ ///
+ public partial class ShowDesktopButton : UserControl
+ {
+ private const int TOGGLE_DESKTOP = 407;
+ private IntPtr taskbarHandle = Process.GetCurrentProcess().MainWindowHandle;
+ private bool isWindows81OrBetter = EnvironmentHelper.IsWindows81OrBetter;
+ private bool isLoaded;
+
+ public static DependencyProperty TasksServiceProperty = DependencyProperty.Register("TasksService", typeof(TasksService), typeof(ShowDesktopButton));
+
+ public TasksService TasksService
+ {
+ get { return (TasksService)GetValue(TasksServiceProperty); }
+ set { SetValue(TasksServiceProperty, value); }
+ }
+
+ public ShowDesktopButton()
+ {
+ InitializeComponent();
+ }
+
+ private void SetIconSizeForDpi()
+ {
+ if (DpiHelper.DpiScale > 1)
+ {
+ ShowDesktopIcon.Source = (System.Windows.Media.ImageSource)FindResource("ShowDesktopIconImageLarge");
+ }
+ else
+ {
+ ShowDesktopIcon.Source = (System.Windows.Media.ImageSource)FindResource("ShowDesktopIconImageSmall");
+ }
+ }
+
+ private void ContextMenu_Opened(object sender, RoutedEventArgs e)
+ {
+ PeekAtDesktopItem.IsEnabled = true;
+ if (!NativeMethods.DwmIsCompositionEnabled())
+ {
+ PeekAtDesktopItem.IsEnabled = false;
+ }
+ }
+
+ private void ToggleDesktop()
+ {
+ NativeMethods.SendMessage(WindowHelper.FindWindowsTray(IntPtr.Zero),
+ (int)NativeMethods.WM.COMMAND, (IntPtr)TOGGLE_DESKTOP, IntPtr.Zero);
+ }
+
+ private void PeekAtDesktop(uint shouldPeek)
+ {
+ if (Settings.Instance.PeekAtDesktop && NativeMethods.DwmIsCompositionEnabled())
+ {
+ if (isWindows81OrBetter)
+ {
+ NativeMethods.DwmActivateLivePreview(shouldPeek, taskbarHandle,
+ IntPtr.Zero, NativeMethods.AeroPeekType.Desktop, IntPtr.Zero);
+ }
+ else
+ {
+ NativeMethods.DwmActivateLivePreview(shouldPeek, taskbarHandle,
+ IntPtr.Zero, NativeMethods.AeroPeekType.Desktop);
+ }
+ }
+ }
+
+ private void ShowDesktop_OnMouseEnter(object sender, RoutedEventArgs e)
+ {
+ PeekAtDesktop(1);
+ }
+
+ private void ShowDesktop_OnMouseLeave(object sender, RoutedEventArgs e)
+ {
+ PeekAtDesktop(0);
+ }
+
+ private void ShowDesktop_OnClick(object sender, RoutedEventArgs e)
+ {
+ // If the user activates a window other than the desktop, HandleWindowActivated will deselect the button.
+ ToggleDesktop();
+ }
+
+ private void OpenDisplayPropertiesCpl()
+ {
+ ShellHelper.StartProcess("desk.cpl");
+ }
+
+ private void PropertiesItem_OnClick(object sender, RoutedEventArgs e)
+ {
+ OpenDisplayPropertiesCpl();
+ }
+
+ private void HandleWindowActivated(object sender, WindowActivatedEventArgs e)
+ {
+ if (ShowDesktop.IsChecked == true)
+ {
+ ShowDesktop.IsChecked = false;
+ }
+ }
+
+ private void UserControl_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (!isLoaded && TasksService != null)
+ {
+ SetIconSizeForDpi();
+ TasksService.WindowActivated += HandleWindowActivated;
+ isLoaded = true;
+ }
+ }
+
+ private void UserControl_Unloaded(object sender, RoutedEventArgs e)
+ {
+ if (isLoaded && TasksService != null)
+ {
+ TasksService.WindowActivated -= HandleWindowActivated;
+ isLoaded = false;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/RetroBar/Languages/English.xaml b/RetroBar/Languages/English.xaml
index c3ad4a15..9e77005f 100644
--- a/RetroBar/Languages/English.xaml
+++ b/RetroBar/Languages/English.xaml
@@ -31,6 +31,7 @@
Show _window previews (thumbnails)
_Use software rendering
_Middle-click to close taskbar items
+ Add the Show _Desktop button
Multiple displays
S_how tasks on:
@@ -76,6 +77,12 @@
_Exit RetroBar
_Customize Notifications...
+ Surface/Restore Desktop
+ Show Desktop
+ _Desktop
+ _Show Desktop
+ _Peek at desktop
+
_Restore
_Move
_Size
diff --git "a/RetroBar/Languages/espa\303\261ol.xaml" "b/RetroBar/Languages/espa\303\261ol.xaml"
index b3e3ef3f..eb3dbbcd 100644
--- "a/RetroBar/Languages/espa\303\261ol.xaml"
+++ "b/RetroBar/Languages/espa\303\261ol.xaml"
@@ -31,6 +31,7 @@
Mostrar _vistas previas de las ventanas (miniaturas)
Usar procesamiento por soft_ware
_Cerrar elementos de la barra de tareas con el botón central
+ Agregar el botón Mostrar _escritorio
Varias pantallas
Mostrar _tareas en:
@@ -76,6 +77,12 @@
_Salir de RetroBar
Personali_zar notificaciones...
+ Emerger o restaurar escritorio
+ Mostrar escritorio
+ _Escritorio
+ _Mostrar escritorio
+ _Vistazo al escritorio
+
_Restaurar
_Mover
_Tamaño
diff --git a/RetroBar/Properties/Settings.Designer.cs b/RetroBar/Properties/Settings.Designer.cs
index c1f63bfb..68c81262 100644
--- a/RetroBar/Properties/Settings.Designer.cs
+++ b/RetroBar/Properties/Settings.Designer.cs
@@ -168,6 +168,30 @@ public bool MiddleMouseToClose
}
}
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool ShowDesktopButton {
+ get {
+ return ((bool)(this["ShowDesktopButton"]));
+ }
+ set {
+ this["ShowDesktopButton"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool PeekAtDesktop {
+ get {
+ return ((bool)(this["PeekAtDesktop"]));
+ }
+ set {
+ this["PeekAtDesktop"] = value;
+ }
+ }
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("7820ae76-23e3-4229-82c1-e41cb67d5b9c|7820ae75-23e3-4229-82c1-e41cb67d5b9c|7820ae7" +
diff --git a/RetroBar/Properties/Settings.settings b/RetroBar/Properties/Settings.settings
index 21493d0c..42b16af4 100644
--- a/RetroBar/Properties/Settings.settings
+++ b/RetroBar/Properties/Settings.settings
@@ -35,10 +35,15 @@
False
-
+
+ False
+
+
+ False
+
+
False
-
7820ae76-23e3-4229-82c1-e41cb67d5b9c|7820ae75-23e3-4229-82c1-e41cb67d5b9c|7820ae74-23e3-4229-82c1-e41cb67d5b9c|7820ae73-23e3-4229-82c1-e41cb67d5b9c
diff --git a/RetroBar/PropertiesWindow.xaml b/RetroBar/PropertiesWindow.xaml
index a6708660..f5a5143f 100644
--- a/RetroBar/PropertiesWindow.xaml
+++ b/RetroBar/PropertiesWindow.xaml
@@ -220,6 +220,7 @@
Converter="{StaticResource textRenderingModeConverter}" />
+
@@ -253,6 +254,10 @@
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowClock, UpdateSourceTrigger=PropertyChanged}">
+
+
+
diff --git a/RetroBar/Resources/desktop95-lg.png b/RetroBar/Resources/desktop95-lg.png
new file mode 100644
index 00000000..5fe80fc1
Binary files /dev/null and b/RetroBar/Resources/desktop95-lg.png differ
diff --git a/RetroBar/Resources/desktop95-sm.png b/RetroBar/Resources/desktop95-sm.png
new file mode 100644
index 00000000..237c1709
Binary files /dev/null and b/RetroBar/Resources/desktop95-sm.png differ
diff --git a/RetroBar/Resources/desktopMe2k-lg.png b/RetroBar/Resources/desktopMe2k-lg.png
new file mode 100644
index 00000000..24e99eab
Binary files /dev/null and b/RetroBar/Resources/desktopMe2k-lg.png differ
diff --git a/RetroBar/Resources/desktopMe2k-sm.png b/RetroBar/Resources/desktopMe2k-sm.png
new file mode 100644
index 00000000..09d7ec1b
Binary files /dev/null and b/RetroBar/Resources/desktopMe2k-sm.png differ
diff --git a/RetroBar/Resources/desktopxp-lg.png b/RetroBar/Resources/desktopxp-lg.png
new file mode 100644
index 00000000..4b490cf2
Binary files /dev/null and b/RetroBar/Resources/desktopxp-lg.png differ
diff --git a/RetroBar/Resources/desktopxp-sm.png b/RetroBar/Resources/desktopxp-sm.png
new file mode 100644
index 00000000..3bf5fcc7
Binary files /dev/null and b/RetroBar/Resources/desktopxp-sm.png differ
diff --git a/RetroBar/RetroBar.csproj b/RetroBar/RetroBar.csproj
index 0bc572b0..6fc0f92d 100644
--- a/RetroBar/RetroBar.csproj
+++ b/RetroBar/RetroBar.csproj
@@ -34,6 +34,8 @@
+
+
@@ -43,7 +45,7 @@
-
+
@@ -52,6 +54,8 @@
+
+
Never
diff --git a/RetroBar/Taskbar.xaml b/RetroBar/Taskbar.xaml
index c84b533e..27fbb90b 100644
--- a/RetroBar/Taskbar.xaml
+++ b/RetroBar/Taskbar.xaml
@@ -56,6 +56,16 @@
RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=Window}" />
+
+
+
+
+
diff --git a/RetroBar/Taskbar.xaml.cs b/RetroBar/Taskbar.xaml.cs
index 702533f5..b0a269ca 100644
--- a/RetroBar/Taskbar.xaml.cs
+++ b/RetroBar/Taskbar.xaml.cs
@@ -50,6 +50,11 @@ public Taskbar(WindowManager windowManager, ShellManager shellManager, StartMenu
QuickLaunchToolbar.Visibility = Visibility.Visible;
}
+ if (Settings.Instance.ShowDesktopButton)
+ {
+ ShowDesktopButtonTray.Visibility = Visibility.Visible;
+ }
+
// Hide the start button on secondary display(s)
if (!Screen.Primary)
{
@@ -162,6 +167,17 @@ private void Settings_PropertyChanged(object sender, PropertyChangedEventArgs e)
return;
}
}
+ else if (e.PropertyName == "ShowDesktopButton")
+ {
+ if (Settings.Instance.ShowDesktopButton)
+ {
+ ShowDesktopButtonTray.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ ShowDesktopButtonTray.Visibility = Visibility.Collapsed;
+ }
+ }
}
private void Taskbar_OnLocationChanged(object sender, EventArgs e)
diff --git a/RetroBar/Themes/System XP.xaml b/RetroBar/Themes/System XP.xaml
index 6e9f89bf..a315ad70 100644
--- a/RetroBar/Themes/System XP.xaml
+++ b/RetroBar/Themes/System XP.xaml
@@ -5,6 +5,11 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/RetroBar/Themes/Windows 2000.xaml b/RetroBar/Themes/Windows 2000.xaml
index f17f5e05..bda5fb3c 100644
--- a/RetroBar/Themes/Windows 2000.xaml
+++ b/RetroBar/Themes/Windows 2000.xaml
@@ -33,4 +33,9 @@
Tahoma
+
+
+
\ No newline at end of file
diff --git a/RetroBar/Themes/Windows 95-98.xaml b/RetroBar/Themes/Windows 95-98.xaml
index a1e8601a..93bd42d6 100644
--- a/RetroBar/Themes/Windows 95-98.xaml
+++ b/RetroBar/Themes/Windows 95-98.xaml
@@ -19,6 +19,13 @@
+
+
\ No newline at end of file
diff --git a/RetroBar/Themes/Windows Longhorn Aero.xaml b/RetroBar/Themes/Windows Longhorn Aero.xaml
index df8a0ca1..d3ecf22c 100644
--- a/RetroBar/Themes/Windows Longhorn Aero.xaml
+++ b/RetroBar/Themes/Windows Longhorn Aero.xaml
@@ -378,6 +378,10 @@
+
+
+
+
+
+
+
+
+