mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 00:46:12 +02:00
Add window layer setting with Always on Bottom and Always on Top options
This commit is contained in:
@@ -76,6 +76,22 @@ namespace DesktopMagic
|
||||
DependencyProperty.RegisterAttached("IsHooked", typeof(WindowLockHook), typeof(WindowPos),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
public static void SetWindowLayer(Window window, string layer)
|
||||
{
|
||||
switch (layer)
|
||||
{
|
||||
case "Always on Bottom":
|
||||
window.Topmost = false;
|
||||
SendWpfWindowBack(window);
|
||||
SendWpfWindowBack(window);
|
||||
WindowPos.SetIsLocked(window, true);
|
||||
break;
|
||||
case "Always on Top":
|
||||
window.Topmost = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private class WindowLockHook
|
||||
{
|
||||
private readonly Window Window;
|
||||
|
||||
@@ -322,9 +322,7 @@ public partial class PluginWindow : Window, IPluginWindow
|
||||
panel.Visibility = Visibility.Collapsed;
|
||||
imageBorder.BorderThickness = new Thickness(0);
|
||||
image.Margin = new Thickness(0);
|
||||
WindowPos.SendWpfWindowBack(this);
|
||||
WindowPos.SendWpfWindowBack(this);
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
WindowPos.SetWindowLayer(this, pluginClassInstance?.windowLayer.Value ?? "Always on Bottom");
|
||||
tileBar.CaptionHeight = 0;
|
||||
ResizeMode = ResizeMode.NoResize;
|
||||
}
|
||||
@@ -558,12 +556,14 @@ public partial class PluginWindow : Window, IPluginWindow
|
||||
{
|
||||
SetHorizontalAlignment();
|
||||
SetVerticalAlignment();
|
||||
SetWindowLayer();
|
||||
SetRotation();
|
||||
SetThemeOverride();
|
||||
SetThemeOverrideItems();
|
||||
|
||||
pluginClassInstance.horizontalAlignment.OnValueChanged += SetHorizontalAlignment;
|
||||
pluginClassInstance.verticalAlignment.OnValueChanged += SetVerticalAlignment;
|
||||
pluginClassInstance.windowLayer.OnValueChanged += SetWindowLayer;
|
||||
pluginClassInstance.rotation.OnValueChanged += SetRotation;
|
||||
pluginClassInstance.themeOverride.OnValueChanged += SetThemeOverride;
|
||||
|
||||
@@ -599,6 +599,11 @@ public partial class PluginWindow : Window, IPluginWindow
|
||||
border.HorizontalAlignment = horizontalAlignment;
|
||||
}
|
||||
|
||||
void SetWindowLayer()
|
||||
{
|
||||
WindowPos.SetWindowLayer(this, pluginClassInstance.windowLayer.Value);
|
||||
}
|
||||
|
||||
void SetRotation()
|
||||
{
|
||||
image.LayoutTransform = new RotateTransform(pluginClassInstance.rotation.Value);
|
||||
|
||||
@@ -23,10 +23,13 @@ public abstract class Plugin
|
||||
[Setting("desktopmagic-vertical-alignment", "Vertical Alignment", -998)]
|
||||
internal ComboBox verticalAlignment = new ComboBox("Center", "Top", "Bottom");
|
||||
|
||||
[Setting("rotation", "Rotation", -997)]
|
||||
[Setting("desktopmagic-window-layer", "Window Layer", -997)]
|
||||
internal ComboBox windowLayer = new ComboBox("Always on Bottom", "Always on Top");
|
||||
|
||||
[Setting("desktopmagic-rotation", "Rotation", -996)]
|
||||
internal IntegerUpDown rotation = new IntegerUpDown(-360, 360, 0);
|
||||
|
||||
[Setting("theme-override", "Theme Override", -996)]
|
||||
[Setting("desktopmagic-theme-override", "Theme Override", -995)]
|
||||
internal ComboBox themeOverride = new ComboBox("<None>");
|
||||
|
||||
private IPluginData application = null!;
|
||||
|
||||
Reference in New Issue
Block a user