diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-09-02 04:54:34 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-09-02 04:54:34 +0900 |
| commit | 6f719bc3c19d56279d2d76d3bcf8fb66ace2d2fb (patch) | |
| tree | 6e9e84fd6f382fa823c87a70a0df0284dc127250 /system/xhost.go | |
| parent | 1b5d20a39b2c5720d83a8eaf3d2227deb46a7c0d (diff) | |
system: update doc commands and remove mutex
The mutex is not really doing anything, none of these methods make sense when called concurrently anyway. The copylocks analysis is still satisfied by the noCopy struct.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/xhost.go')
| -rw-r--r-- | system/xhost.go | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/system/xhost.go b/system/xhost.go index 27b2fc64..2ed1acff 100644 --- a/system/xhost.go +++ b/system/xhost.go @@ -4,27 +4,24 @@ import ( "hakurei.app/system/internal/xcb" ) -// ChangeHosts appends an X11 ChangeHosts command Op. +// ChangeHosts appends [XHostOp] to [I]. func (sys *I) ChangeHosts(username string) *I { - sys.lock.Lock() - defer sys.lock.Unlock() - - sys.ops = append(sys.ops, XHost(username)) - + sys.ops = append(sys.ops, XHostOp(username)) return sys } -type XHost string +// XHostOp inserts the target user into X11 hosts and deletes it once its [Enablement] is no longer satisfied. +type XHostOp string -func (x XHost) Type() Enablement { return EX11 } +func (x XHostOp) Type() Enablement { return EX11 } -func (x XHost) 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 XHost) revert(_ *I, ec *Criteria) error { +func (x XHostOp) revert(_ *I, ec *Criteria) error { if ec.hasType(x) { msg.Verbosef("deleting entry %s from X11", x) return newOpError("xhost", @@ -35,6 +32,6 @@ func (x XHost) revert(_ *I, ec *Criteria) error { } } -func (x XHost) Is(o Op) bool { x0, ok := o.(XHost); return ok && x == x0 } -func (x XHost) Path() string { return string(x) } -func (x XHost) 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) } |
