Re: How can I start urxvt as fullscreen ?



Christopher Roy Bratusek <zanghar freenet de> writes:

> Hi Jeremy,
>
> this is the viewport-windows function from sawfish-mmc, perhaps you can
> merge both to get the best result :)
>
> Chris
>
> ========================================================================
>
>   (define (viewport-windows)
>     (let ((windows (managed-windows))
>           (workspace current-workspace))
>       (setq windows (delete-if (lambda (w)
>                                  (or (not (window-mapped-p w))
>                                      (window-get w 'ignored)
>                                         ;(and (not allow-iconified)
>                                      (window-get w 'iconified)
>                                      (not (window-appears-in-workspace-p
>                                            w workspace))))
>                       windows))
>       (setq windows (delete-if window-outside-viewport-p windows)))))

Hmm.  Besides that this handles ignored and unmapped windows, the
differences are that this one includes sticky-windows and excludes
iconified windows, whereas the one I wrote excludes sticky-windows
(contrary to what I thought when I was replying to Teika; evidently
window-in-workspace-p excludes them) and includes iconified windows.

Here's a version that lets you specify what you want:

(define (viewport-windows #!optional vp-col vp-row workspace
			  exclude-sticky exclude-iconified)
  "Provide a list of windows that are mapped to the specified
viewport."
  (let* ((cur-vp (screen-viewport))
	 (col (or vp-col (car cur-vp)))
	 (row (or vp-row (cdr cur-vp)))
	 (ws (or workspace current-workspace))
	 (width (screen-width))
	 (height (screen-height))
	 (left (+ (- viewport-x-offset) (* col width)))
	 (right (+ left (1- width)))
	 (top (+ (- viewport-y-offset) (* row height)))
	 (bottom (+ top (1- height))))
    (filter-windows (lambda (w)
		      (let ((pos (window-position w))
			    (dims (window-frame-dimensions w)))
			(and (window-mapped-p w)
			     (not (window-get w 'ignored))
			     (if exclude-sticky
				 (window-in-workspace-p w ws)
			       (window-appears-in-workspace-p w ws))
			     (not (and exclude-iconified
				       (window-get w 'iconified)))
			     (not (or (<= (+ (car pos) (car dims)) left)
				      (<= (+ (cdr pos) (cdr dims)) top)
				      (>= (car pos) right)
				      (>= (cdr pos) bottom)))))))))

The new-viewport setter will need to be modified; I can just resubmit
that patch once I've fixed it to handle the no-empty-viewport case...

-- 
Jeremy Hankins <nowan nowan org>
PGP fingerprint: 748F 4D16 538E 75D6 8333  9E10 D212 B5ED 37D0 0A03


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