From 4e7aab07d5b175345fdf3ea08868dab1e6d90126 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 13 Nov 2025 01:15:19 +0900 Subject: internal/system: relocate from system These packages are highly specific to hakurei and are difficult to use safely from other pieces of code. Their exported symbols are made available until v0.4.0 where they will be removed for #24. Signed-off-by: Ophestra --- system/xhost.go | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 system/xhost.go (limited to 'system/xhost.go') diff --git a/system/xhost.go b/system/xhost.go deleted file mode 100644 index 9a547f43..00000000 --- a/system/xhost.go +++ /dev/null @@ -1,38 +0,0 @@ -package system - -import ( - "hakurei.app/hst" - "hakurei.app/system/internal/xcb" -) - -// ChangeHosts inserts the target user into X11 hosts and deletes it once its [Enablement] is no longer satisfied. -func (sys *I) ChangeHosts(username string) *I { - sys.ops = append(sys.ops, xhostOp(username)) - return sys -} - -// xhostOp implements [I.ChangeHosts]. -type xhostOp string - -func (x xhostOp) Type() hst.Enablement { return hst.EX11 } - -func (x xhostOp) apply(sys *I) error { - sys.msg.Verbosef("inserting entry %s to X11", x) - return newOpError("xhost", - sys.xcbChangeHosts(xcb.HostModeInsert, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)), false) -} - -func (x xhostOp) revert(sys *I, ec *Criteria) error { - if ec.hasType(x.Type()) { - sys.msg.Verbosef("deleting entry %s from X11", x) - return newOpError("xhost", - sys.xcbChangeHosts(xcb.HostModeDelete, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)), true) - } else { - sys.msg.Verbosef("skipping entry %s in X11", x) - return nil - } -} - -func (x xhostOp) Is(o Op) bool { target, ok := o.(xhostOp); return ok && x == target } -func (x xhostOp) Path() string { return "/tmp/.X11-unix" } -func (x xhostOp) String() string { return string("SI:localuser:" + x) } -- cgit v1.3.1