about summary refs log tree commit diff
path: root/third_party/exwm/exwm-background.el
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/exwm/exwm-background.el')
-rw-r--r--third_party/exwm/exwm-background.el8
1 files changed, 3 insertions, 5 deletions
diff --git a/third_party/exwm/exwm-background.el b/third_party/exwm/exwm-background.el
index e7a0360c97c0..9c9bc5e35204 100644
--- a/third_party/exwm/exwm-background.el
+++ b/third_party/exwm/exwm-background.el
@@ -1,6 +1,6 @@
 ;;; exwm-background.el --- X Background Module for EXWM  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2022 Free Software Foundation, Inc.
+;; Copyright (C) 2022-2023 Free Software Foundation, Inc.
 
 ;; Author: Steven Allen <steven@stebalien.com>
 
@@ -172,19 +172,17 @@ replace it.")
 (defun exwm-background--init ()
   "Initialize background module."
   (exwm--log)
-
   (add-hook 'enable-theme-functions 'exwm-background--update)
   (add-hook 'disable-theme-functions 'exwm-background--update)
-
   (exwm-background--update))
 
 (defun exwm-background--exit ()
   "Uninitialize the background module."
   (exwm--log)
-
   (remove-hook 'enable-theme-functions 'exwm-background--update)
   (remove-hook 'disable-theme-functions 'exwm-background--update)
-  (when exwm-background--connection
+  (when (and exwm-background--connection
+             (slot-value exwm-background--connection 'connected))
     (xcb:disconnect exwm-background--connection))
   (setq exwm-background--pixmap nil
         exwm-background--connection nil