aboutsummaryrefslogtreecommitdiffstats
path: root/MagicFocus.hs
diff options
context:
space:
mode:
authorPeter De Wachter <pdewacht@gmail.com>2007-06-12 19:53:57 +0200
committerPeter De Wachter <pdewacht@gmail.com>2007-06-12 19:53:57 +0200
commitc86e6c4c59e8c4888fbed787b2d244d4fae6cf14 (patch)
treef23821320afe4f2a4185a1e43559aa600bd6bec0 /MagicFocus.hs
parent2f05ed2f7967d81d65cf61bc06f1db652d10b1ef (diff)
downloadXMonadContrib-c86e6c4c59e8c4888fbed787b2d244d4fae6cf14.tar.gz
XMonadContrib-c86e6c4c59e8c4888fbed787b2d244d4fae6cf14.tar.xz
XMonadContrib-c86e6c4c59e8c4888fbed787b2d244d4fae6cf14.zip
Magic Focus
Automatically puts the focused window in the master position. It's magic. I wrote this for the Circle layout, but it's actually usable with other layouts as well. darcs-hash:20070612175357-06a25-9fdeb7878abc915e54ac0880a3ea21199aab75cc.gz
Diffstat (limited to 'MagicFocus.hs')
-rw-r--r--MagicFocus.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/MagicFocus.hs b/MagicFocus.hs
new file mode 100644
index 0000000..444a100
--- /dev/null
+++ b/MagicFocus.hs
@@ -0,0 +1,11 @@
+module XMonadContrib.MagicFocus (magicFocus) where
+
+import XMonad
+import StackSet
+
+magicFocus l = l { doLayout = \s -> (doLayout l) s . swap
+ , modifyLayout = \x -> fmap magicFocus `fmap` modifyLayout l x }
+
+swap :: Stack a -> Stack a
+swap Empty = Empty
+swap (Node f u d) = Node f [] (reverse u ++ d)