stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] Another quick hack


From: Philippe Brochard
Subject: [STUMP] Another quick hack
Date: Mon, 06 Mar 2006 18:24:53 +0100
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Hi all,


I find useful to split frames with different ratio. So I've made those
split functions :

-- core.lisp ---------------------------------------------------------
(defun split-prop-frame-h (screen p prop1 prop2)
  "Return 2 new frames with proportions. The first one stealing P's number and 
window"
  (let* ((w1 (truncate (* prop1 (/ (frame-width p) (+ prop1 prop2)))))
         (w2 (truncate (* prop2 (/ (frame-width p) (+ prop1 prop2)))))
         (h (frame-height p))
         (f1 (make-frame :number (frame-number p)
                         :x (frame-x p)
                         :y (frame-y p)
                         :width w1
                         :height h
                         :window (frame-window p)))
         (f2 (make-frame :number (find-free-frame-number screen)
                         :x (+ (frame-x p) w1)
                         :y (frame-y p)
                         :width w2
                         :height h
                         :window nil)))
    (values f1 f2)))


(defun split-prop-frame-v (screen p prop1 prop2)
  "Return 2 new frames with proportions. The first one stealing P's number and 
window"
  (let* ((w (frame-width p))
         (h1 (truncate (* prop1 (/ (frame-height p) (+ prop1 prop2)))))
         (h2 (truncate (* prop2 (/ (frame-height p) (+ prop1 prop2)))))
         (f1 (make-frame :number (frame-number p)
                         :x (frame-x p)
                         :y (frame-y p)
                         :width w
                         :height h1
                         :window (frame-window p)))
         (f2 (make-frame :number (find-free-frame-number screen)
                         :x (frame-x p)
                         :y (+ (frame-y p) h1)
                         :width w
                         :height h2
                         :window nil)))
    (values f1 f2)))
----------------------------------------------------------------------


-- user.lisp ---------------------------------------------------------
(defun horiz-split-prop-frame (screen prop1 prop2)
  (split-frame screen (lambda (f) (split-prop-frame-h screen f prop1 prop2)))
  (show-frame-indicator screen))

(define-stumpwm-command "hpsplit" (screen (prop1 :number "Prop 1: ") (prop2 
:number "Prop 2: "))
  (horiz-split-prop-frame screen prop1 prop2))


(defun vert-split-prop-frame (screen prop1 prop2)
  (split-frame screen (lambda (f) (split-prop-frame-v screen f prop1 prop2)))
  (show-frame-indicator screen))

(define-stumpwm-command "vpsplit" (screen (prop1 :number "Prop 1: ") (prop2 
:number "Prop 2: "))
  (vert-split-prop-frame screen prop1 prop2))
----------------------------------------------------------------------



Now, the Gimp can be started with this layout:

command hpsplit prop1=1  prop2=4

---------
|G |    |
|  |    |   G: The Gimp toolbox
|--| W  |   C: Calque toolbox
|C |    |   W: Main window
|  |    |
---------



I hope that can be useful :)

Philippe



PS: What's the proposed way to post those hacks ? On the wiki or here
on the mailing list ?

And, have they to go in the cvs source or did I have to let them in my
~/.stumpwmrc ?

-- 
Philippe Brochard    <address@hidden>
                      http://hocwp.free.fr

-=-= http://www.gnu.org/home.fr.html =-=-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]