summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2026-11-08 20:22:08 +0000
committerjao <jao@gnu.org>2026-11-08 20:22:08 +0000
commite1847dbdb4a65b356b0f00d30a05f190058042b4 (patch)
tree21b0fb8c5d27dbcb70c9ce2b0627049ab60a2ee9
parent2bc3dcee9eb5fba3c9bfa7587a0b76e2dbcb211a (diff)
downloadelibs-e1847dbdb4a65b356b0f00d30a05f190058042b4.tar.gz
elibs-e1847dbdb4a65b356b0f00d30a05f190058042b4.tar.bz2
jao-exwm clean-ups (setup functions)
-rw-r--r--lib/wm/jao-exwm.el46
1 files changed, 29 insertions, 17 deletions
diff --git a/lib/wm/jao-exwm.el b/lib/wm/jao-exwm.el
index 4b923cf..60eb72b 100644
--- a/lib/wm/jao-exwm.el
+++ b/lib/wm/jao-exwm.el
@@ -20,8 +20,9 @@
;;; Deps
(require 'browse-url)
(require 'exwm)
-(require 'jao-minibuffer)
(require 'jao-afio)
+(require 'jao-minibuffer)
+(require 'exwm-systemtray)
;;; Helpers
(defvar jao-exwm-use-afio t)
@@ -31,17 +32,16 @@
(exwm-input--fake-key k)))
;;; Minibuffer and system tray
-(setq jao-minibuffer-frame-width 271)
-(add-hook 'exwm-workspace-switch-hook #'jao-minibuffer-refresh)
-
-(require 'exwm-systemtray)
-(exwm-systemtray-mode 1)
-
(defun jao-exwm--watch-tray (_sym newval _op _where)
(setq jao-minibuffer-right-margin (/ newval (string-pixel-width "a")))
(jao-minibuffer-refresh))
-(add-variable-watcher 'exwm-systemtray-width #'jao-exwm--watch-tray)
+;;;###autoload
+(defun jao-exwm-set-up-minibuffer ()
+ ;; (setq jao-minibuffer-frame-width 271)
+ (add-hook 'exwm-workspace-switch-hook #'jao-minibuffer-refresh)
+ (exwm-systemtray-mode 1)
+ (add-variable-watcher 'exwm-systemtray-width #'jao-exwm--watch-tray))
;;; Buffers
(defvar-local jao-exwm--name nil)
@@ -105,10 +105,12 @@
(setq jao-exwm--name jao-exwm--current-name
jao-exwm--current-name nil)))
-(add-hook 'exwm-mode-hook 'jao-exwm--set-exwm-name)
-(add-hook 'exwm-update-class-hook 'jao-exwm-rename-buffer/class)
-(add-hook 'exwm-update-title-hook 'jao-minibuffer-refresh)
-(add-hook 'exwm-update-title-hook 'jao-exwm-rename-buffer/title)
+;;;###autoload
+(defun jao-exwm-set-up-buffer-handling ()
+ (add-hook 'exwm-mode-hook 'jao-exwm--set-exwm-name)
+ (add-hook 'exwm-update-class-hook 'jao-exwm-rename-buffer/class)
+ (add-hook 'exwm-update-title-hook 'jao-minibuffer-refresh)
+ (add-hook 'exwm-update-title-hook 'jao-exwm-rename-buffer/title))
;;; Float windows
(defvar jao-exwm-max-x (x-display-pixel-width))
@@ -140,19 +142,20 @@
((member exwm-class-name '("mpv" "vlc"))
(jao-exwm--center-float 1200))))
-(defvar jao-exwm-floating-classes '("mpv" "vlc"))
-(setq jao-exwm-floating-classes nil)
+(defvar jao-exwm-floating-classes nil)
(defun jao-exwm--maybe-float ()
(when (member exwm-class-name jao-exwm-floating-classes)
(when (not exwm--floating-frame)
(exwm-floating-toggle-floating))))
-(add-hook 'exwm-floating-setup-hook #'jao-exwm--setup-float)
-(add-hook 'exwm-manage-finish-hook #'jao-exwm--maybe-float)
+;;;###autoload
+(defun jao-exwm-set-up-float-windows (&optional floating-classes)
+ (setq jao-exwm-floating-classes floating-classes)
+ (add-hook 'exwm-floating-setup-hook #'jao-exwm--setup-float)
+ (add-hook 'exwm-manage-finish-hook #'jao-exwm--maybe-float))
;;; App runners
-;;; App runner helpers
(defun jao-exwm-run (command)
(interactive
(list (read-shell-command "$ "
@@ -204,6 +207,7 @@
(jao-exwm-firefox)
(apply #'browse-url-firefox args))
+;;;###autoload
(defun jao-exwm-kill-firefox-url ()
(interactive)
(when-let* ((b (jao-exwm-find-class-buffer "firefox")))
@@ -214,6 +218,7 @@
(prog1 (message "%s" (current-kill 1))
(switch-to-buffer cb)))))
+;;;###autoload
(defun jao-exwm-firefox-search (query)
(interactive "sQuery: ")
(jao-exwm-firefox)
@@ -224,5 +229,12 @@
(sit-for 0.2)
(exwm-input--fake-key ?\r))
+;;; set up
+;;;###autoload
+(defun jao-exwm-setup (&optional floating-classes)
+ (jao-exwm-set-up-minibuffer)
+ (jao-exwm-set-up-buffer-handling)
+ (jao-exwm-set-up-float-windows floating-classes))
+
(provide 'jao-exwm)
;;; jao-exwm.el ends here