aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Hooks
diff options
context:
space:
mode:
authorJan Vornberger <jan.vornberger@informatik.uni-oldenburg.de>2009-09-29 01:15:49 +0200
committerJan Vornberger <jan.vornberger@informatik.uni-oldenburg.de>2009-09-29 01:15:49 +0200
commit76c329851a4e14f03d73ddf026c69b16cb47e783 (patch)
treeb062806332ef6fb601c93f2e1c569ec9737fcc38 /XMonad/Hooks
parente3e0170482af08a958f1f88476b99c825e5cd16c (diff)
downloadXMonadContrib-76c329851a4e14f03d73ddf026c69b16cb47e783.tar.gz
XMonadContrib-76c329851a4e14f03d73ddf026c69b16cb47e783.tar.xz
XMonadContrib-76c329851a4e14f03d73ddf026c69b16cb47e783.zip
EventHook to restore minimized windows from taskbar (re-recorded from Bluetile repo)
Ignore-this: 673b003c4e07b591046ed01e5f27a7ec darcs-hash:20090928231549-594c5-6a640551cd229bffdb477ded4756be5517b81d7a.gz
Diffstat (limited to 'XMonad/Hooks')
-rw-r--r--XMonad/Hooks/RestoreMinimized.hs49
1 files changed, 49 insertions, 0 deletions
diff --git a/XMonad/Hooks/RestoreMinimized.hs b/XMonad/Hooks/RestoreMinimized.hs
new file mode 100644
index 0000000..77b3c97
--- /dev/null
+++ b/XMonad/Hooks/RestoreMinimized.hs
@@ -0,0 +1,49 @@
+----------------------------------------------------------------------------
+-- |
+-- Module : XMonad.Hooks.RestoreMinimized
+-- Copyright : (c) Jan Vornberger 2009
+-- License : BSD3-style (see LICENSE)
+--
+-- Maintainer : jan.vornberger@informatik.uni-oldenburg.de
+-- Stability : unstable
+-- Portability : not portable
+--
+-- Lets you restore minimized windows (see XMonad.Layout.Minimize)
+-- by selecting them on a taskbar (listens for _NET_ACTIVE_WINDOW
+-- and WM_CHANGE_STATE).
+--
+-----------------------------------------------------------------------------
+
+module XMonad.Hooks.RestoreMinimized
+ ( -- * Usage
+ -- $usage
+ RestoreMinimized (..)
+ , restoreMinimizedEventHook
+ ) where
+
+import Data.Monoid
+import Control.Monad(when)
+
+import XMonad
+import XMonad.Layout.Minimize
+
+-- $usage
+-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
+--
+-- > import XMonad.Hooks.RestoreMinimized
+-- >
+-- > myHandleEventHook = restoreMinimizedEventHook
+-- >
+-- > main = xmonad defaultConfig { handleEventHook = myHandleEventHook }
+
+data RestoreMinimized = RestoreMinimized deriving ( Show, Read )
+
+restoreMinimizedEventHook :: Event -> X All
+restoreMinimizedEventHook (ClientMessageEvent {ev_window = w,
+ ev_message_type = mt}) = do
+ a_aw <- getAtom "_NET_ACTIVE_WINDOW"
+ a_cs <- getAtom "WM_CHANGE_STATE"
+ when (mt == a_aw || mt == a_cs) $ do
+ sendMessage (RestoreMinimizedWin w)
+ return (All True)
+restoreMinimizedEventHook _ = return (All True)