module XMonad.Util.NoTaskbar (
noTaskbar
,markNoTaskbar) where
import XMonad.Core
import XMonad.Prelude (fi)
import XMonad.ManageHook
import Graphics.X11.Xlib (Window)
import Graphics.X11.Xlib.Atom (aTOM)
import Graphics.X11.Xlib.Extras (changeProperty32
,propModePrepend)
import Control.Monad.Reader (ask)
noTaskbar :: ManageHook
noTaskbar :: ManageHook
noTaskbar = Query Window
forall r (m :: * -> *). MonadReader r m => m r
ask Query Window -> (Window -> ManageHook) -> ManageHook
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Query () -> ManageHook -> ManageHook
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ManageHook
forall m. Monoid m => m
idHook) (Query () -> ManageHook)
-> (Window -> Query ()) -> Window -> ManageHook
forall b c a. (b -> c) -> (a -> b) -> a -> c
. X () -> Query ()
forall a. X a -> Query a
liftX (X () -> Query ()) -> (Window -> X ()) -> Window -> Query ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Window -> X ()
markNoTaskbar
markNoTaskbar :: Window -> X ()
markNoTaskbar :: Window -> X ()
markNoTaskbar Window
w = (Display -> X ()) -> X ()
forall a. (Display -> X a) -> X a
withDisplay ((Display -> X ()) -> X ()) -> (Display -> X ()) -> X ()
forall a b. (a -> b) -> a -> b
$ \Display
d -> do
Window
ws <- String -> X Window
getAtom String
"_NET_WM_STATE"
Window
ntb <- String -> X Window
getAtom String
"_NET_WM_STATE_SKIP_TASKBAR"
Window
npg <- String -> X Window
getAtom String
"_NET_WM_STATE_SKIP_PAGER"
IO () -> X ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
io (IO () -> X ()) -> IO () -> X ()
forall a b. (a -> b) -> a -> b
$ Display -> Window -> Window -> Window -> CInt -> [CLong] -> IO ()
changeProperty32 Display
d Window
w Window
ws Window
aTOM CInt
propModePrepend [Window -> CLong
forall a b. (Integral a, Num b) => a -> b
fi Window
ntb,Window -> CLong
forall a b. (Integral a, Num b) => a -> b
fi Window
npg]