💩 Allow x11 mode to get window decorations

This commit is contained in:
2026-09-25 22:59:58 +02:00
parent fe89f803d7
commit 7f0c48100e
3 changed files with 53 additions and 3 deletions
+36
View File
@@ -0,0 +1,36 @@
//go:build linux
package main
import (
"bytes"
"image/png"
app "go.hasen.dev/shirei/app"
"go.hasen.dev/shirei/x11backend"
)
// setupWindow opens the window via shirei's app backend, or directly via the
// X11 backend when -x11 is given: on Wayland sessions shirei always draws its
// own client-side titlebar (xdg-decoration negotiation is not implemented in
// shirei v0.8), while XWayland windows get real server-side decorations from
// the window manager.
func setupWindow(title string, width, height int) {
if *x11 {
x11backend.SetupWindow(title, width, height)
if img, err := png.Decode(bytes.NewReader(iconPNG)); err == nil {
x11backend.SetupIconImage(img)
}
return
}
app.SetupWindow(title, width, height)
app.SetupIconBytes(iconPNG)
}
func runWindow(frameFn func()) {
if *x11 {
x11backend.Run(frameFn)
return
}
app.Run(frameFn)
}