Skip to content

Commit

Permalink
exwm-systemtray--init, exwm-xsettings--init: Idempotent initialization
Browse files Browse the repository at this point in the history
* exwm-systemtray.el (exwm-systemtray--init),
  exwm-xsettings.el (exwm-xsettings--init):
  Return early if already initialized.
  • Loading branch information
minad committed Jun 6, 2024
1 parent 63bde86 commit d41de49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion exwm-systemtray.el
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,9 @@ Argument DATA contains the raw event data."
(cl-defun exwm-systemtray--init ()
"Initialize system tray module."
(exwm--log)
(cl-assert (not exwm-systemtray--connection))
;; idempotent initialization
(when exwm-systemtray--connection
(cl-return-from exwm-systemtray--init))
(cl-assert (not exwm-systemtray--list))
(cl-assert (not exwm-systemtray--selection-owner-window))
(cl-assert (not exwm-systemtray--embedder-window))
Expand Down
4 changes: 3 additions & 1 deletion exwm-xsettings.el
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ SERIAL is a sequence number."
"Initialize the XSETTINGS module."
(exwm--log)

(cl-assert (not exwm-xsettings--connection))
;; idempotent initialization
(when exwm-xsettings--connection
(cl-return-from exwm-xsettings--init))

;; Connect
(setq exwm-xsettings--connection (xcb:connect))
Expand Down

0 comments on commit d41de49

Please sign in to comment.