summaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
authordaniel <daniel@wagner-home.com>2007-03-21 06:42:45 +0100
committerdaniel <daniel@wagner-home.com>2007-03-21 06:42:45 +0100
commitf5b1850d11209c0319342bf06aa11ac35b30e070 (patch)
tree9ef19709d316ae033124fd874b8974d967f98457 /Main.hs
parent9196d29faf9ad679c42c36e6baa4d46e7b3ca141 (diff)
downloadmetatile-f5b1850d11209c0319342bf06aa11ac35b30e070.tar
metatile-f5b1850d11209c0319342bf06aa11ac35b30e070.zip
Allow dynamic width in tiling mode
darcs-hash:20070321054245-c98ca-fc10278adbcbfe61de0f7bb4d4e14c5befc565b2
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs18
1 files changed, 15 insertions, 3 deletions
diff --git a/Main.hs b/Main.hs
index 26616b2..820a153 100644
--- a/Main.hs
+++ b/Main.hs
@@ -15,6 +15,7 @@
import Data.List
import Data.Maybe
+import Data.Ratio
import Data.Bits hiding (rotate)
import qualified Data.Map as M
@@ -53,6 +54,8 @@ keys = M.fromList $
, ((modMask, xK_Tab ), raise GT)
, ((modMask, xK_j ), raise GT)
, ((modMask, xK_k ), raise LT)
+ , ((modMask, xK_h ), changeWidth (negate defaultDelta))
+ , ((modMask, xK_l ), changeWidth defaultDelta)
, ((modMask .|. shiftMask, xK_c ), kill)
, ((modMask .|. shiftMask, xK_q ), io $ exitWith ExitSuccess)
, ((modMask, xK_space ), switchLayout)
@@ -68,15 +71,16 @@ keys = M.fromList $
, (f, m) <- [(view, 0), (tag, shiftMask)]]
+-- How much to change the size of the windows on the left by default
+defaultDelta :: Rational
+defaultDelta = 3%100
+
--
-- The mask for the numlock key. You may need to change this on some systems.
--
numlockMask :: KeySym
numlockMask = lockMask
-ratio :: Rational
-ratio = 0.5
-
--
-- The main entry point
--
@@ -100,6 +104,7 @@ main = do
, dimensions = (displayWidth dpy dflt, displayHeight dpy dflt)
, workspace = W.empty workspaces
, layout = Full
+ , leftWidth = 3%5
}
xSetErrorHandler -- in C, I'm too lazy to write the binding
@@ -243,6 +248,7 @@ refresh = do
xinesc <- gets xineScreens
d <- gets display
l <- gets layout
+ ratio <- gets leftWidth
let move w a b c e = io $ moveResizeWindow d w a b c e
flip mapM_ (M.assocs ws2sc) $ \(n, scn) -> do
let sc = xinesc !! scn
@@ -274,6 +280,12 @@ switchLayout = do
Tile -> Full })
refresh
+-- | changeWidth. Change the width of the main window in tiling mode.
+changeWidth :: Rational -> X ()
+changeWidth delta = do
+ modify (\s -> s {leftWidth = leftWidth s + delta})
+ refresh
+
-- | windows. Modify the current window list with a pure function, and refresh
windows :: (WorkSpace -> WorkSpace) -> X ()
windows f = do