Skip to content

Instantly share code, notes, and snippets.

@delamonpansie
Created May 15, 2013 16:21
Show Gist options
  • Save delamonpansie/5585228 to your computer and use it in GitHub Desktop.
Save delamonpansie/5585228 to your computer and use it in GitHub Desktop.
Hide window by moving it offscreen.
Wed May 15 20:18:11 MSK 2013 Yuriy Vostrikov <mon@unformed.ru>
* Hide window by moving it offscreen.
diff -rN -u old-xmonad/XMonad/Main.hsc new-xmonad/XMonad/Main.hsc
--- old-xmonad/XMonad/Main.hsc 2013-05-15 20:19:44.856112375 +0400
+++ new-xmonad/XMonad/Main.hsc 2013-05-15 20:19:44.860112375 +0400
@@ -274,6 +274,7 @@
-- configure a window
handle e@(ConfigureRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do
ws <- gets windowset
+ wm <- gets mapped
wa <- io $ getWindowAttributes dpy w
bw <- asks (borderWidth . config)
@@ -288,7 +289,7 @@
, wc_border_width = fromIntegral bw
, wc_sibling = ev_above e
, wc_stack_mode = ev_detail e }
- when (member w ws) (float w)
+ when (member w ws && S.member w wm) (float w)
else io $ allocaXEvent $ \ev -> do
setEventType ev configureNotify
setConfigureEvent ev w w
diff -rN -u old-xmonad/XMonad/Operations.hs new-xmonad/XMonad/Operations.hs
--- old-xmonad/XMonad/Operations.hs 2013-05-15 20:19:44.860112375 +0400
+++ new-xmonad/XMonad/Operations.hs 2013-05-15 20:19:44.860112375 +0400
@@ -186,7 +186,11 @@
hide w = whenX (gets (S.member w . mapped)) $ withDisplay $ \d -> do
cMask <- asks $ clientMask . config
io $ do selectInput d w (cMask .&. complement structureNotifyMask)
- unmapWindow d w
+ wa <- getWindowAttributes d w
+ let width = fromIntegral $ wa_width wa
+ height = fromIntegral $ wa_height wa
+ offScreenOffset = 4096 -- hack
+ moveResizeWindow d w offScreenOffset 0 width height
selectInput d w cMask
setWMState w iconicState
-- this part is key: we increment the waitingUnmap counter to distinguish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment