From e0e4c0ae1104be3671018e6287ba209df66d69e6 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Wed, 13 Oct 2021 08:02:35 +1100 Subject: [PATCH] [v2] Add "AlwaysOnTop" option --- v2/internal/frontend/desktop/windows/window.go | 3 +++ v2/pkg/options/options.go | 1 + website/docs/reference/options.mdx | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/v2/internal/frontend/desktop/windows/window.go b/v2/internal/frontend/desktop/windows/window.go index 5a577ab2e..bf672c385 100644 --- a/v2/internal/frontend/desktop/windows/window.go +++ b/v2/internal/frontend/desktop/windows/window.go @@ -26,6 +26,9 @@ func NewWindow(parent winc.Controller, options *options.App) *Window { var exStyle int if options.Windows != nil { exStyle = w32.WS_EX_CONTROLPARENT | w32.WS_EX_APPWINDOW + if options.AlwaysOnTop { + exStyle |= w32.WS_EX_TOPMOST + } if options.Windows.WindowIsTranslucent { exStyle |= w32.WS_EX_NOREDIRECTIONBITMAP } diff --git a/v2/pkg/options/options.go b/v2/pkg/options/options.go index 5d4528898..50788643f 100644 --- a/v2/pkg/options/options.go +++ b/v2/pkg/options/options.go @@ -26,6 +26,7 @@ type App struct { MaxHeight int StartHidden bool HideWindowOnClose bool + AlwaysOnTop bool RGBA *RGBA Assets embed.FS Menu *menu.Menu diff --git a/website/docs/reference/options.mdx b/website/docs/reference/options.mdx index 0daf888a6..bc1e8df6e 100644 --- a/website/docs/reference/options.mdx +++ b/website/docs/reference/options.mdx @@ -168,6 +168,14 @@ Example: 0xFF000088 - Red at 50% transparency This value is the RGBA value to set the window by default. Default: 0xFFFFFFFF. +### AlwaysOnTop + +Name: AlwaysOnTop + +Type: bool + +Indicates that the window should stay above other windows when losing focus. + ### Assets Name: Assets