You can use this module with the following in your ~/.xmonad/xmonad.hs file:
import XMonad.Actions.CopyWindow
Then add something like this to your keybindings:
-- mod-[1..9] @@ Switch to workspace N
-- mod-shift-[1..9] @@ Move client to workspace N
-- mod-control-shift-[1..9] @@ Copy client to workspace N
[((m .|. modm, k), windows $ f i)
| (i, k) <- zip (workspaces x) [xK_1 ..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask), (copy, shiftMask .|. controlMask)]]
To use the above key bindings you need also to import
XMonad.StackSet:
import qualified XMonad.StackSet as W
You may also wish to redefine the binding to kill a window so it only
removes it from the current workspace, if it's present elsewhere:
, ((modm .|. shiftMask, xK_c ), kill1) -- @@ Close the focused window
Instead of copying a window from one workspace to another maybe you don't
want to have to remember where you placed it. For that consider:
, ((modm, xK_b ), runOrCopy "firefox" (className =? "Firefox")) -- @@ run or copy firefox
Another possibility which this extension provides is 'making window
always visible' (i.e. always on current workspace), similar to corresponding
metacity functionality. This behaviour is emulated through copying given
window to all the workspaces and then removing it when it's unneeded on
all workspaces any more.
Here is the example of keybindings which provide these actions:
, ((modm, xK_v ), windows copyToAll) -- @@ Make focused window always visible
, ((modm .|. shiftMask, xK_v ), killAllOtherCopies) -- @@ Toggle window state back
For detailed instructions on editing your key bindings, see
XMonad.Doc.Extending.
|