[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [STUMP] Removing currently focused window/frame from frame list
From: |
Burton Samograd |
Subject: |
Re: [STUMP] Removing currently focused window/frame from frame list |
Date: |
Wed, 18 Jan 2012 10:16:25 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
Burton Samograd <address@hidden> 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