Prevent bad interaction between EXWM and winner-mode
authorAmin Bandali <bandali@gnu.org>
Tue, 27 Dec 2022 14:12:42 +0000 (09:12 -0500)
committerAmin Bandali <bandali@gnu.org>
Tue, 27 Dec 2022 14:12:42 +0000 (09:12 -0500)
.emacs.d/init.el

index e23653b..7b81064 100644 (file)
 
 (run-with-idle-timer 0.5 nil #'require 'winner)
 (with-eval-after-load 'winner
 
 (run-with-idle-timer 0.5 nil #'require 'winner)
 (with-eval-after-load 'winner
-  (winner-mode 1))
+  (winner-mode 1)
+  (when (featurep 'exwm)
+    ;; prevent a bad interaction between EXWM and winner-mode, where
+    ;; sometimes closing a window (like closing a terminal after
+    ;; entering a GPG password via pinentry-gnome3's floating window)
+    ;; results in a dead frame somewhere and effectively freezes EXWM.
+    (advice-add
+     'winner-insert-if-new
+     :around
+     (lambda (orig-fun &rest args)
+       ;; only add the frame if it's live
+       (when (frame-live-p (car args))
+         (apply orig-fun args))))))
 
 (run-with-idle-timer 0.5 nil #'require 'windmove)
 (with-eval-after-load 'windmove
 
 (run-with-idle-timer 0.5 nil #'require 'windmove)
 (with-eval-after-load 'windmove