<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >XMonad.Actions.CopyWindow</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_XMonad-Actions-CopyWindow.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >xmonad-contrib-0.9.1: Third party extensions for xmonad</TD ><TD CLASS="topbut" ><A HREF="src/XMonad-Actions-CopyWindow.html" >Source code</A ></TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >XMonad.Actions.CopyWindow</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >unportable</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >unstable</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >???</TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >Usage </A ></DT ><DT ><A HREF="#2" >Highlight workspaces containing copies in logHook </A ></DT ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" >Provides bindings to duplicate a window on multiple workspaces, providing dwm-like tagging functionality. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="#v%3Acopy" >copy</A > :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > s, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > i, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > a) => i -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcopyToAll" >copyToAll</A > :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > s, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > i, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > a) => <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcopyWindow" >copyWindow</A > :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > a, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > i, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > s) => a -> i -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ArunOrCopy" >runOrCopy</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AQuery" >Query</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AX" >X</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AkillAllOtherCopies" >killAllOtherCopies</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AX" >X</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Akill1" >kill1</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AX" >X</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AwsContainingCopies" >wsContainingCopies</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AX" >X</A > [<A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AWorkspaceId" >WorkspaceId</A >]</TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >Usage </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="doc" ><P >You can use this module with the following in your <TT >~/.xmonad/xmonad.hs</TT > file: </P ><PRE > import XMonad.Actions.CopyWindow </PRE ><P >Then add something like this to your keybindings: </P ><PRE > -- 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)]] </PRE ><P >To use the above key bindings you need also to import <A HREF="XMonad-StackSet.html" >XMonad.StackSet</A >: </P ><PRE > import qualified XMonad.StackSet as W </PRE ><P >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: </P ><PRE > , ((modm .|. shiftMask, xK_c ), kill1) -- @@ Close the focused window </PRE ><P >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: </P ><PRE > , ((modm, xK_b ), runOrCopy "firefox" (className =? "Firefox")) -- @@ run or copy firefox </PRE ><P >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. </P ><P >Here is the example of keybindings which provide these actions: </P ><PRE > , ((modm, xK_v ), windows copyToAll) -- @@ Make focused window always visible , ((modm .|. shiftMask, xK_v ), killAllOtherCopies) -- @@ Toggle window state back </PRE ><P >For detailed instructions on editing your key bindings, see <A HREF="XMonad-Doc-Extending.html#Editing_key_bindings" >XMonad.Doc.Extending</A >. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:copy" ><A NAME="v%3Acopy" ></A ></A ><B >copy</B > :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > s, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > i, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > a) => i -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd</TD ><TD CLASS="declbut" ><A HREF="src/XMonad-Actions-CopyWindow.html#copy" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Copy the focused window to a workspace. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:copyToAll" ><A NAME="v%3AcopyToAll" ></A ></A ><B >copyToAll</B > :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > s, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > i, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > a) => <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd</TD ><TD CLASS="declbut" ><A HREF="src/XMonad-Actions-CopyWindow.html#copyToAll" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Copy the focused window to all workspaces. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:copyWindow" ><A NAME="v%3AcopyWindow" ></A ></A ><B >copyWindow</B > :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > a, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > i, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > s) => a -> i -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-StackSet.html#t%3AStackSet" >StackSet</A > i l a s sd</TD ><TD CLASS="declbut" ><A HREF="src/XMonad-Actions-CopyWindow.html#copyWindow" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Copy an arbitrary window to a workspace. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:runOrCopy" ><A NAME="v%3ArunOrCopy" ></A ></A ><B >runOrCopy</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AQuery" >Query</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AX" >X</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/XMonad-Actions-CopyWindow.html#runOrCopy" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >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) <A HREF="XMonad-Actions-WindowGo.html" >XMonad.Actions.WindowGo</A >. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:killAllOtherCopies" ><A NAME="v%3AkillAllOtherCopies" ></A ></A ><B >killAllOtherCopies</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AX" >X</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/XMonad-Actions-CopyWindow.html#killAllOtherCopies" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Kill all other copies of focused window (if they're present). 'All other' means here 'copies which are not on the current workspace'. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:kill1" ><A NAME="v%3Akill1" ></A ></A ><B >kill1</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AX" >X</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/XMonad-Actions-CopyWindow.html#kill1" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >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. </P ><P >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). </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="2" ><A NAME="2" >Highlight workspaces containing copies in logHook </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="doc" ><P >To distinguish workspaces containing copies of the focused window use something like: </P ><PRE > sampleLogHook h = do copies <- wsContainingCopies let check ws | ws `elem` copies = pad . xmobarColor "red" "black" $ ws | otherwise = pad ws dynamicLogWithPP myPP {ppHidden = check, ppOutput = hPutStrLn h} main = do h <- spawnPipe "xmobar" xmonad defaultConfig { logHook = sampleLogHook h } </PRE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:wsContainingCopies" ><A NAME="v%3AwsContainingCopies" ></A ></A ><B >wsContainingCopies</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AX" >X</A > [<A HREF="/usr/share/doc/ghc/html/libraries/xmonad-0.9.1/XMonad-Core.html#t%3AWorkspaceId" >WorkspaceId</A >]</TD ><TD CLASS="declbut" ><A HREF="src/XMonad-Actions-CopyWindow.html#wsContainingCopies" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >A list of hidden workspaces containing a copy of the focused window. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.6.1</TD ></TR ></TABLE ></BODY ></HTML >