mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 08:56:15 +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),
|
DependencyProperty.RegisterAttached("IsHooked", typeof(WindowLockHook), typeof(WindowPos),
|
||||||
new PropertyMetadata(null));
|
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 class WindowLockHook
|
||||||
{
|
{
|
||||||
private readonly Window Window;
|
private readonly Window Window;
|
||||||
|
|||||||
@@ -322,9 +322,7 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
panel.Visibility = Visibility.Collapsed;
|
panel.Visibility = Visibility.Collapsed;
|
||||||
imageBorder.BorderThickness = new Thickness(0);
|
imageBorder.BorderThickness = new Thickness(0);
|
||||||
image.Margin = new Thickness(0);
|
image.Margin = new Thickness(0);
|
||||||
WindowPos.SendWpfWindowBack(this);
|
WindowPos.SetWindowLayer(this, pluginClassInstance?.windowLayer.Value ?? "Always on Bottom");
|
||||||
WindowPos.SendWpfWindowBack(this);
|
|
||||||
WindowPos.SetIsLocked(this, true);
|
|
||||||
tileBar.CaptionHeight = 0;
|
tileBar.CaptionHeight = 0;
|
||||||
ResizeMode = ResizeMode.NoResize;
|
ResizeMode = ResizeMode.NoResize;
|
||||||
}
|
}
|
||||||
@@ -558,12 +556,14 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
{
|
{
|
||||||
SetHorizontalAlignment();
|
SetHorizontalAlignment();
|
||||||
SetVerticalAlignment();
|
SetVerticalAlignment();
|
||||||
|
SetWindowLayer();
|
||||||
SetRotation();
|
SetRotation();
|
||||||
SetThemeOverride();
|
SetThemeOverride();
|
||||||
SetThemeOverrideItems();
|
SetThemeOverrideItems();
|
||||||
|
|
||||||
pluginClassInstance.horizontalAlignment.OnValueChanged += SetHorizontalAlignment;
|
pluginClassInstance.horizontalAlignment.OnValueChanged += SetHorizontalAlignment;
|
||||||
pluginClassInstance.verticalAlignment.OnValueChanged += SetVerticalAlignment;
|
pluginClassInstance.verticalAlignment.OnValueChanged += SetVerticalAlignment;
|
||||||
|
pluginClassInstance.windowLayer.OnValueChanged += SetWindowLayer;
|
||||||
pluginClassInstance.rotation.OnValueChanged += SetRotation;
|
pluginClassInstance.rotation.OnValueChanged += SetRotation;
|
||||||
pluginClassInstance.themeOverride.OnValueChanged += SetThemeOverride;
|
pluginClassInstance.themeOverride.OnValueChanged += SetThemeOverride;
|
||||||
|
|
||||||
@@ -599,6 +599,11 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
border.HorizontalAlignment = horizontalAlignment;
|
border.HorizontalAlignment = horizontalAlignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetWindowLayer()
|
||||||
|
{
|
||||||
|
WindowPos.SetWindowLayer(this, pluginClassInstance.windowLayer.Value);
|
||||||
|
}
|
||||||
|
|
||||||
void SetRotation()
|
void SetRotation()
|
||||||
{
|
{
|
||||||
image.LayoutTransform = new RotateTransform(pluginClassInstance.rotation.Value);
|
image.LayoutTransform = new RotateTransform(pluginClassInstance.rotation.Value);
|
||||||
|
|||||||
@@ -23,10 +23,13 @@ public abstract class Plugin
|
|||||||
[Setting("desktopmagic-vertical-alignment", "Vertical Alignment", -998)]
|
[Setting("desktopmagic-vertical-alignment", "Vertical Alignment", -998)]
|
||||||
internal ComboBox verticalAlignment = new ComboBox("Center", "Top", "Bottom");
|
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);
|
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>");
|
internal ComboBox themeOverride = new ComboBox("<None>");
|
||||||
|
|
||||||
private IPluginData application = null!;
|
private IPluginData application = null!;
|
||||||
|
|||||||
Reference in New Issue
Block a user