2008/6/2 Lanny Ripple <lanny@cisco.com>:
Hi all,
Just wanted to say Thanks! to everyone for XMonad. I've got it running with gnome for the panels but it blows the gnome WM out of the water.
I did run across some functionality I wanted that didn't exist so I wrote it up (attached). On reflection I should have added a long patch message. I found WindowGo for runOrRaise but often I want to pull a window (browser, mail, etc) to my current workspace instead of going to the one it's in. copyOrRun (and underlying copyMaybe) do that.
Cheers, -ljr
New patches:
[XMonad.Actions.CopyWindow runOrCopy lan3ny@gmail.com**20080602205742] { hunk ./XMonad/Actions/CopyWindow.hs 5 --- Copyright : (c) David Roundy <droundy@darcs.net>, Ivan Veselov <veselov@gmail.com> +-- Copyright : (c) David Roundy <droundy@darcs.net>, Ivan Veselov <veselov@gmail.com>, Lanny Ripple <lan3ny@gmail.com> hunk ./XMonad/Actions/CopyWindow.hs 20 - copy, copyToAll, copyWindow, killAllOtherCopies, kill1 + copy, copyToAll, copyWindow, runOrCopy + , killAllOtherCopies, kill1 hunk ./XMonad/Actions/CopyWindow.hs 25 +import Control.Monad (filterM) hunk ./XMonad/Actions/CopyWindow.hs 55 +-- Instead of copying a window from a workset to a workset maybe you don't +-- want to have to remember where you placed it. For that consider: +-- +-- > , ((modMask x, xK_b ), runOrCopy "firefox" (className =? "Firefox")) -- @@ run or copy firefox +-- hunk ./XMonad/Actions/CopyWindow.hs 68 --- > , ((modMask x, xK_v )", windows copyToAll) -- @@ Make focused window always visible +-- > , ((modMask x, xK_v ), windows copyToAll) -- @@ Make focused window always visible hunk ./XMonad/Actions/CopyWindow.hs 74 --- | copy. Copy the focussed window to a new workspace. +-- | copy. Copy the focused window to a new workspace. hunk ./XMonad/Actions/CopyWindow.hs 94 + +-- | runOrCopy . runOrCopy will run the provided shell command unless it can +-- find a specified window in which case it will copy the window to +-- the current workspace. Similar to (i.e., stolen from) "XMonad.Actions.WindowGo". +runOrCopy :: String -> Query Bool -> X () +runOrCopy action = copyMaybe $ spawn action + +-- | copyMaybe. Flatters "XMonad.Actions.WindowGo" ('raiseMaybe') +copyMaybe :: X () -> Query Bool -> X () +copyMaybe f thatUserQuery = withWindowSet $ \s -> do + maybeResult <- filterM (runQuery thatUserQuery) (allWindows s) + case maybeResult of + [] -> f + (x:_) -> windows $ copyWindow x (currentTag s) + } ...
Applied, thanks. -- gwern