Update the awesome modeline after closing a group

This commit is contained in:
Tom Willemse 2015-01-07 02:37:49 +01:00
parent c5844963d2
commit 74a8eadaba

View file

@ -156,6 +156,25 @@ MODE1 is enabled and vice-versa."
(and "MariaDB [" (1+ nonl) "]")) (and "MariaDB [" (1+ nonl) "]"))
"> "))))) "> ")))))
(defun awesome-send (command)
"Send COMMAND through awesome-client to awesome."
(shell-command (format "echo '%s' | awesome-client" command)))
(defun awesome-update-mailbox (gnus-group)
"Update mailcount widget for GNUS-GROUP.
But only if it is a maildir inbox."
(let ((name (and
(string-match "^nnmaildir\\+\\(.*\\):inbox$" gnus-group)
(match-string 1 gnus-group))))
(when name
(awesome-send (format "mailwidgets.%s:set_mailcount()" name)))))
(defun awesome-update-current-mailbox ()
"Update mailcount widget for current gnus group."
(when (and (boundp 'gnus-newsgroup-name) gnus-newsgroup-name)
(awesome-update-mailbox gnus-newsgroup-name)))
(defun oni:before-save-func () (defun oni:before-save-func ()
"Function for `before-save-hook'." "Function for `before-save-hook'."
(if (eq major-mode 'html-mode) (if (eq major-mode 'html-mode)
@ -1267,6 +1286,7 @@ from myaethon2.core.decorators import (
(add-hook 'vala-mode-hook #'oni:vala-mode-func) (add-hook 'vala-mode-hook #'oni:vala-mode-func)
(add-hook 'write-file-hooks 'oni:write-file-func) (add-hook 'write-file-hooks 'oni:write-file-func)
(add-hook 'yas-global-mode-hook 'oni:yas-minor-mode-func) (add-hook 'yas-global-mode-hook 'oni:yas-minor-mode-func)
(add-hook 'gnus-exit-group-hook 'awesome-update-current-mailbox)
(oni:add-function-to-hooks #'flycheck-mode (oni:add-function-to-hooks #'flycheck-mode
'perl-mode-hook 'rst-mode-hook 'rust-mode-hook 'sh-mode-hook 'perl-mode-hook 'rst-mode-hook 'rust-mode-hook 'sh-mode-hook