Skip to content

momomo5717/emms-mode-line-cycle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

http://melpa.org/packages/emms-mode-line-cycle-badge.svg http://stable.melpa.org/packages/emms-mode-line-cycle-badge.svg

emms-mode-line-cycle

This package is a minor mode for updating emms-mode-line-string cyclically within specified width with emms-playing-time-display.

It is useful for long track titles.

image.gif

Requirements

  • GNU Emacs 24 or later
  • EMMS 4.0 or later

Tested with GNU Emacs 24.5 (emacs-mac-app @5.9_0), EMMS 4.0

Setup

(add-to-list 'load-path "/path/to/emms-mode-line-cycle")
(require 'emms-mode-line-cycle)

(emms-mode-line 1)
(emms-playing-time 1)

;; `emms-mode-line-cycle' can be used with emms-mode-line-icon.
(require 'emms-mode-line-icon)
(custom-set-variables '(emms-mode-line-cycle-use-icon-p t))

(emms-mode-line-cycle 1)

Customization

User Option: emms-mode-line-cycle-max-width

Default value is 16. The width of emms-mode-line-format isn’t included.

User Option: emms-mode-line-cycle-any-width-p

Default value is nil. If it is non-nil, the title is rotated which is less than emms-mode-line-cycle-max-width.

User Option: emms-mode-line-cycle-additional-space-num

Default value is 2. It is the number of space characters to add them to the current title.

User Option: emms-mode-line-cycle-use-icon-p

If it is no-nil, emms-mode-line-icon-image-cache is used like emms-mode-line-icon-function.

This feature requires (require 'emms-mode-line-icon) before (emms-mode-line-cycle 1)

User Option: emms-mode-line-cycle-current-title-function

This is used for getting the current track title before applying it to emms-mode-line-format.

Default value is as follows like emms-mode-line-playlist-current.

(lambda () (emms-track-description (emms-playlist-current-selected-track)))

User Option: emms-mode-line-cycle-velocity

Number of characters per emms-mode-line-cycle-update-mode-line-string.

Default value is 1.

Function: emms-mode-line-cycle-get-title &optional n

This function returns a displayed title which is updated n times.

If n is nil, n is set to 0.

A config example

(require 'emms-mode-line-icon)

(emms-mode-line-cycle 1)

(custom-set-variables
 '(emms-mode-line-cycle-max-width 15)
 '(emms-mode-line-cycle-additional-space-num 4)
 '(emms-mode-line-cycle-use-icon-p t)
 '(emms-mode-line-format " [%s]")
 '(emms-mode-line-cycle-any-width-p t)
 '(emms-mode-line-cycle-velocity 2)
 '(emms-mode-line-cycle-current-title-function
   (lambda ()
     (let ((track (emms-playlist-current-selected-track)))
       (cl-case (emms-track-type track)
         ((streamlist)
          (let ((stream-name (emms-stream-name
                              (emms-track-get track 'metadata))))
            (if stream-name stream-name (emms-track-description track))))
         ((url) (emms-track-description track))
         (t (file-name-nondirectory
             (emms-track-description track)))))))
 '(emms-mode-line-titlebar-function
   (lambda ()
     '(:eval
       (when emms-player-playing-p
         (format " %s %s"
                 (format emms-mode-line-format (emms-mode-line-cycle-get-title))
                 emms-playing-time-string))))))

About

Display the emms mode line as a ticker

Resources

Stars

Watchers

Forks

Packages

No packages published