Add stuff for waybar

This commit is contained in:
2025-10-10 02:38:46 -07:00
parent a0c7697440
commit 12d8cc0e3e

12
init.el
View File

@ -585,6 +585,9 @@ printed representation (via `princ') set as the new value for the key."
(defun my/-set-eww-fcitx-state (enabled) (defun my/-set-eww-fcitx-state (enabled)
"Set the fcitx state for eww to ENABLED." "Set the fcitx state for eww to ENABLED."
(my/eww-update-variables "fcitx5-state" (if enabled 2 1))) (my/eww-update-variables "fcitx5-state" (if enabled 2 1)))
(defun my/-update-waybar-fcitx-state ()
"Update the waybar fcitx5 state."
(call-process "pkill" nil 0 nil "-RTMIN+1" "waybar"))
(defun my/global-toggle-mozc (&optional no-eww) (defun my/global-toggle-mozc (&optional no-eww)
"Toggle mozc for all buffers. "Toggle mozc for all buffers.
With NO-EWW, don't update eww's state." With NO-EWW, don't update eww's state."
@ -603,7 +606,8 @@ With NO-EWW, don't update eww's state."
(when (boundp 'evil-input-method) (when (boundp 'evil-input-method)
(setq-local evil-input-method nil))))) (setq-local evil-input-method nil)))))
(unless no-eww (unless no-eww
(my/-set-eww-fcitx-state activate))) (my/-set-eww-fcitx-state activate)
(my/-update-waybar-fcitx-state)))
(force-mode-line-update t))) (force-mode-line-update t)))
(keymap-global-set "C-\\" #'my/global-toggle-mozc) (keymap-global-set "C-\\" #'my/global-toggle-mozc)
(defun my/mozc-active-in-buffer-p (&optional buffer) (defun my/mozc-active-in-buffer-p (&optional buffer)
@ -3233,8 +3237,10 @@ The name is compared with the field name using TESTFN (defaults to `equal')."
(mu4e-context-switch nil "Personal") (mu4e-context-switch nil "Personal")
;; refresh the eww message count ;; refresh the eww message count
(defun my/-mu4e-eww-refresh-unread-count () (defun my/-mu4e-eww-refresh-unread-count ()
"Refresh the eww unread message count." "Refresh the eww unread message count.
(my/eww-poll-variables "mu4e")) This will also update waybar."
(my/eww-poll-variables "mu4e")
(call-process "pkill" nil 0 nil "-RTMIN+2" "waybar"))
(add-hook 'mu4e-message-changed-hook #'my/-mu4e-eww-refresh-unread-count) (add-hook 'mu4e-message-changed-hook #'my/-mu4e-eww-refresh-unread-count)
;; mu4e compose HTML messages ;; mu4e compose HTML messages