diff --git a/v2/internal/frontend/desktop/linux/window.go b/v2/internal/frontend/desktop/linux/window.go index 1f119e526..e7033fe94 100644 --- a/v2/internal/frontend/desktop/linux/window.go +++ b/v2/internal/frontend/desktop/linux/window.go @@ -623,6 +623,17 @@ void SetWindowIcon(GtkWindow* window, const guchar* buf, gsize len) { g_object_unref(loader); } +static void SetWindowTransparency(GtkWidget *widget) +{ + GdkScreen *screen = gtk_widget_get_screen(widget); + GdkVisual *visual = gdk_screen_get_rgba_visual(screen); + + if (visual != NULL && gdk_screen_is_composited(screen)) { + gtk_widget_set_app_paintable(widget, true); + gtk_widget_set_visual(widget, visual); + } +} + */ import "C" import ( @@ -714,6 +725,9 @@ func NewWindow(appoptions *options.App, debug bool) *Window { if appoptions.Linux.Icon != nil { result.SetWindowIcon(appoptions.Linux.Icon) } + if appoptions.Linux.WindowIsTranslucent { + C.SetWindowTransparency(gtkWindow) + } } // Menu diff --git a/v2/pkg/options/linux/linux.go b/v2/pkg/options/linux/linux.go index 2e73064a0..b44186b4c 100644 --- a/v2/pkg/options/linux/linux.go +++ b/v2/pkg/options/linux/linux.go @@ -2,5 +2,6 @@ package linux // Options specific to Linux builds type Options struct { - Icon []byte + Icon []byte + WindowIsTranslucent bool } diff --git a/website/docs/reference/options.mdx b/website/docs/reference/options.mdx index 72cc5f358..723a58708 100644 --- a/website/docs/reference/options.mdx +++ b/website/docs/reference/options.mdx @@ -89,6 +89,7 @@ func main() { }, Linux: &linux.Options{ Icon: icon, + WindowIsTranslucent: false, }, }) if err != nil { @@ -748,3 +749,10 @@ On KDE it should work. The icon should be provided in whatever size it was naturally drawn; that is, don’t scale the image before passing it. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality. + +#### WindowIsTranslucent + +Setting this to `true` will make the window background translucent. Some window managers may ignore it, or result in a black window. + +Name: WindowIsTranslucent
+Type: `bool` \ No newline at end of file