Add *media-info modeline segment for image buffers
This commit is contained in:
parent
b0cc7d2f75
commit
0903dfa0c8
1 changed files with 17 additions and 5 deletions
|
@ -376,6 +376,11 @@ lines are selected, or the NxM dimensions of a block selection."
|
||||||
length))
|
length))
|
||||||
'face (if active 'doom-modeline-panel 'mode-line-inactive))))
|
'face (if active 'doom-modeline-panel 'mode-line-inactive))))
|
||||||
|
|
||||||
|
(defun *media-info ()
|
||||||
|
(cond ((eq major-mode 'image-mode)
|
||||||
|
(let ((size (image-size (image-get-display-property) :pixels)))
|
||||||
|
(format " %dx%d " (car size) (cdr size))))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun doom-modeline (&optional id)
|
(defun doom-modeline (&optional id)
|
||||||
|
@ -394,17 +399,24 @@ lines are selected, or the NxM dimensions of a block selection."
|
||||||
,(if (eq id 'scratch)
|
,(if (eq id 'scratch)
|
||||||
'(*buffer-project)
|
'(*buffer-project)
|
||||||
'(*buffer-info))
|
'(*buffer-info))
|
||||||
(*selection-info)
|
,(if (eq id 'media)
|
||||||
(*flycheck)))
|
'(*media-info)
|
||||||
(rhs (list (*buffer-encoding)
|
'(list " %l:%c %p "
|
||||||
(*vc)
|
(*selection-info)
|
||||||
|
(*flycheck)))))
|
||||||
|
(rhs (list ,(unless (eq id 'media)
|
||||||
|
'(list (*buffer-encoding)
|
||||||
|
(*vc)))
|
||||||
(*major-mode)))
|
(*major-mode)))
|
||||||
(mid (propertize
|
(mid (propertize
|
||||||
" " 'display `((space :align-to (- (+ right right-fringe right-margin)
|
" " 'display `((space :align-to (- (+ right right-fringe right-margin)
|
||||||
,(+ 1 (string-width (format-mode-line rhs)))))))))
|
,(+ 1 (string-width (format-mode-line rhs)))))))))
|
||||||
(list lhs mid rhs))))
|
(list lhs mid rhs))))
|
||||||
|
|
||||||
(setq-default mode-line-format (doom-modeline))
|
(setq mode-line-format (doom-modeline))
|
||||||
|
|
||||||
|
(add-hook! image-mode
|
||||||
|
(setq mode-line-format (doom-modeline 'media)))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue