aboutsummaryrefslogtreecommitdiffhomepage
path: root/system/xhost.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-06 16:16:03 +0900
committerOphestra <cat@gensokyo.uk>2025-09-06 16:16:03 +0900
commite68db7fbfc367f25ccbaf57ec43f0f4b3c93cba7 (patch)
treecf6c16503c64bc5ca90d155bd7960809d10f272b /system/xhost.go
parentac81cfbedc438593f3b504d53728914ac6a3d359 (diff)
system: unexport Op implementations
None of these are valid with their zero value, and the implementations assume they are created by the builder methods. They are by all means an implementation detail and exporting them makes no sense. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/xhost.go')
-rw-r--r--system/xhost.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/system/xhost.go b/system/xhost.go
index 22a0669f..cdec1290 100644
--- a/system/xhost.go
+++ b/system/xhost.go
@@ -4,24 +4,24 @@ import (
"hakurei.app/system/internal/xcb"
)
-// ChangeHosts appends [XHostOp] to [I].
+// 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))
+ sys.ops = append(sys.ops, xhostOp(username))
return sys
}
-// XHostOp inserts the target user into X11 hosts and deletes it once its [Enablement] is no longer satisfied.
-type XHostOp string
+// xhostOp implements [I.ChangeHosts].
+type xhostOp string
-func (x XHostOp) Type() Enablement { return EX11 }
+func (x xhostOp) Type() Enablement { return EX11 }
-func (x XHostOp) apply(*I) error {
+func (x xhostOp) apply(*I) error {
msg.Verbosef("inserting entry %s to X11", x)
return newOpError("xhost",
xcb.ChangeHosts(xcb.HostModeInsert, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)), false)
}
-func (x XHostOp) revert(_ *I, ec *Criteria) error {
+func (x xhostOp) revert(_ *I, ec *Criteria) error {
if ec.hasType(x.Type()) {
msg.Verbosef("deleting entry %s from X11", x)
return newOpError("xhost",
@@ -32,6 +32,6 @@ func (x XHostOp) revert(_ *I, ec *Criteria) error {
}
}
-func (x XHostOp) Is(o Op) bool { target, ok := o.(XHostOp); return ok && x == target }
-func (x XHostOp) Path() string { return string(x) }
-func (x XHostOp) String() string { return string("SI:localuser:" + x) }
+func (x xhostOp) Is(o Op) bool { target, ok := o.(xhostOp); return ok && x == target }
+func (x xhostOp) Path() string { return string(x) }
+func (x xhostOp) String() string { return string("SI:localuser:" + x) }