Skip to content

Commit

Permalink
X.H.EwmhDesktops: Clean up "handle"
Browse files Browse the repository at this point in the history
Whitespace and refactoring before other changes.
  • Loading branch information
liskin authored and TheMC47 committed May 21, 2021
1 parent 7ad38d4 commit 739f15d
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions XMonad/Hooks/EwmhDesktops.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE PatternGuards #-}

-----------------------------------------------------------------------------
-- |
Expand Down Expand Up @@ -248,7 +247,7 @@ activateLogHook mh = XS.get >>= maybe (return ()) go . netActivated
windows (appEndo f)

handle :: ([WindowSpace] -> [WindowSpace]) -> Event -> X ()
handle f ClientMessageEvent{ev_window = w, ev_message_type = mt, ev_data = d} =
handle f (ClientMessageEvent {ev_window = w, ev_message_type = mt, ev_data = d}) =
withWindowSet $ \s -> do
sort' <- getSortByIndex
let ws = f $ sort' $ W.workspaces s
Expand All @@ -258,18 +257,16 @@ handle f ClientMessageEvent{ev_window = w, ev_message_type = mt, ev_data = d} =
a_aw <- getAtom "_NET_ACTIVE_WINDOW"
a_cw <- getAtom "_NET_CLOSE_WINDOW"

if | mt == a_cd, n : _ <- d, Just ww <- ws !? fi n ->
windows $ W.view (W.tag ww)
| mt == a_cd ->
trace $ "Bad _NET_CURRENT_DESKTOP with data=" ++ show d
| mt == a_d, n : _ <- d, Just ww <- ws !? fi n ->
windows $ W.shiftWin (W.tag ww) w
if | mt == a_cd ->
case d of
(n:_) | 0 <= n && fi n < length ws -> windows $ W.view (W.tag (ws !! fi n))
| otherwise -> trace $ "Bad _NET_CURRENT_DESKTOP with data[0]="++show n
_ -> trace $ "Bad _NET_CURRENT_DESKTOP with data="++show d
| mt == a_d ->
trace $ "Bad _NET_WM_DESKTOP with data=" ++ show d
| mt == a_aw, 2 : _ <- d ->
-- when the request comes from a pager, honor it unconditionally
-- https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#sourceindication
windows $ W.focusWindow w
case d of
(n:_) | 0 <= n && fi n < length ws -> windows $ W.shiftWin (W.tag (ws !! fi n)) w
| otherwise -> trace $ "Bad _NET_DESKTOP with data[0]="++show n
_ -> trace $ "Bad _NET_DESKTOP with data="++show d
| mt == a_aw -> do
lh <- asks (logHook . config)
XS.put (NetActivated (Just w))
Expand Down

0 comments on commit 739f15d

Please sign in to comment.