stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] simple tiling


From: Jose A. Ortega Ruiz
Subject: [STUMP] simple tiling
Date: Tue, 11 Aug 2009 23:54:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

hi,

i just switched to stumpwm from xmonad and wanted something similar to
the latter's Tall layout, i.e., a group where there's an horizontal
split with one window on the left and the rest vertically stacked in the
right (which is split vertically as many times as needed). for instance,
with 4 windows:

   -------------------------------
   |             |               |
   |             |---------------|
   |             |               |
   |             |---------------|
   |             |               |
   -------------------------------

so i wrote this command:

  (defun jao-tile-group (group)
    (let* ((tlen (length (group-windows group)))
           (len (1- tlen)))
      (unless (zerop tlen)
        (call-interactively "only")
        (unless (current-window)
          (focus-next-window group)))
      (unless (zerop len)
        (split-frame group :column)
        (focus-next-frame group)
        (dotimes (n (1- len))
          (split-frame group :row (/ (- len n)))
          (focus-next-frame group))
        (focus-next-frame group))))

  (defcommand (tile tile-group) () ()
    (jao-tile-group (current-group)))

and a bit of code to auto-tile registered groups everytime a new window
is added:

  (defvar *jao-autotiling-groups* '("doc"))

  (defun jao-autotile-hook (&optional window)
    (when (member (group-name (current-group)) *jao-autotiling-groups* :test 
#'equalp)
      (jao-tile-group (current-group))))

  (add-hook *new-window-hook* #'jao-autotile-hook)
  (add-hook *unmap-window-hook* #'jao-autotile-hook)

all of which works fine (except for the fact that the hooks in
*unmap-window-hook* are not being called, unless i'm missing something).

this being my very first hack in stumpwm, i suspect it offers ample room
for improvement, and that's the main reason i'm posting it: i'd greatly
appreciate your comments on any of the silly or unstumpy things i'm
doing above.

thanks!
jao
-- 
A language that doesn't affect the way you think about programming, is
not worth knowing.
  - Alan Perlis, Epigrams in Programing





reply via email to

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