Re: New questionnaire on your usage of Sawfish



Christopher Roy Bratusek <zanghar freenet de> writes:
> Am Donnerstag, den 27.08.2009, 11:50 -0500 schrieb Jeremy Hankins:

>> I have a few other hacks:
>>  - a matcher to keep a window lined up with a corner
>
> hmm.. could you gimme a more detailed description of that?

Sure.  I can specify a corner that I want a window to be in -- e.g.,
lower-right.  Then it's kept in that spot even if it resizes.  It also
enforces viewport-sticky.  I use it for my pager; even if the pager
grows or shrinks (i.e., when using dynamic viewports) the pager stays
where it belongs.

It's short enough:

-----------------------------------
(define (corner-window-handler w)
  "Ensure that windows with the 'corner property set stay aligned in
the appropriate corner."
  (let* ((corner (window-get w 'corner))
         (size (window-frame-dimensions w))
         (position (window-position w))
         (target (cond ((eq corner 'upper-left)
                        '(0 . 0))
                       ((eq corner 'upper-right)
                        (cons (- (screen-width) (car size)) 0))
                       ((eq corner 'lower-left)
                        (cons 0 (- (screen-height) (cdr size))))
                       ((eq corner 'lower-right)
                        (cons (- (screen-width) (car size))
                              (- (screen-height) (cdr size))))
                       (t nil))))
    (when target
      (when (not (window-sticky-p/viewport w))
        (make-window-sticky/viewport w))
      (when (not (equal target position))
        (move-window-to w (car target) (cdr target))))))

(add-hook 'window-resized-hook corner-window-handler)
(add-hook 'map-notify-hook corner-window-handler)
-----------------------------------

-- 
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]