[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[STUMP] add ratio to split-frame
From: |
Greg Pfeil |
Subject: |
[STUMP] add ratio to split-frame |
Date: |
Wed, 02 Jul 2008 17:48:22 -0400 |
User-agent: |
Thunderbird 2.0.0.0 (X11/20070426) |
Here's a small patch that lets you specify a ratio for split-frame. EG:
(split-frame group frame) ; defaults to 1/2
---------------------
| | |
| | |
| | |
---------------------
(split-frame group frame 1/4)
---------------------
| | |
| | |
| | |
---------------------
In my usual waffling way, I don't know if it's best to specify the ratio of one subframe to the
whole, or the ratio of the two subframes. This patch does the former. If the ratio is greater than 1
... *shrug*
diff -b -ur /home/gpfeil/Documents/sources/stumpwm-0.9.3/frame.lisp
/home/gpfeil/Documents/sources/stumpwm-0.9.3-patched/frame.lisp
--- /home/gpfeil/Documents/sources/stumpwm-0.9.3/frame.lisp 2008-06-20
22:44:35.000000000 -0400
+++ /home/gpfeil/Documents/sources/stumpwm-0.9.3-patched/frame.lisp
2008-07-02 17:37:09.353132000 -0400
@@ -170,9 +170,9 @@
(when win
(setf (window-frame win) frame))))
-(defun split-frame-h (group p)
+(defun split-frame-h (group p ratio)
"Return 2 new frames. The first one stealing P's number and window"
- (let* ((w (truncate (/ (frame-width p) 2)))
+ (let* ((w (truncate (* (frame-width p) ratio)))
(h (frame-height p))
(f1 (make-frame :number (frame-number p)
:x (frame-x p)
@@ -190,10 +190,10 @@
(run-hook-with-args *new-frame-hook* f2)
(values f1 f2)))
-(defun split-frame-v (group p)
+(defun split-frame-v (group p ratio)
"Return 2 new frames. The first one stealing P's number and window"
(let* ((w (frame-width p))
- (h (truncate (/ (frame-height p) 2)))
+ (h (truncate (* (frame-height p) ratio)))
(f1 (make-frame :number (frame-number p)
:x (frame-x p)
:y (frame-y p)
@@ -578,7 +578,7 @@
(tree-iterate i (lambda (leaf)
(sync-frame-windows group leaf))))))
-(defun split-frame (group how)
+(defun split-frame (group how &optional (ratio 1/2))
"split the current frame into 2 frames. return T if it succeeded. NIL
otherwise."
(check-type how (member :row :column))
(let* ((frame (tile-group-current-frame group))
@@ -591,7 +591,7 @@
(multiple-value-bind (f1 f2) (funcall (if (eq how :column)
'split-frame-h
'split-frame-v)
- group frame)
+ group frame ratio)
(setf (tile-group-frame-head group head)
(if (atom (tile-group-frame-head group head))
(list f1 f2)
- [STUMP] add ratio to split-frame,
Greg Pfeil <=