Files

37 lines
869 B
Go

//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)
}