Viewport boundary mode (code for your .sawfishrc)



Hi all,

We have a workspace-boundary-mode, but not a viewport-boundary-mode.

So I started to search the web for a code-snippet. And I've found one.

you can set it to stop (normal behaviour) or to wrap-around.

the later means, if you reach the end of a column or row you'll get back
to the beginning of the same row/column and vice versa.

simply copy that code to your ~/.sawfishrc (some might use ~/sawfish/rc instead):

; add viewport-boundary-mode

(defvar viewport-boundary-mode 'wrap-around) ;; stop or wrap-around
(eval-in
'(define (set-screen-viewport col row)
   (when (eq viewport-boundary-mode 'wrap-around)
     (setq col (mod col (car viewport-dimensions))
           row (mod row (cdr viewport-dimensions))))
   (when (and (>= col 0) (< col (car viewport-dimensions))
              (>= row 0) (< row (cdr viewport-dimensions)))
     (set-viewport (* col (screen-width))
                   (* row (screen-height)))
     t))
'sawfish.wm.viewport)


Have Fun!

Chris


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