Removing currently focused window/frame from frame list

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Removing currently focused window/frame from frame list

Burton Samograd
Hello,

I'm looking for a feature that would allow me to remove the currently
focused window/frame from the frame list (or whatever list is used when
calling the "fprev" and "fnext").  I thought I would ask here to see if
anybody has anything that does that, if not I'll atttempt to write it
myself.

--
Burton Samograd
http://kruhft.dyndns.org


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Removing currently focused window/frame from frame list

Burton Samograd
Burton Samograd <[hidden email]> writes:
> I'm looking for a feature that would allow me to remove the currently
> focused window/frame from the frame list (or whatever list is used when
> calling the "fprev" and "fnext").  I thought I would ask here to see if
> anybody has anything that does that, if not I'll atttempt to write it
> myself.

The below code is for adding and removing frames from fnext (and fprev
if you have it defined like I do).  This binds Prefix-'-' and Prefix-'+'
to remove and add frames to the skip list.

(in-package :stumpwm)
(defparameter *focus-frame-skip-list* '())
(defun focus-frame-after (group frames)
  "Given a list of frames focus the next one in the list after
the current frame, except for those in *focus-frame-skip-list*."
  (let ((next-frame (tile-group-current-frame group)))
    (do ((rest (cdr (member next-frame frames :test 'eq))
               (cdr (member next-frame frames :test 'eq)))
         (frames-left (length frames) (1- frames-left)))
        (nil)
      (setf next-frame (if rest (car rest) (car frames)))
      (unless (member next-frame *focus-frame-skip-list*)
        (return))
      (when (= frames-left 0) ; stop inifinite cycle
        (setf next-frame nil)
        (return)))
    (when next-frame
      (focus-frame group next-frame))))

(defun focus-skip-current-frame (group)
  (push (tile-group-current-frame group) *focus-frame-skip-list*))
 
(defun focus-unskip-current-frame (group)
  (setf *focus-frame-skip-list* (remove (tile-group-current-frame group)
  *focus-frame-skip-list*)))
 
(defcommand (fskip tile-group) () ()
            "Put the current frame into the fnext/fprev skip list."
            (focus-skip-current-frame (current-group)))
           
(defcommand (funskip tile-group) () ()
            "Take the current frame out of the fnext/fprev skip list."
            (focus-unskip-current-frame (current-group)))
           
(define-key *root-map* (kbd "-") "fskip")
(define-key *root-map* (kbd "+") "funskip")

--
Burton Samograd
http://kruhft.dyndns.org


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel