From e497aeccae2a50b4ac736d7a3b96993738344af6 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 26 Jul 2023 00:35:27 -0700 Subject: [oni-circe] Disable sending tracking to polybar I'm not using polybar anymore. --- oni-circe.el | 93 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 47 insertions(+), 46 deletions(-) (limited to 'oni-circe.el') diff --git a/oni-circe.el b/oni-circe.el index b898812..1d14742 100644 --- a/oni-circe.el +++ b/oni-circe.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2023.0717.113326 +;; Version: 2023.0725.143552 ;; Package-Requires: (circe oni-lui circe-serenity olivetti) ;; This program is free software; you can redistribute it and/or modify @@ -108,54 +108,55 @@ which may be encrypted." ;; with me from when I was using mowedline. I've adapted the code to work for ;; polybar instead and renamed all of the functions. -(defvar oni-circe-tracking-buffers nil) -(defvar oni-circe-tracking-timer nil) - -(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 ""))) - -(defun oni-circe-update-polybar () - "Send a command to Polybar to update my Circe widget." - (setq oni-circe-tracking-timer nil) - (shell-command (format "polybar-msg action circe send %s" - (shell-quote-argument - (if (stringp oni-circe-tracking-buffers) - (oni-circe-colorize oni-circe-tracking-buffers) - (mapconcat #'oni-circe-colorize oni-circe-tracking-buffers)))))) - -(defun oni-circe-tracking-clear () - (shell-command "polybar-msg action circe send \"\"")) ; - -(defun oni-circe-polybar-tracking (orig-fun &rest args) - "Update my external status bar when tracking computes a new status line. - -Also suppress tracking in the mode-line. Since tracking-status -may be called many times in quick succession, for example on a -make-frame-visible event, we use a short timer to only call the -updater once within a minimum duration." - (setq oni-circe-tracking-buffers (apply orig-fun args)) - (when oni-circe-tracking-timer - (cancel-timer oni-circe-tracking-timer)) - (setq oni-circe-tracking-timer - (run-at-time 0.2 nil #'oni-circe-update-polybar)) - nil) - -(advice-add 'tracking-status :around #'oni-circe-polybar-tracking) +;; (defvar oni-circe-tracking-buffers nil) +;; (defvar oni-circe-tracking-timer nil) + +;; (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 ""))) + +;; (defun oni-circe-update-polybar () +;; "Send a command to Polybar to update my Circe widget." +;; (setq oni-circe-tracking-timer nil) +;; (shell-command (format "polybar-msg action circe send %s" +;; (shell-quote-argument +;; (if (stringp oni-circe-tracking-buffers) +;; (oni-circe-colorize oni-circe-tracking-buffers) +;; (mapconcat #'oni-circe-colorize oni-circe-tracking-buffers)))))) + +;; (defun oni-circe-tracking-clear () +;; (shell-command "polybar-msg action circe send \"\"")) ; + +;; (defun oni-circe-polybar-tracking (orig-fun &rest args) +;; "Update my external status bar when tracking computes a new status line. + +;; Also suppress tracking in the mode-line. Since tracking-status +;; may be called many times in quick succession, for example on a +;; make-frame-visible event, we use a short timer to only call the +;; updater once within a minimum duration." +;; (setq oni-circe-tracking-buffers (apply orig-fun args)) +;; (when oni-circe-tracking-timer +;; (cancel-timer oni-circe-tracking-timer)) +;; (setq oni-circe-tracking-timer +;; (run-at-time 0.2 nil #'oni-circe-update-polybar)) +;; nil) + +;; (advice-add 'tracking-status :around #'oni-circe-polybar-tracking) +;; (advice-remove 'tracking-status #'oni-circe-polybar-tracking) (add-hook 'circe-channel-mode-hook 'olivetti-mode) -(add-hook 'kill-emacs-hook 'oni-circe-tracking-clear) +;; (add-hook 'kill-emacs-hook 'oni-circe-tracking-clear) (provide 'oni-circe) ;;; oni-circe.el ends here -- cgit v1.2.3-54-g00ecf