Re: New questionnaire on your usage of Sawfish



Jeremy Hankins <nowan nowan org> writes:
> Timo Korvola <Timo Korvola iki fi> writes:
>> On Thursday 27 August 2009 21:20:48 Jeremy Hankins wrote:
>
>>> 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.
>>
>> You mean like (window-put w 'gravity 'south-west)?  The auto-gravity 
>> property is also sometimes handy and can be set by a window matcher.
>
> Hmm.  Yes, except that it also handles the initial placement.

So this comes close to accomplishing the same thing as the corner-window
business:

(add-window-matcher 'WM_CLASS "^Pager/pager$"
                    '(sticky-viewport . t)
                    '(gravity . south-east)
                    '(position . (-1 . -1)))

But, of course, the position isn't quite right -- it's mostly off the
screen, with only a pixel showing.  Shouldn't the position matcher
understand negative position numbers as referring to the right and/or
bottom of the window?  So something like (untested):

(define-match-window-setter 'position
    (lambda (w prop value)
      (declare (unused prop))
      (let ((x (car value))
-          (y (cdr value)))
+          (y (cdr value))
+          (size (window-frame-dimensions w)))
        (when (< x 0)
         ;; XXX should change placement gravity
-        (setq x (+ (screen-width) x)))
+        (setq x (+ (- (screen-width) (car size)) x)))
        (when (< y 0)
         ;; XXX should change placement gravity
-        (setq y (+ (screen-height) y)))
+        (setq y (+ (- (screen-height) (cdr size)) y)))
        (move-window-to w x y))))

It also seems natural to want to specify something like a -0 as a
position, but having a single pixel between the window and the corner
isn't a big deal.

An alternate approach would be to use the gravity to decide the 0,0
point for the initial placement.  I'd be happy to come up with a patch,
if desired.

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