emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/swsw 63e295f599 025/146: Add a user option to customize th


From: ELPA Syncer
Subject: [nongnu] elpa/swsw 63e295f599 025/146: Add a user option to customize the scope of window tracking
Date: Wed, 25 May 2022 02:59:40 -0400 (EDT)

branch: elpa/swsw
commit 63e295f599e304c96e66d1316c85a480f2cb21a1
Author: Daniel Semyonov <cmstr@dsemy.com>
Commit: Daniel Semyonov <cmstr@dsemy.com>

    Add a user option to customize the scope of window tracking
    
    * swsw.el (swsw-scope): Add user option to control the scope of window
    tracking.
    (swsw--get-id-length, swsw-update): Use 'swsw-scope' to determine
    tracked windows.
---
 swsw.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/swsw.el b/swsw.el
index ac73979542..421dce92c7 100644
--- a/swsw.el
+++ b/swsw.el
@@ -46,6 +46,18 @@
   :group 'swsw
   :type '(character))
 
+(defcustom swsw-scope t
+  "Scope of all window operations.
+t means consider all windows on all existing frames.
+0 (the number zero) means consider all windows on all visible and iconified
+frames.
+‘visible’ means consider all windows on all visible frames."
+  :group 'swsw
+  :type '(radio (const :tag "All windows on all frames" t)
+                (const
+                 :tag "All windows on all visible and iconified frames." 0)
+                (const :tag "All windows on all visible frames" 'visible)))
+
 (defun swsw--set-display-function (sym fun)
   "Call the previous display function with nil as the sole argument (turning
 it off), set SYM's value to FUN, and call FUN with t as the sole argument."
@@ -92,7 +104,7 @@ If set to `lighter', use the mode line lighter of 
`swsw-mode'"
 
 (defun swsw--get-id-length ()
   "Return the current length of a window ID."
-  (let* ((windows (length (window-list-1)))
+  (let* ((windows (length (window-list-1 nil nil swsw-scope)))
          (chars (length swsw-id-chars))
          (div (/ windows chars)))
     ;; Check the remainder to returning a longer length than necessary.
@@ -109,7 +121,7 @@ If set to `lighter', use the mode line lighter of 
`swsw-mode'"
                      (push swsw-id-chars char-lists)
                      (setq acc (1+ acc)))
                    (apply #'swsw--get-possible-ids char-lists)))
-  (walk-windows #'swsw-update-window nil t))
+  (walk-windows #'swsw-update-window nil swsw-scope))
 
 (defun swsw-update-window (window)
   "Update information for WINDOW."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]