mirror of
https://github.com/SqrtMinusOne/exwm-modeline.git
synced 2025-12-10 14:35:14 +03:00
feat: randr support
This commit is contained in:
parent
d3890fc842
commit
2b84bfef31
1 changed files with 29 additions and 9 deletions
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
;;; Code
|
;;; Code
|
||||||
(require 'exwm-workspace)
|
(require 'exwm-workspace)
|
||||||
|
(require 'exwm-manage)
|
||||||
|
|
||||||
(defgroup exwm-modeline nil
|
(defgroup exwm-modeline nil
|
||||||
"A modeline segment to show EXWM workspaces"
|
"A modeline segment to show EXWM workspaces"
|
||||||
|
|
@ -53,6 +54,11 @@ TODO."
|
||||||
:group 'exwm-modeline
|
:group 'exwm-modeline
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
|
(defcustom exwm-modeline-randr nil
|
||||||
|
"TODO."
|
||||||
|
:group 'exwm-modeline
|
||||||
|
:type 'boolean)
|
||||||
|
|
||||||
(defface exwm-modeline-current-workspace
|
(defface exwm-modeline-current-workspace
|
||||||
'((t (:inherit warning :weight bold)))
|
'((t (:inherit warning :weight bold)))
|
||||||
"Face for the current workspace."
|
"Face for the current workspace."
|
||||||
|
|
@ -96,12 +102,12 @@ TODO."
|
||||||
(define-key map [mode-line mouse-1] #'exwm-modeline--click)
|
(define-key map [mode-line mouse-1] #'exwm-modeline--click)
|
||||||
map))
|
map))
|
||||||
|
|
||||||
(defun exwm-modeline--format-list (workspace-list index-list)
|
(defun exwm-modeline--format-list (workspace-list)
|
||||||
"Format the modestring for the current frame."
|
"Format the modestring for the current frame."
|
||||||
(cl-loop for index in index-list
|
(cl-loop for frame in workspace-list
|
||||||
for frame in workspace-list
|
|
||||||
for i from 0 to (length workspace-list)
|
for i from 0 to (length workspace-list)
|
||||||
for workspace-name = (funcall exwm-workspace-index-map index)
|
for workspace-name = (funcall exwm-workspace-index-map
|
||||||
|
(exwm-workspace--position frame))
|
||||||
with current-frame = (selected-frame)
|
with current-frame = (selected-frame)
|
||||||
if (= i 0) collect (nth 0 exwm-modeline-dividers)
|
if (= i 0) collect (nth 0 exwm-modeline-dividers)
|
||||||
collect
|
collect
|
||||||
|
|
@ -122,13 +128,27 @@ TODO."
|
||||||
collect (nth 1 exwm-modeline-dividers)
|
collect (nth 1 exwm-modeline-dividers)
|
||||||
else collect (nth 2 exwm-modeline-dividers)))
|
else collect (nth 2 exwm-modeline-dividers)))
|
||||||
|
|
||||||
|
(defun exwm-modeline--randr-workspaces ()
|
||||||
|
(if-let ((monitor (plist-get exwm-randr-workspace-output-plist
|
||||||
|
(cl-position (selected-frame)
|
||||||
|
exwm-workspace--list))))
|
||||||
|
(cl-loop for (key value) on exwm-randr-workspace-output-plist by 'cddr
|
||||||
|
if (string-equal value monitor)
|
||||||
|
collect (nth key exwm-workspace--list))
|
||||||
|
(cl-loop with indices = (cl-loop
|
||||||
|
for (key value) on exwm-randr-workspace-output-plist
|
||||||
|
by 'cddr collect key)
|
||||||
|
for i from 0 to (1- (length exwm-workspace--list))
|
||||||
|
for frame in exwm-workspace--list
|
||||||
|
unless (member i indices)
|
||||||
|
collect frame)))
|
||||||
|
|
||||||
(defun exwm-modeline--format ()
|
(defun exwm-modeline--format ()
|
||||||
(exwm-modeline--format-list
|
(exwm-modeline--format-list
|
||||||
(if exwm-modeline-short (list (selected-frame))
|
(cond ((or exwm-modeline-short exwm--floating-frame)
|
||||||
exwm-workspace--list)
|
(list (selected-frame)))
|
||||||
(if exwm-modeline-short (list exwm-workspace-current-index)
|
(exwm-modeline-randr (exwm-modeline--randr-workspaces))
|
||||||
(cl-loop for i from 0 to (1- (length exwm-workspace--list))
|
(t exwm-workspace--list))))
|
||||||
collect i))))
|
|
||||||
|
|
||||||
(defun exwm-modeline-update ()
|
(defun exwm-modeline-update ()
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue