From 74a8eadabaed64ea627fd3341ee9379dfa53e5c0 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 7 Jan 2015 02:37:49 +0100 Subject: Update the awesome modeline after closing a group --- emacs/.emacs.d/init.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'emacs') diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index d04469f..3ae1e5c 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -156,6 +156,25 @@ MODE1 is enabled and vice-versa." (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 () "Function for `before-save-hook'." (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 'write-file-hooks 'oni:write-file-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 'perl-mode-hook 'rst-mode-hook 'rust-mode-hook 'sh-mode-hook -- cgit v1.2.3-54-g00ecf