💩 Allow x11 mode to get window decorations
This commit is contained in:
@@ -26,6 +26,7 @@ var iconPNG []byte
|
|||||||
|
|
||||||
var preferredTheme = flag.String("theme", "", "Specify the theme to be used. dark/light")
|
var preferredTheme = flag.String("theme", "", "Specify the theme to be used. dark/light")
|
||||||
var linger = flag.String("linger", "", "If specified, linger for the given duration (e.g. 10s) before actually closing.")
|
var linger = flag.String("linger", "", "If specified, linger for the given duration (e.g. 10s) before actually closing.")
|
||||||
|
var x11 = flag.Bool("x11", false, "Force the X11 backend (Linux, XWayland): uses the window manager's decorations instead of shirei's client-side titlebar")
|
||||||
|
|
||||||
type Gitmoji struct {
|
type Gitmoji struct {
|
||||||
Emoji string
|
Emoji string
|
||||||
@@ -86,9 +87,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.SetupWindow("Gitmoji Picker", 300, 300)
|
setupWindow("Gitmoji Picker", 300, 300)
|
||||||
app.SetupIconBytes(iconPNG)
|
runWindow(RootView)
|
||||||
app.Run(RootView)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadEntries(gitmojiData *GitmojiData) {
|
func loadEntries(gitmojiData *GitmojiData) {
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
//go:build !linux
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import app "go.hasen.dev/shirei/app"
|
||||||
|
|
||||||
|
func setupWindow(title string, width, height int) {
|
||||||
|
app.SetupWindow(title, width, height)
|
||||||
|
app.SetupIconBytes(iconPNG)
|
||||||
|
}
|
||||||
|
|
||||||
|
func runWindow(frameFn func()) {
|
||||||
|
app.Run(frameFn)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user