* .emacs.d/init.el: Update mode-line time and battery format.
[~bandali/configs] / .emacs.d / init.el
index b4a16cc..d9ec432 100644 (file)
 (with-eval-after-load 'time
   (setq
    display-time-default-load-average nil
-   display-time-format " %a %b %-e %-l:%M%P"
+   display-time-format " %a %Y-%m-%d %-l:%M%P"
    display-time-mail-icon '(image :type xpm
                                   :file "gnus/gnus-pointer.xpm"
                                   :ascent center)
 
 (run-with-idle-timer 0.1 nil #'require 'battery)
 (with-eval-after-load 'battery
-  (setq battery-mode-line-format " %p%% %t")
+  (setq battery-mode-line-format " [%p%% %t]")
   (display-battery-mode))
 
 ;; (with-eval-after-load 'fringe
 
 (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
 
 (with-eval-after-load 'ediff
   (setq ediff-window-setup-function 'ediff-setup-windows-plain
-        ediff-split-window-function 'split-window-horizontally)
-  (add-hook 'ediff-after-quit-hook-internal #'winner-undo))
+        ediff-split-window-function 'split-window-horizontally))
 
 (with-eval-after-load 'face-remap
   (setq
@@ -491,8 +502,14 @@ for all frames."
  (expand-file-name
   (convert-standard-filename "lisp") user-emacs-directory))
 
-(when (member (system-name) '("chaman"))
-  (require 'bandali-exwm))
+(when
+    (and
+     (display-graphic-p)
+     ;; we're not running in another WM/DE
+     (not (getenv "XDG_CURRENT_DESKTOP"))
+     (member (system-name) '("chaman" "langa")))
+  (require 'bandali-exwm)
+  (global-set-key (kbd "C-x b") #'exwm-workspace-switch-to-buffer))
 
 (require 'bandali-org)