[oni-circe] Show channel status in polybar
I don't like that this global status thing shows up everywhere on the mode line, which is already quite full with minor modes and the like. This way it's only ever in one place.
This commit is contained in:
parent
c7e5178a36
commit
375120e2dd
1 changed files with 40 additions and 39 deletions
79
oni-circe.el
79
oni-circe.el
|
@ -95,51 +95,52 @@ which may be encrypted."
|
||||||
(enable-circe-color-nicks)
|
(enable-circe-color-nicks)
|
||||||
(enable-circe-serenity)
|
(enable-circe-serenity)
|
||||||
|
|
||||||
;; (require 'mowedline)
|
;;; Polybar
|
||||||
|
;; This was originally written by retroj in his own configuration and shared
|
||||||
|
;; with me from when I was using mowedline. I've adapted the code to work for
|
||||||
|
;; polybar instead and renamed all of the functions.
|
||||||
|
|
||||||
;; (defun mowedline-colorize-mode-line-spec (s)
|
(defvar oni-circe-tracking-buffers nil)
|
||||||
;; (cond
|
(defvar oni-circe-tracking-timer nil)
|
||||||
;; ((stringp s) (string-trim s))
|
|
||||||
;; ((eq ':propertize (car s))
|
|
||||||
;; (let ((s (cadr s))
|
|
||||||
;; (face (plist-get (cddr s) 'face)))
|
|
||||||
;; (if face
|
|
||||||
;; `(color ,(face-foreground face)
|
|
||||||
;; ,(substring-no-properties s))
|
|
||||||
;; s)))
|
|
||||||
;; (t "")))
|
|
||||||
|
|
||||||
;; (setq mowedline-update-function 'mowedline-update/dbus)
|
(defun oni-circe-colorize (s)
|
||||||
|
"Turn any color description of S into one that Polybar understands."
|
||||||
|
(cond
|
||||||
|
((stringp s) (string-trim s))
|
||||||
|
((eq ':propertize (car s))
|
||||||
|
(let ((s (cadr s))
|
||||||
|
(face (plist-get (cddr s) 'face)))
|
||||||
|
(if face
|
||||||
|
(format "%%{F%s}%s%%{F-}"
|
||||||
|
(face-foreground face)
|
||||||
|
(substring-no-properties s))
|
||||||
|
s)))
|
||||||
|
(t "")))
|
||||||
|
|
||||||
;; (defvar jjf-tracking-buffers '())
|
(defun oni-circe-update-polybar ()
|
||||||
;; (defvar jjf-external-tracking-timer nil)
|
"Send a command to Polybar to update my Circe widget."
|
||||||
;; (defun jjf-external-tracking ()
|
(setq oni-circe-tracking-timer nil)
|
||||||
;; (setq jjf-external-tracking-timer nil)
|
(shell-command (format "polybar-msg action circe send %s"
|
||||||
;; (mowedline-update
|
(shell-quote-argument
|
||||||
;; 'irc
|
(if (stringp oni-circe-tracking-buffers)
|
||||||
;; (if (stringp jjf-tracking-buffers)
|
(oni-circe-colorize oni-circe-tracking-buffers)
|
||||||
;; (mowedline-colorize jjf-tracking-buffers t)
|
(mapconcat #'oni-circe-colorize oni-circe-tracking-buffers))))))
|
||||||
;; (format "%S" (mapcar #'mowedline-colorize-mode-line-spec
|
|
||||||
;; jjf-tracking-buffers)))))
|
|
||||||
|
|
||||||
;; (defun oni:clear-irc-mowedline-widget ()
|
(defun oni-circe-polybar-tracking (orig-fun &rest args)
|
||||||
;; (mowedline-clear 'irc))
|
"Update my external status bar when tracking computes a new status line.
|
||||||
|
|
||||||
;; (defun jjf-external-tracking-advice (orig-fun &rest args)
|
Also suppress tracking in the mode-line. Since tracking-status
|
||||||
;; "Update my external status bar when tracking computes a new
|
may be called many times in quick succession, for example on a
|
||||||
;; status line, and suppress tracking in the mode-line. Since
|
make-frame-visible event, we use a short timer to only call the
|
||||||
;; tracking-status may be called many times in quick succession, for
|
updater once within a minimum duration."
|
||||||
;; example on a make-frame-visible event, we use a short timer to
|
(setq oni-circe-tracking-buffers (apply orig-fun args))
|
||||||
;; only call the updater once within a minimum duration."
|
(when oni-circe-tracking-timer
|
||||||
;; (setq jjf-tracking-buffers (apply orig-fun args))
|
(cancel-timer oni-circe-tracking-timer))
|
||||||
;; (when jjf-external-tracking-timer
|
(setq oni-circe-tracking-timer
|
||||||
;; (cancel-timer jjf-external-tracking-timer))
|
(run-at-time 0.2 nil #'oni-circe-update-polybar))
|
||||||
;; (setq jjf-external-tracking-timer
|
nil)
|
||||||
;; (run-at-time 0.2 nil 'jjf-external-tracking))
|
|
||||||
;; nil)
|
|
||||||
|
|
||||||
;;(advice-add 'tracking-status :around #'jjf-external-tracking-advice)
|
(advice-add 'tracking-status :around #'oni-circe-polybar-tracking)
|
||||||
;;(add-hook 'kill-emacs-hook 'oni:clear-irc-mowedline-widget)
|
|
||||||
|
|
||||||
(add-hook 'circe-channel-mode-hook 'olivetti-mode)
|
(add-hook 'circe-channel-mode-hook 'olivetti-mode)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue