diff --git a/AGENTS.md b/AGENTS.md
index 17d4f4ab31..4c0f69325c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -165,7 +165,8 @@ transitions when switching tools; check `AppearanceManager.AnimationsEnabled` wh
`ChildWindowAnimation`, `SelectionIndicatorAnimation`, `ExpanderAnimation`, `SmoothProgress`, notification slide-in, tab
reorder slide (Dragablz `StackOrganiser`, `Canvas.Left`, switch set in `App.xaml.cs`). Short color / opacity fades
(hover layers, tooltip, overlay) are always shown. The accent glow is only in the window frame. Native windows (Remote
-Desktop, PuTTY, PowerShell, TigerVNC, WebView2) can't be animated, clipped or put in transparent windows.
+Desktop, PuTTY, PowerShell, TigerVNC, WebView2) can't be animated, clipped or put in per-pixel transparent windows
+(`AllowsTransparency`); the whole window can be transparent (`WindowTransparencyHelper`, uniform alpha).
## Architecture
diff --git a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs
index f7ad28673a..fbd84efdc1 100644
--- a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs
+++ b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs
@@ -4720,6 +4720,15 @@ public static string EnableRulesX {
}
}
+ ///
+ /// Looks up a localized string similar to Enable transparency.
+ ///
+ public static string EnableTransparency {
+ get {
+ return ResourceManager.GetString("EnableTransparency", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Encryption.
///
@@ -6936,6 +6945,15 @@ public static string HelpMessage_Tags {
}
}
+ ///
+ /// Looks up a localized string similar to Makes the main window, the windows of dragged-out tabs, the status window and the notifications transparent, so you can see what is behind them..
+ ///
+ public static string HelpMessage_Transparency {
+ get {
+ return ResourceManager.GetString("HelpMessage_Transparency", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Use custom themes to personalize the appearance of the application. You can edit or add theme in the "Program Folder > Themes" directory. For more details, refer to the documentation..
///
@@ -16097,6 +16115,15 @@ public static string Traceroute {
}
}
+ ///
+ /// Looks up a localized string similar to Transparency.
+ ///
+ public static string Transparency {
+ get {
+ return ResourceManager.GetString("Transparency", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Tray.
///
diff --git a/Source/NETworkManager.Localization/Resources/Strings.resx b/Source/NETworkManager.Localization/Resources/Strings.resx
index 4d1848e5e7..00c46a99f8 100644
--- a/Source/NETworkManager.Localization/Resources/Strings.resx
+++ b/Source/NETworkManager.Localization/Resources/Strings.resx
@@ -5966,4 +5966,13 @@ Do you want to close all hosts?
Actions
+
+ Transparency
+
+
+ Enable transparency
+
+
+ Makes the main window, the windows of dragged-out tabs, the status window and the notifications transparent, so you can see what is behind them.
+
diff --git a/Source/NETworkManager.Settings/AppearanceManager.cs b/Source/NETworkManager.Settings/AppearanceManager.cs
index 7a6bc13006..5471c6bac3 100644
--- a/Source/NETworkManager.Settings/AppearanceManager.cs
+++ b/Source/NETworkManager.Settings/AppearanceManager.cs
@@ -195,6 +195,19 @@ public static class AppearanceManager
AnimationMode.Off => false,
_ => SystemParameters.ClientAreaAnimation
};
+
+ ///
+ /// Transparency of the main window, the windows of dragged-out tabs, the status window and the notifications in
+ /// percent (0 = opaque): the setting
+ /// (, limited to the range of the slider) if
+ /// is enabled. Opaque in screenshot mode.
+ ///
+ public static int WindowTransparency =>
+ !CommandLineManager.Current.Screenshot && SettingsManager.Current?.Appearance_UseTransparency == true
+ ? Math.Clamp(SettingsManager.Current.Appearance_Transparency,
+ GlobalStaticConfiguration.Appearance_TransparencyMin,
+ GlobalStaticConfiguration.Appearance_TransparencyMax)
+ : 0;
#endregion
#region Constructor
diff --git a/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs b/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs
index 93d174fdee..ac826644c9 100644
--- a/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs
+++ b/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs
@@ -103,6 +103,12 @@ public static class GlobalStaticConfiguration
public static AnimationMode Appearance_Animations => AnimationMode.System;
// Medium for new installations (subtle, static); saved in the settings
public static AccentGlowIntensity Appearance_AccentGlowIntensity => AccentGlowIntensity.Medium;
+ // Transparency of the main window, the windows of dragged-out tabs, the status window and the notifications
+ // (percent, 0 = opaque); more than 30 % makes the texts hard to read
+ public static bool Appearance_UseTransparency => false;
+ public static int Appearance_Transparency => 5; // %
+ public static int Appearance_TransparencyMin => 1; // %
+ public static int Appearance_TransparencyMax => 30; // %
// Network
public static bool Network_AddDNSSuffix => true;
diff --git a/Source/NETworkManager.Settings/SettingsInfo.cs b/Source/NETworkManager.Settings/SettingsInfo.cs
index fc06a6a013..7f1d7f663d 100644
--- a/Source/NETworkManager.Settings/SettingsInfo.cs
+++ b/Source/NETworkManager.Settings/SettingsInfo.cs
@@ -373,6 +373,32 @@ public AccentGlowIntensity Appearance_AccentGlowIntensity
}
} = GlobalStaticConfiguration.Appearance_AccentGlowIntensity;
+ public bool Appearance_UseTransparency
+ {
+ get;
+ set
+ {
+ if (value == field)
+ return;
+
+ field = value;
+ OnPropertyChanged();
+ }
+ } = GlobalStaticConfiguration.Appearance_UseTransparency;
+
+ public int Appearance_Transparency
+ {
+ get;
+ set
+ {
+ if (value == field)
+ return;
+
+ field = value;
+ OnPropertyChanged();
+ }
+ } = GlobalStaticConfiguration.Appearance_Transparency;
+
public AnimationMode Appearance_Animations
{
get;
diff --git a/Source/NETworkManager.Tests/Utilities/WindowTransparencyHelperTests.cs b/Source/NETworkManager.Tests/Utilities/WindowTransparencyHelperTests.cs
new file mode 100644
index 0000000000..91ec74bdaf
--- /dev/null
+++ b/Source/NETworkManager.Tests/Utilities/WindowTransparencyHelperTests.cs
@@ -0,0 +1,26 @@
+using NETworkManager.Utilities.WPF;
+using Xunit;
+
+namespace NETworkManager.Tests.Utilities;
+
+public class WindowTransparencyHelperTests
+{
+ [Theory]
+ [InlineData(0, 255)]
+ [InlineData(5, 242)]
+ [InlineData(15, 217)]
+ [InlineData(30, 179)]
+ [InlineData(100, 0)]
+ public void ConvertsTransparencyToAlpha(int transparency, byte expectedAlpha)
+ {
+ Assert.Equal(expectedAlpha, WindowTransparencyHelper.GetAlpha(transparency));
+ }
+
+ [Theory]
+ [InlineData(-10, 255)]
+ [InlineData(150, 0)]
+ public void ClampsTransparency(int transparency, byte expectedAlpha)
+ {
+ Assert.Equal(expectedAlpha, WindowTransparencyHelper.GetAlpha(transparency));
+ }
+}
diff --git a/Source/NETworkManager.Utilities.WPF/WindowTransparencyHelper.cs b/Source/NETworkManager.Utilities.WPF/WindowTransparencyHelper.cs
new file mode 100644
index 0000000000..43622f5d9e
--- /dev/null
+++ b/Source/NETworkManager.Utilities.WPF/WindowTransparencyHelper.cs
@@ -0,0 +1,150 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Windows;
+using System.Windows.Interop;
+
+namespace NETworkManager.Utilities.WPF;
+
+///
+/// Makes a whole window transparent (uniform alpha of a system layered window, applied by Windows / DWM). Unlike
+/// (per-pixel transparency, rendered by WPF) it can be changed while the window
+/// is shown and keeps the embedded windows (Remote Desktop, PuTTY, PowerShell, TigerVNC, WebView2) visible - they become
+/// transparent too.
+///
+///
+/// WPF removes WS_EX_LAYERED from a top-level window without in
+/// WM_STYLECHANGING (HwndTarget: "prevents an external program from making us system-layered"), also when
+/// it updates its render settings later. A hook of the window (called before the one of WPF) keeps the style; it is only
+/// added while the window is transparent. Disabled (0) on a window that was never transparent changes nothing.
+///
+public static class WindowTransparencyHelper
+{
+ // https://learn.microsoft.com/windows/win32/winmsg/extended-window-styles
+ private const int GWL_EXSTYLE = -20;
+ private const int WS_EX_LAYERED = 0x00080000;
+
+ // https://learn.microsoft.com/windows/win32/winmsg/wm-stylechanging
+ private const int WM_STYLECHANGING = 0x007C;
+
+ // https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-setlayeredwindowattributes
+ private const int LWA_ALPHA = 0x00000002;
+
+ // https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-redrawwindow
+ private const int RDW_INVALIDATE = 0x0001;
+ private const int RDW_ERASE = 0x0004;
+ private const int RDW_ALLCHILDREN = 0x0080;
+ private const int RDW_FRAME = 0x0400;
+
+ [DllImport("user32.dll", EntryPoint = "GetWindowLongPtrW")]
+ private static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex);
+
+ [DllImport("user32.dll", EntryPoint = "SetWindowLongPtrW")]
+ private static extern IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static extern bool RedrawWindow(IntPtr hWnd, IntPtr lprcUpdate, IntPtr hrgnUpdate, uint flags);
+
+ ///
+ /// Hook of the window, only set while the window is transparent.
+ ///
+ private static readonly DependencyProperty HookProperty =
+ DependencyProperty.RegisterAttached("Hook", typeof(HwndSourceHook), typeof(WindowTransparencyHelper),
+ new PropertyMetadata(null));
+
+ ///
+ /// Converts the transparency in percent (0 = opaque) to the alpha of the layered window (255 = opaque).
+ ///
+ /// Transparency in percent, clamped to 0 - 100.
+ /// Alpha value (0 - 255).
+ public static byte GetAlpha(int transparency)
+ {
+ var value = Math.Clamp(transparency, 0, 100);
+
+ // Rounded half up (integer math, Math.Round would round 178.5 to 178)
+ return (byte)((255 * (100 - value) + 50) / 100);
+ }
+
+ ///
+ /// Makes the window transparent ( in percent) or opaque again (0). With 0 on a window
+ /// that was never transparent, nothing is changed (no hook, no style). Does nothing before the window has a handle
+ /// (call it in / after SourceInitialized).
+ ///
+ /// Window to change.
+ /// Transparency in percent (0 = opaque, removes the hook and the layered style again).
+ public static void Apply(Window window, int transparency)
+ {
+ transparency = Math.Clamp(transparency, 0, 100);
+
+ // The hook is only added while the window is transparent, so it also marks a window changed here
+ var hook = (HwndSourceHook)window.GetValue(HookProperty);
+
+ // Disabled and never enabled: don't touch the window (same behavior as without this option)
+ if (transparency == 0 && hook == null)
+ return;
+
+ var handle = new WindowInteropHelper(window).Handle;
+
+ if (handle == IntPtr.Zero)
+ return;
+
+ var source = HwndSource.FromHwnd(handle);
+
+ if (source == null)
+ return;
+
+ var exStyle = GetWindowLongPtr(handle, GWL_EXSTYLE).ToInt64();
+ var isLayered = (exStyle & WS_EX_LAYERED) != 0;
+
+ if (transparency == 0)
+ {
+ // Opaque again: remove the hook first, then the layered style (WPF only allows it with the hook, so it was
+ // set here), so the window is the same as before
+ source.RemoveHook(hook);
+ window.ClearValue(HookProperty);
+
+ if (!isLayered)
+ return;
+
+ SetWindowLongPtr(handle, GWL_EXSTYLE, new IntPtr(exStyle & ~WS_EX_LAYERED));
+
+ // Windows doesn't repaint the window after the layered style is removed
+ RedrawWindow(handle, IntPtr.Zero, IntPtr.Zero, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
+
+ return;
+ }
+
+ // Add the hook before the style is changed, so WPF doesn't remove the layered style again
+ if (hook == null)
+ {
+ hook = WndProc;
+ source.AddHook(hook);
+ window.SetValue(HookProperty, hook);
+ }
+
+ if (!isLayered)
+ SetWindowLongPtr(handle, GWL_EXSTYLE, new IntPtr(exStyle | WS_EX_LAYERED));
+
+ SetLayeredWindowAttributes(handle, 0, GetAlpha(transparency), LWA_ALPHA);
+ }
+
+ private static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
+ {
+ // Keep the layered style (the hook is only added while the window is transparent). Handled, so WPF
+ // (HwndTarget) doesn't remove it again. STYLESTRUCT: styleOld (offset 0), styleNew (offset 4). wParam unchecked
+ // like WPF: ToInt32() throws on 64-bit if the value doesn't fit.
+ if (msg != WM_STYLECHANGING || unchecked((int)wParam.ToInt64()) != GWL_EXSTYLE)
+ return IntPtr.Zero;
+
+ var styleNew = Marshal.ReadInt32(lParam, 4);
+ Marshal.WriteInt32(lParam, 4, styleNew | WS_EX_LAYERED);
+
+ handled = true;
+
+ return IntPtr.Zero;
+ }
+}
diff --git a/Source/NETworkManager/Controls/DragablzTabHostWindow.xaml.cs b/Source/NETworkManager/Controls/DragablzTabHostWindow.xaml.cs
index e8223a1ebd..a6049c6f59 100644
--- a/Source/NETworkManager/Controls/DragablzTabHostWindow.xaml.cs
+++ b/Source/NETworkManager/Controls/DragablzTabHostWindow.xaml.cs
@@ -5,6 +5,7 @@
using NETworkManager.Models.RemoteDesktop;
using NETworkManager.Settings;
using NETworkManager.Utilities;
+using NETworkManager.Utilities.WPF;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -425,6 +426,8 @@ protected override void OnSourceInitialized(EventArgs e)
_hwndSource = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
_hwndSource?.AddHook(HwndHook);
+
+ WindowTransparencyHelper.Apply(this, AppearanceManager.WindowTransparency);
}
[DebuggerStepThrough]
diff --git a/Source/NETworkManager/MainWindow.xaml.cs b/Source/NETworkManager/MainWindow.xaml.cs
index 01d0f11454..c517b4b55c 100644
--- a/Source/NETworkManager/MainWindow.xaml.cs
+++ b/Source/NETworkManager/MainWindow.xaml.cs
@@ -10,6 +10,7 @@
using NETworkManager.Settings;
using NETworkManager.Update;
using NETworkManager.Utilities;
+using NETworkManager.Utilities.WPF;
using NETworkManager.ViewModels;
using NETworkManager.Views;
using System;
@@ -51,6 +52,16 @@ private void SettingsManager_PropertyChanged(object sender, PropertyChangedEvent
break;
+ // Change the transparency of the main window, the windows of dragged-out tabs, the status window and the
+ // notifications
+ case nameof(SettingsInfo.Appearance_UseTransparency):
+ case nameof(SettingsInfo.Appearance_Transparency):
+ foreach (var window in Application.Current.Windows.OfType()
+ .Where(x => x is MainWindow or DragablzTabHostWindow or StatusWindow or NotificationWindow))
+ WindowTransparencyHelper.Apply(window, AppearanceManager.WindowTransparency);
+
+ break;
+
// Update TrayIcon if changed in the settings
case nameof(SettingsInfo.TrayIcon_AlwaysShowIcon):
if (SettingsManager.Current.TrayIcon_AlwaysShowIcon && _notifyIcon == null)
@@ -1440,6 +1451,8 @@ protected override void OnSourceInitialized(EventArgs e)
_hwndSource = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
_hwndSource?.AddHook(HwndHook);
+ WindowTransparencyHelper.Apply(this, AppearanceManager.WindowTransparency);
+
RegisterHotKeys();
}
diff --git a/Source/NETworkManager/NotificationWindow.xaml.cs b/Source/NETworkManager/NotificationWindow.xaml.cs
index 8c348d7851..70c13dd007 100644
--- a/Source/NETworkManager/NotificationWindow.xaml.cs
+++ b/Source/NETworkManager/NotificationWindow.xaml.cs
@@ -3,6 +3,7 @@
using NETworkManager.Models;
using NETworkManager.Settings;
using NETworkManager.Utilities;
+using NETworkManager.Utilities.WPF;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -265,6 +266,8 @@ protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
+ WindowTransparencyHelper.Apply(this, AppearanceManager.WindowTransparency);
+
ApplyPosition();
SlideIn();
diff --git a/Source/NETworkManager/StatusWindow.xaml.cs b/Source/NETworkManager/StatusWindow.xaml.cs
index fcbc68a959..b937fc119a 100644
--- a/Source/NETworkManager/StatusWindow.xaml.cs
+++ b/Source/NETworkManager/StatusWindow.xaml.cs
@@ -1,5 +1,6 @@
using NETworkManager.Settings;
using NETworkManager.Utilities;
+using NETworkManager.Utilities.WPF;
using NETworkManager.Views;
using System;
using System.ComponentModel;
@@ -36,6 +37,13 @@ public StatusWindow(MainWindow mainWindow)
SizeChanged += (_, _) => UpdatePosition();
}
+ protected override void OnSourceInitialized(EventArgs e)
+ {
+ base.OnSourceInitialized(e);
+
+ WindowTransparencyHelper.Apply(this, AppearanceManager.WindowTransparency);
+ }
+
#endregion
#region PropertyChangedEventHandler
diff --git a/Source/NETworkManager/ViewModels/SettingsAppearanceViewModel.cs b/Source/NETworkManager/ViewModels/SettingsAppearanceViewModel.cs
index 77847607f4..e0e3d7636f 100644
--- a/Source/NETworkManager/ViewModels/SettingsAppearanceViewModel.cs
+++ b/Source/NETworkManager/ViewModels/SettingsAppearanceViewModel.cs
@@ -118,6 +118,45 @@ public AccentGlowIntensity AccentGlowIntensity
}
}
+ public bool UseTransparency
+ {
+ get;
+ set
+ {
+ if (value == field)
+ return;
+
+ if (!_isLoading)
+ SettingsManager.Current.Appearance_UseTransparency = value;
+
+ field = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public int TransparencyMin => GlobalStaticConfiguration.Appearance_TransparencyMin;
+
+ public int TransparencyMax => GlobalStaticConfiguration.Appearance_TransparencyMax;
+
+ ///
+ /// Transparency in percent, applied immediately while the slider is moved.
+ ///
+ public int Transparency
+ {
+ get;
+ set
+ {
+ if (value == field)
+ return;
+
+ if (!_isLoading)
+ SettingsManager.Current.Appearance_Transparency = value;
+
+ field = value;
+ OnPropertyChanged();
+ }
+ }
+
public IEnumerable AnimationModes => Enum.GetValues();
public AnimationMode AnimationMode
@@ -186,6 +225,8 @@ private void LoadSettings()
.FirstOrDefault(x => x.Name == SettingsManager.Current.Appearance_CustomThemeName) ??
CustomThemes.Cast().FirstOrDefault();
AccentGlowIntensity = SettingsManager.Current.Appearance_AccentGlowIntensity;
+ UseTransparency = SettingsManager.Current.Appearance_UseTransparency;
+ Transparency = Math.Clamp(SettingsManager.Current.Appearance_Transparency, TransparencyMin, TransparencyMax);
// If policy is set, show the policy value (on / off); otherwise show the user's setting
AnimationMode = PolicyManager.Current?.Appearance_Animations is { } animationsPolicy
? animationsPolicy ? AnimationMode.On : AnimationMode.Off
diff --git a/Source/NETworkManager/Views/SettingsAppearanceView.xaml b/Source/NETworkManager/Views/SettingsAppearanceView.xaml
index e04df8e4ed..7be272f8e8 100644
--- a/Source/NETworkManager/Views/SettingsAppearanceView.xaml
+++ b/Source/NETworkManager/Views/SettingsAppearanceView.xaml
@@ -86,6 +86,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md
index a88f6b61d4..6ba70ab1bf 100644
--- a/Website/docs/changelog/next-release.md
+++ b/Website/docs/changelog/next-release.md
@@ -25,6 +25,10 @@ Release date: **xx.xx.2026**
## What's new?
+**Appearance**
+
+- The main window, the windows of dragged-out tabs, the status window and the notifications can be made transparent (1 - 30 %), e.g. to see another window behind them. See [Transparency](../settings/appearance.md#transparency). [#3760](https://github.com/BornToBeRoot/NETworkManager/pull/3760)
+
**mDNS Discovery**
- New tool to browse the services on the local network (e.g. printers, scanners, web servers, media devices), with hostnames, ports, IP addresses and TXT records, service type profiles, filter, copy and export. Run command `mdns` / `dnssd` (e.g. `mdns printers 30`). Thanks to [@MovGP0](https://github.com/MovGP0) [#3719](https://github.com/BornToBeRoot/NETworkManager/pull/3719)
diff --git a/Website/docs/settings/appearance.md b/Website/docs/settings/appearance.md
index 5301f3c040..c061a44f36 100644
--- a/Website/docs/settings/appearance.md
+++ b/Website/docs/settings/appearance.md
@@ -1,7 +1,7 @@
---
sidebar_position: 2
description: "Customize NETworkManager appearance with dark and light themes, accent colors, and custom theme files powered by MahApps.Metro."
-keywords: [NETworkManager, appearance settings, dark theme, light theme, accent colors, custom theme, MahApps.Metro]
+keywords: [NETworkManager, appearance settings, dark theme, light theme, accent colors, transparency, custom theme, MahApps.Metro]
---
# Appearance
@@ -92,6 +92,25 @@ Glow of the accent color in the top left corner of the windows with a frame (mai
- `Medium`
- `Strong`
+### Enable transparency
+
+Makes the main window, the windows of dragged-out tabs, the status window and the notifications transparent, so you
+can see what is behind them (e.g. to compare values with another window). The whole window becomes transparent,
+including the embedded tools (Remote Desktop, PuTTY, PowerShell, TigerVNC, Web Console). Popups (e.g. context menus,
+drop-down lists, tooltips) stay opaque. Changes are applied immediately.
+
+**Type:** `Boolean`
+
+**Default:** `Disabled`
+
+### Transparency
+
+Transparency of the windows in percent (slider). Higher values make the texts harder to read.
+
+**Type:** `Integer` [Min `1`, Max `30`]
+
+**Default:** `5`
+
### Use custom themes
Enables or disables the custom themes.