diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-09-08 04:17:39 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-09-08 04:17:39 +0900 |
| commit | 985c4dd2fc175d8c52304ee387a71e7d855b421a (patch) | |
| tree | 8f487bf3786bbe53a6302bbd9e84dc5ad342b073 /system/xhost.go | |
| parent | da2b9c01ceac2d55c271de46d7d18e5b3f19b89b (diff) | |
system/xhost: wrap revert error correctly
This otherwise creates a confusing error message on a revert failure.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/xhost.go')
| -rw-r--r-- | system/xhost.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/system/xhost.go b/system/xhost.go index cdec1290..4ee49931 100644 --- a/system/xhost.go +++ b/system/xhost.go @@ -15,23 +15,23 @@ type xhostOp string func (x xhostOp) Type() Enablement { return EX11 } -func (x xhostOp) apply(*I) error { - msg.Verbosef("inserting entry %s to X11", x) +func (x xhostOp) apply(sys *I) error { + sys.verbosef("inserting entry %s to X11", x) return newOpError("xhost", - xcb.ChangeHosts(xcb.HostModeInsert, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)), false) + sys.xcbChangeHosts(xcb.HostModeInsert, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)), false) } -func (x xhostOp) revert(_ *I, ec *Criteria) error { +func (x xhostOp) revert(sys *I, ec *Criteria) error { if ec.hasType(x.Type()) { - msg.Verbosef("deleting entry %s from X11", x) + sys.verbosef("deleting entry %s from X11", x) return newOpError("xhost", - xcb.ChangeHosts(xcb.HostModeDelete, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)), false) + sys.xcbChangeHosts(xcb.HostModeDelete, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)), true) } else { - msg.Verbosef("skipping entry %s in X11", x) + sys.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 string(x) } +func (x xhostOp) Path() string { return "/tmp/.X11-unix" } func (x xhostOp) String() string { return string("SI:localuser:" + x) } |
