Skip to content

How to get sx.el inbox new message count in mode-line? #351

@stardiviner

Description

@stardiviner

I have a config as following:

;;; GitHub Notifications (Participating)
(use-package ghub+
  :ensure t
  :config
  (defvar github-notifications-number nil)
  (defun github-notifications ()
    (setq github-notifications-number
          (length
           ;; check out documentation of `ghubp-get-notifications'.
           (ghubp-get-notifications :participating "true") ; from package `ghub+'.
           ;; (ghub-get "/notifications" '((:participating . "true")))
           ;; (ghub-get "/notifications")
           )))
  (run-with-timer 10 600 'github-notifications)
  (defun *github-notifications ()
    (if (and (active) (> github-notifications-number 0))
        (propertize
         (concat
          (all-the-icons-faicon "github" :v-adjust 0.05)
          (format " %s " github-notifications-number))
         'face 'mode-line-data-face)))
  (defun github-open-notifications-participating ()
    "Open GitHub Notifications/Participating page."
    (interactive)
    (browse-url "https://github.com/notifications/participating"))
  (unless (boundp 'prog-vcs-prefix)
    (define-prefix-command 'prog-vcs-prefix))
  (define-key prog-vcs-prefix (kbd "N") 'github-open-notifications-participating)
  )

I use function *github-notifications in my custom mode-line-format to show GitHub notifications.
How can I do this for sx.el?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions