Hi,
The following small patch let's the user specify the initial frame size
width in pixel. I use to setup emacs so it's 80 characters wide.
Take care,
From 2d5028c06b101312f95c8f83c43146b34ae32276 Mon Sep 17 00:00:00 2001
From: Ivan Kanis ivan@tao
Date: Sun, 19 Dec 2010 16:35:21 +0100
Subject: [PATCH] add support for specifying a frame size in pixels
---
tile-group.lisp | 22 --
1 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/tile-group.lisp b/tile-group.lisp
index 3ed00aa..fba5337 100644
--- a/tile-group.lisp
+++ b/tile-group.lisp
@@ -316,7 +316,7 @@ T (default) then also focus the frame.
(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) ratio)))
+ (let* ((w (ratio-or-pixel (frame-width p) ratio))
(h (frame-height p))
(f1 (make-frame :number (frame-number p)
:x (frame-x p)
@@ -337,7 +337,7 @@ T (default) then also focus the frame.
(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) ratio)))
+ (h (ratio-or-pixel (frame-height p) ratio))
(f1 (make-frame :number (frame-number p)
:x (frame-x p)
:y (frame-y p)
@@ -354,6 +354,13 @@ T (default) then also focus the frame.
(run-hook-with-args *new-frame-hook* f2)
(values f1 f2)))
+(defun ratio-or-pixel (length ratio)
+ Return a ratio of length unless ratio is a number.
+If ratio is a number return the number of pixel desired.
+ (if (integerp ratio)
+ ratio
+ (truncate (* length ratio
+
(defun funcall-on-leaf (tree leaf fn)
Return a new tree with LEAF replaced with the result of calling FN on LEAF.
(cond ((atom tree)
@@ -725,9 +732,12 @@ depending on the tree's split direction.
(tree-iterate i (lambda (leaf)
(sync-frame-windows group leaf))
-(defun split-frame (group how optional (ratio 1/2))
+(defun split-frame (group how ratio)
Split the current frame into 2 frames. Return new frame number, if
- it succeeded. NIL otherwise.
+it succeeded. NIL otherwise. RATIO is a fraction of the screen to
+allocate to the new split window. If ratio is a number then the
+number of pixels will be used. This can be handy to setup the
+desktop when starting.
(check-type how (member :row :column))
(let* ((frame (tile-group-current-frame group))
(head (frame-head group frame)))
@@ -833,9 +843,9 @@ windows used to draw the numbers in. The caller must destroy them.
;;; Frame commands
-(defun split-frame-in-dir (group dir)
+(defun split-frame-in-dir (group dir optional (ratio 1/2))
(let ((f (tile-group-current-frame group)))
-(if (split-frame group dir)
+(if (split-frame group dir ratio)
(progn
(when (frame-window f)
(update-decoration (frame-window f)))
--
1.7.1
--
Ivan Kanis
http://kanis.fr
The reasonable man adapts himself to the world; the unreasonable man
persists in trying to adapt the world to himself. Therefore, all
progress depends on the unreasonable man.
-- George Bernard Shaw
___
Stumpwm-devel mailing list
Stumpwm-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/stumpwm-devel