[Sawfish] Nudge, nudge

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


There are some times (e.g., Zooming on multiple monitors) when I want to fine-tune window positions. No worries; this is why I run Sawfish! So I wrote a bit of simple code:

;
; Functions to increment window positions
;
(defun increment-window-position (w x y)
 "Increment a window's position by an arbitrary amount"
 (move-window-to w
                 (+ (car (window-position w)) x)
                 (+ (cdr (window-position w)) y)))

(defun nudge-window-right (w) (increment-window-position w 1 0))
(defun nudge-window-left (w) (increment-window-position w -1 0))
(defun nudge-window-up (w) (increment-window-position w 0 -1))
(defun nudge-window-down (w) (increment-window-position w 0 1))
(define-command 'nudge-window-right nudge-window-right #:spec "%W")
(define-command 'nudge-window-left nudge-window-left #:spec "%W")
(define-command 'nudge-window-up nudge-window-up #:spec "%W")
(define-command 'nudge-window-down nudge-window-down #:spec "%W")

Easy peasy! And when I invoke them from sawfish-client, they work like a champ. But...

My first attempt was to bind the nudge commands to the arrow keys in the title bar. But AFAICT Sawfish doesn't capture title-bar keystrokes. Rats.

So my second attempt was to create a modified window-ops-menu with the following extra entries:

   (,(_ "Nudge")
    (,(_ "Left") nudge-window-left)
    (,(_ "Right") nudge-window-right)
    (,(_ "Up") nudge-window-up)
    (,(_ "Down") nudge-window-down))

That's a bit clumsier, but I'm only moving things by a pixel or two so it's tolerable. And it works, except...

For reasons I totally don't understand, the left/right entries work but the up/down ones don't. The corresponding commands work just fine if I invoke them from sawfish-client.

Anybody have an idea why the horizontal commands work and the vertical ones don't? And does anybody have suggestions about where I might modify the code so that it's possible to add key bindings to the title bar?
--
Geoff Kuenning geoff@xxxxxxxxxx http://www.cs.hmc.edu/~geoff/

"There's a true schizophrenia where if you say to voters, you know, do you think the federal government spends too much money and they should spend less, they say yeah, absolutely. Then you name specific things, like Pell grants for students and they say, no, not that. How 'bout NIH, medical research funding? Nah, you really shouldn't cut that. And pretty soon you've proved that what the American public is against
is arithmetic."
	-- Bill Gates, March 10, 2011

--
Sawfish ML


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/