diff options
| author | Josh Rahm <rahm@google.com> | 2023-12-06 18:01:57 -0700 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2023-12-06 18:01:57 -0700 |
| commit | 8e2466e4b9a656622878d197e0d47161e6e10c4b (patch) | |
| tree | 8ab40130bfdd8c84a4470afc81eb0b0d50b3b34b /src/Main.hs | |
| parent | 32e6904dcac06a60d14c9d7e304c3528aaadfa1d (diff) | |
| download | rde-8e2466e4b9a656622878d197e0d47161e6e10c4b.tar.gz rde-8e2466e4b9a656622878d197e0d47161e6e10c4b.tar.bz2 rde-8e2466e4b9a656622878d197e0d47161e6e10c4b.zip | |
Add rudimentary float for when a chrome tab is ripped out of a Chrome instance.
Diffstat (limited to 'src/Main.hs')
| -rw-r--r-- | src/Main.hs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/Main.hs b/src/Main.hs index 6166518..507bd43 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -57,7 +57,7 @@ import XMonad title, withWindowSet, (-->), - (=?), + (=?), mouseDrag, refresh, modify, XState (dragging), ) import qualified XMonad as X (xmonad) import XMonad.Hooks.DynamicProperty (dynamicTitle) @@ -65,6 +65,8 @@ import XMonad.Hooks.EwmhDesktops (ewmh) import XMonad.Hooks.ManageDocks (docks) import XMonad.Hooks.ManageHelpers (doFullFloat, isFullscreen) import XMonad.Layout.Fullscreen (fullscreenEventHook) +import Data.List (isPrefixOf) +import Rahm.Desktop.Keys.Wml (wmlLogHook) main = do logHook <- xMobarLogHook @@ -107,7 +109,8 @@ main = do title =? "gxmessage" --> doCenterFloat, title =? "Volume Control" --> doCenterFloat, className =? "mpv" --> doFloat, - className =? "gnubby_ssh_prompt" --> doFloat + className =? "gnubby_ssh_prompt" --> doFloat, + shouldChromeFloat --> doFloat ], -- This config uses dynamic workspaces, but I have to seed XMonad -- with something. However, this configuration only supports 36 @@ -126,9 +129,20 @@ main = do ], focusFollowsMouse = False, clickJustFocuses = False, - logHook = logHook xmobar + logHook = wmlLogHook >> logHook xmobar } +-- Should the chrome window float? Returns false if the window's title starts +-- with "New Tab" because this usually means a new window was launched. If the +-- window name does not start with "New Tab", it is likely the tab was torn out +-- of the browser. These windows should float to avoid screwing with tiling. +shouldChromeFloat :: Query Bool +shouldChromeFloat = do + className <- className + title <- title + return $ + className == "Google-chrome" && not ("New Tab" `isPrefixOf` title) + changeHook :: Location -> Location -> X () changeHook l1 l2 = logs Info "Change %s -> %s" (show l1) (show l2) |