Created
June 10, 2012 11:49
-
-
Save anekos/2905124 to your computer and use it in GitHub Desktop.
四畳半レイアウト for XMonad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} | |
| ----------------------------------------------------------------------------- | |
| -- | | |
| -- Module : XMonad.Layout.YojouHan | |
| -- Copyright : anekos 2012 | |
| -- License : BSD3 | |
| -- | |
| -- Maintainer : anekos | |
| -- Stability : unstable | |
| -- Portability : unportable | |
| -- | |
| -- Japanese tatami style layout. | |
| ----------------------------------------------------------------------------- | |
| module XMonad.Layout.YojouHan ( | |
| -- * Usage | |
| -- $usage | |
| YojouHan(..) | |
| ) where | |
| import XMonad | |
| import XMonad.StackSet (integrate) | |
| import Graphics.X11 (Rectangle(..)) | |
| -- $usage | |
| -- | |
| -- > import XMonad.Layout.YojouHan | |
| -- | |
| -- > layoutHook = YojouHan ||| Tall 1 (3/100) (1/2) ||| Full ... | |
| -- | |
| data YojouHan a = YojouHan deriving ( Read, Show ) | |
| instance LayoutClass YojouHan Window where | |
| doLayout YojouHan r s = do let layout = yojouHanLayout r $ integrate s | |
| return (layout, Nothing) | |
| yojouHanLayout :: Rectangle -> [a] -> [(a, Rectangle)] | |
| yojouHanLayout (Rectangle x y w h) ws = zip ws rs | |
| where | |
| rs = [ (Rectangle x y (t w) (o h)) | |
| , (Rectangle (x + t w) y (o w) (t h)) | |
| , (Rectangle (x + o w) (y + t h) (t w) (o h)) | |
| , (Rectangle x (y + o h) (o w) (t h)) | |
| , (Rectangle (x + o w) (y + o h) (o w) (o h)) ] | |
| t x = fromIntegral $ x `div` 3 * 2 | |
| o x = fromIntegral $ x `div` 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
