diff options
author | Don Stewart <dons@cse.unsw.edu.au> | 2007-03-07 07:45:39 +0100 |
---|---|---|
committer | Don Stewart <dons@cse.unsw.edu.au> | 2007-03-07 07:45:39 +0100 |
commit | 62f312feef009b97199548248e6b4a40bca65d5f (patch) | |
tree | 01db2f25b437d942c856ce4774f510d4f242e59c /W.hs | |
parent | d0fc61f3f0b3686aedc288e01b3ed4cf0fa48398 (diff) | |
download | xmonad-62f312feef009b97199548248e6b4a40bca65d5f.tar.gz xmonad-62f312feef009b97199548248e6b4a40bca65d5f.tar.xz xmonad-62f312feef009b97199548248e6b4a40bca65d5f.zip |
focus left and right (mod-j/mod-k)
darcs-hash:20070307064539-9c5c1-2578ea84009c449b3baeba8a58bfda5b39096fba.gz
Diffstat (limited to 'W.hs')
-rw-r--r-- | W.hs | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -29,6 +29,14 @@ data WState = WState , windows :: !Windows } +-- +-- Multithreaded issues: +-- +-- We'll want a status bar, it will probably read from stdin +-- but will thus need to run in its own thread, and modify its status +-- bar window +-- + type Windows = [Window] -- | The W monad, a StateT transformer over IO encapuslating the window @@ -74,6 +82,23 @@ forever a = a >> forever a snoc :: [a] -> a -> [a] snoc xs x = xs ++ [x] --- | Rotate a list one element -rotate [] = [] -rotate (x:xs) = xs `snoc` x +-- | Rotate a list by 'n' elements. +-- +-- for xs = [5..8] ++ [1..4] +-- +-- rotate 0 +-- [5,6,7,8,1,2,3,4] +-- +-- rotate 1 +-- [6,7,8,1,2,3,4,5] +-- +-- rotate (-1) +-- [4,5,6,7,8,1,2,3] +-- +rotate n xs = take l . drop offset . cycle $ xs + where + l = length xs + offset | n < 0 = l + n + | otherwise = n + + |