summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlec Berryman <alec@thened.net>2007-03-29 20:21:59 +0200
committerAlec Berryman <alec@thened.net>2007-03-29 20:21:59 +0200
commit12cdac39c968a34c403aa7a9a1ac553c3a1f21b6 (patch)
treebe4640017f6d840763fec4ed4e23aafbf8602f38
parentaad41d6c3fac34b935b364e04b6f13e5f7d4320c (diff)
downloadmetatile-12cdac39c968a34c403aa7a9a1ac553c3a1f21b6.tar
metatile-12cdac39c968a34c403aa7a9a1ac553c3a1f21b6.zip
Window borders
Colors taken from dwm's config.default.h and hard-coded in Operations instead of Config because of import cycle. Windows overlap slightly in the current tiling algorithm and sometimes prevent the active window from being completely surrounded by a red border. darcs-hash:20070329182159-39448-deabaeaf89d87bb71abc851b6bae1ffa356e5561
-rw-r--r--Operations.hs10
-rw-r--r--TODO1
2 files changed, 10 insertions, 1 deletions
diff --git a/Operations.hs b/Operations.hs
index b80d16f..ef630db 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -142,10 +142,16 @@ withServerX f = withDisplay $ \dpy -> do
-- | Explicitly set the keyboard focus to the given window
setFocus :: Window -> X ()
setFocus w = do
+ -- Remove the border for the window no longer in focus.
+ ws <- gets workspace
+ whenJust (W.peek ws) (\oldw -> setBorder oldw 0xdddddd)
+ -- Set focus to the given window.
withDisplay $ \d -> io $ setInputFocus d w revertToPointerRoot 0
-- This does not use 'windows' intentionally. 'windows' calls refresh,
-- which means infinite loops.
modify (\s -> s { workspace = W.raiseFocus w (workspace s) })
+ -- Set new border for raised window.
+ setBorder w 0xff0000
-- | Set the focus to the window on top of the stack, or root
setTopFocus :: X ()
@@ -155,6 +161,10 @@ setTopFocus = do
Just new -> setFocus new
Nothing -> gets theRoot >>= setFocus
+-- | Set the border color for a particular window.
+setBorder :: Window -> Pixel -> X ()
+setBorder w p = withDisplay $ \d -> io $ setWindowBorder d w p
+
-- | raise. focus to window at offset 'n' in list.
-- The currently focused window is always the head of the list
raise :: Ordering -> X ()
diff --git a/TODO b/TODO
index 1001ad4..1465c9d 100644
--- a/TODO
+++ b/TODO
@@ -24,6 +24,5 @@
- make focus remain between workspace switches
- change focus in the StackSet structure on EnterNotify
- let mod+enter demote a master window
- - borders (low priority, maybe wait until 0.2)
* Tile vertically/ resize height.