Advertisement
mark-naylor-1701

stumpwm : grenumber

Jul 24th, 2024 (edited)
516
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.86 KB | None | 0 0
  1. ;; Extension code for the Stump Window Manager
  2. ;; https://stumpwm.github.io/
  3.  
  4. (defcommand grenumber (new-number &optional (screen (current-screen))) ((:number "Number: "))
  5.   "Change the current group's number to the specified number. If another group
  6. is using the number, then the groups swap numbers. Defaults to current screen."
  7.   (let* ((this-group (current-group screen))
  8.          (current-number (group-number this-group))
  9.          (other-group (find-if
  10.                        #'(lambda (grp) (= (group-number grp) new-number))
  11.                        (screen-groups screen))))
  12.     ;; If another group has the new number, change it to the number of the
  13.     ;; current group.
  14.     (when other-group
  15.       (setf (group-number other-group) current-number))
  16.     ;; Now, set the current group to the new number.
  17.     (setf (group-number this-group) new-number)))
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement