aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-17 01:45:10 +0900
committerOphestra <cat@gensokyo.uk>2025-11-17 01:46:01 +0900
commit3afca2bd5b58645ad503bc8ef6dfa4f05d2e01e0 (patch)
tree4aff66389b0405e5e53fd73c9d434ab839824f74
parentb73a789dfe2b7361d9fce7d6755d14e44f6d9d57 (diff)
internal/wayland: expose WAYLAND_VERSION
This might be useful troubleshooting information. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--cmd/hakurei/print.go8
-rw-r--r--hst/hst.go3
-rw-r--r--internal/outcome/outcome.go12
-rw-r--r--internal/wayland/wayland.go4
4 files changed, 21 insertions, 6 deletions
diff --git a/cmd/hakurei/print.go b/cmd/hakurei/print.go
index 7e3400a2..7ce51f47 100644
--- a/cmd/hakurei/print.go
+++ b/cmd/hakurei/print.go
@@ -12,8 +12,6 @@ import (
"time"
"hakurei.app/hst"
- "hakurei.app/internal/env"
- "hakurei.app/internal/info"
"hakurei.app/internal/outcome"
"hakurei.app/internal/store"
"hakurei.app/message"
@@ -23,16 +21,14 @@ import (
func printShowSystem(output io.Writer, short, flagJSON bool) {
t := newPrinter(output)
defer t.MustFlush()
-
- hi := &hst.Info{Version: info.Version(), User: new(outcome.Hsu).MustID(nil)}
- env.CopyPaths().Copy(&hi.Paths, hi.User)
+ hi := outcome.Info()
if flagJSON {
encodeJSON(log.Fatal, output, short, hi)
return
}
- t.Printf("Version:\t%s\n", hi.Version)
+ t.Printf("Version:\t%s (libwayland %s)\n", hi.Version, hi.WaylandVersion)
t.Printf("User:\t%d\n", hi.User)
t.Printf("TempDir:\t%s\n", hi.TempDir)
t.Printf("SharePath:\t%s\n", hi.SharePath)
diff --git a/hst/hst.go b/hst/hst.go
index bdff19f8..f48b9f8d 100644
--- a/hst/hst.go
+++ b/hst/hst.go
@@ -54,6 +54,9 @@ type Paths struct {
// Info holds basic system information collected from the implementation.
type Info struct {
+ // WaylandVersion is the libwayland value of WAYLAND_VERSION.
+ WaylandVersion string `json:"WAYLAND_VERSION"`
+
// Version is a hardcoded version string.
Version string `json:"version"`
// User is the userid according to hsu.
diff --git a/internal/outcome/outcome.go b/internal/outcome/outcome.go
index 48f85a4b..e2563550 100644
--- a/internal/outcome/outcome.go
+++ b/internal/outcome/outcome.go
@@ -11,10 +11,22 @@ import (
"hakurei.app/hst"
"hakurei.app/internal/acl"
"hakurei.app/internal/env"
+ "hakurei.app/internal/info"
"hakurei.app/internal/system"
+ "hakurei.app/internal/wayland"
"hakurei.app/message"
)
+// Info returns the address to a populated [hst.Info].
+//
+// This must not be called from within package outcome.
+func Info() *hst.Info {
+ hi := hst.Info{WaylandVersion: wayland.Version,
+ Version: info.Version(), User: new(Hsu).MustID(nil)}
+ env.CopyPaths().Copy(&hi.Paths, hi.User)
+ return &hi
+}
+
// envAllocSize is the initial size of the env map pre-allocated when the configured env map is nil.
// It should be large enough to fit all insertions by outcomeOp.toContainer.
const envAllocSize = 1 << 6
diff --git a/internal/wayland/wayland.go b/internal/wayland/wayland.go
index cc4f4e04..d0ec6cf6 100644
--- a/internal/wayland/wayland.go
+++ b/internal/wayland/wayland.go
@@ -9,6 +9,7 @@ package wayland
#cgo freebsd openbsd LDFLAGS: -lwayland-client
#include "wayland-client-helper.h"
+#include <wayland-version.h>
*/
import "C"
import (
@@ -17,6 +18,9 @@ import (
)
const (
+ // Version is the value of WAYLAND_VERSION.
+ Version = C.WAYLAND_VERSION
+
// Display contains the name of the server socket
// (https://gitlab.freedesktop.org/wayland/wayland/-/blob/1.23.1/src/wayland-client.c#L1147)
// which is concatenated with XDG_RUNTIME_DIR