xmonad-contrib-0.18.0: Community-maintained extensions for xmonad
Copyright(c) David Roundy <droundy@darcs.net> Ivan Veselov <veselov@gmail.com> Lanny Ripple <lan3ny@gmail.com>
LicenseBSD3-style (see LICENSE)
Maintainer???
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Actions.CopyWindow

Description

Provides bindings to duplicate a window on multiple workspaces, providing dwm-like tagging functionality.

Synopsis

Usage

You can use this module with the following in your 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 the tutorial.

copy :: (Eq s, Eq i, Eq a) => i -> StackSet i l a s sd -> StackSet i l a s sd Source #

Copy the focused window to a workspace.

copyToAll :: (Eq s, Eq i, Eq a) => StackSet i l a s sd -> StackSet i l a s sd Source #

Copy the focused window to all workspaces.

copyWindow :: (Eq a, Eq i, Eq s) => a -> i -> StackSet i l a s sd -> StackSet i l a s sd Source #

Copy an arbitrary window to a workspace.

runOrCopy :: String -> Query Bool -> X () Source #

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.

killAllOtherCopies :: X () Source #

Kill all other copies of focused window (if they're present). 'All other' means here 'copies which are not on the current workspace'.

kill1 :: X () Source #

Remove the focused window from this workspace. If it's present in no other workspace, then kill it instead. If we do kill it, we'll get a delete notify back from X.

There are two ways to delete a window. Either just kill it, or if it supports the delete protocol, send a delete event (e.g. firefox).

taggedWindows :: [Workspace i l a] -> [(i, [a])] Source #

Get a list of tuples (tag, [Window]) for each workspace.

copiesOfOn :: Eq a => Maybe a -> [(i, [a])] -> [i] Source #

Get tags with copies of the focused window (if present.)

Highlight workspaces containing copies in logHook

To distinguish workspaces containing copies of the focused window, use copiesPP. copiesPP takes a pretty printer and makes it aware of copies of the focused window. It can be applied when creating a StatusBarConfig.

A sample config looks like this:

mySB = statusBarProp "xmobar" (copiesPP (pad . xmobarColor "red" "black") xmobarPP)
main = xmonad $ withEasySB mySB defToggleStrutsKey def

wsContainingCopies :: X [WorkspaceId] Source #

A list of hidden workspaces containing a copy of the focused window.

copiesPP :: (WorkspaceId -> String) -> PP -> X PP Source #

Take a pretty printer and make it aware of copies by using the provided function to show hidden workspaces that contain copies of the focused window.