aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevin Mullins <me@twifkak.com>2008-05-15 07:33:30 +0200
committerDevin Mullins <me@twifkak.com>2008-05-15 07:33:30 +0200
commit1ec1d0ae5da56e9f259ca09837fcc88c1f9a8312 (patch)
tree6fd02545ed58c536f4d5b3bc31ccbfa13277ed42
parent0c7f388bcb7ebaabc16d7bd176b7a7b249ad5db5 (diff)
downloadXMonadContrib-1ec1d0ae5da56e9f259ca09837fcc88c1f9a8312.tar.gz
XMonadContrib-1ec1d0ae5da56e9f259ca09837fcc88c1f9a8312.tar.xz
XMonadContrib-1ec1d0ae5da56e9f259ca09837fcc88c1f9a8312.zip
X.A.WindowNavigation: have currentPosition handle axes independently
This improves some subtle interactions between mod-j/k and mod-w/a/s/d, though that might not become very apparent until I fix setPosition. darcs-hash:20080515053330-78224-2ba67cefda58b7c079b23f93441859e30c539c73.gz
-rw-r--r--XMonad/Actions/WindowNavigation.hs14
-rw-r--r--XMonad/Hooks/UrgencyHook.hs2
2 files changed, 10 insertions, 6 deletions
diff --git a/XMonad/Actions/WindowNavigation.hs b/XMonad/Actions/WindowNavigation.hs
index d819d35..dc04737 100644
--- a/XMonad/Actions/WindowNavigation.hs
+++ b/XMonad/Actions/WindowNavigation.hs
@@ -109,22 +109,24 @@ withTargetWindow adj posRef dir = fromCurrentPoint $ \win pos -> do
-- a restart), derives the current position from the current window. Also,
-- verifies that the position is congruent with the current window (say, if you
-- used mod-j/k or mouse or something).
+-- TODO: factor x + fromIntegral w `div` 2 duplication out
currentPosition :: IORef WNState -> X Point
currentPosition posRef = do
root <- asks theRoot
currentWindow <- gets (W.peek . windowset)
- currentRect <- maybe (Rectangle 0 0 0 0) snd <$> windowRect (fromMaybe root currentWindow)
+ currentRect@(Rectangle rx ry rw rh) <- maybe (Rectangle 0 0 0 0) snd <$>
+ windowRect (fromMaybe root currentWindow)
wsid <- gets (W.tag . W.workspace . W.current . windowset)
mp <- M.lookup wsid <$> io (readIORef posRef)
case mp of
- Just p | p `inside` currentRect -> return p
- _ -> return (middleOf currentRect)
+ Just (Point x y) -> return $ Point (x `inside` (rx, rw)) (y `inside` (ry, rh))
+ _ -> return (middleOf currentRect)
- where Point px py `inside` Rectangle rx ry rw rh =
- px >= rx && px < rx + fromIntegral rw &&
- py >= ry && py < ry + fromIntegral rh
+ where pos `inside` (lower, dim) = if pos >= lower && pos < lower + fromIntegral dim
+ then pos
+ else lower + fromIntegral dim `div` 2
middleOf (Rectangle x y w h) =
Point (x + fromIntegral w `div` 2) (y + fromIntegral h `div` 2)
diff --git a/XMonad/Hooks/UrgencyHook.hs b/XMonad/Hooks/UrgencyHook.hs
index 93ec90c..308b9a7 100644
--- a/XMonad/Hooks/UrgencyHook.hs
+++ b/XMonad/Hooks/UrgencyHook.hs
@@ -72,6 +72,8 @@ import Foreign (unsafePerformIO)
-- > $ defaultConfig
--
+-- TODO: note mod-shift-space
+
-- * Setting up Irssi + rxvt-unicode
--
-- This is one common example. YMMV. To make messages to you trigger a dzen flash,