about summary refs log tree commit diff
path: root/dotfiles
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles')
-rw-r--r--dotfiles/sxhkd/xmonad3
-rw-r--r--dotfiles/xmonad.hs9
2 files changed, 10 insertions, 2 deletions
diff --git a/dotfiles/sxhkd/xmonad b/dotfiles/sxhkd/xmonad
index e902907..6f13108 100644
--- a/dotfiles/sxhkd/xmonad
+++ b/dotfiles/sxhkd/xmonad
@@ -18,6 +18,9 @@ alt + shift + {1-9}
 alt + Tab
    xmonadctl cycle-workspace
 
+alt + space
+   xmonadctl togglefloating
+
 #alt + 0
 #    dwmc viewall
 
diff --git a/dotfiles/xmonad.hs b/dotfiles/xmonad.hs
index bf32d9f..0cd3eba 100644
--- a/dotfiles/xmonad.hs
+++ b/dotfiles/xmonad.hs
@@ -133,6 +133,7 @@ myCommands =
         , ("swap-with-next"            , windows W.swapDown                               )
         , ("swap-with-master"          , windows W.swapMaster                             )
         , ("togglefullscreen"          , sendMessage $ Toggle FULL                        )
+        , ("togglefloating"            , withFocused toggleFloat                          )
         , ("next-layout"               , sendMessage NextLayout                           )
         , ("cycle-workspace"           , toggleWS                                         )
         , ("kill-window"               , kill                                             )
@@ -164,15 +165,19 @@ listMyServerCmds = spawn ("echo '" ++ asmc ++ "' | xmessage -file -")
 myFocusFollowsMouse :: Bool
 myFocusFollowsMouse = False
 
+toggleFloat w = windows (\s -> if M.member w (W.floating s)
+                            then W.sink w s
+                            else (W.float w (W.RationalRect 0.125 0.125 0.75 0.75) s))
+
 myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
   [
     -- mod-button1, Set the window to floating mode and move by dragging
     ((modMask, button1),
      (\w -> focus w >> mouseMoveWindow w))
 
-    -- mod-button2, Raise the window to the top of the stack
+    -- mod-button2, Toggle float on the window
     , ((modMask, button2),
-       (\w -> focus w >> windows W.swapMaster))
+       (\w -> focus w >> toggleFloat w))
 
     -- mod-button3, Set the window to floating mode and resize by dragging
     , ((modMask, button3),