diff --git a/CHANGES.md b/CHANGES.md index 8d249fb77..cafcfe41b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -47,6 +47,10 @@ - Organize windows in columns. This layout allows to move/resize windows in every directions. + * `XMonad.Prompt.WindowBringer` + + - Added `copyMenu`, a convenient way to copy a window to the current workspace. + ### Bug Fixes and Minor Changes * Fix build-with-cabal.sh when XDG_CONFIG_HOME is defined. diff --git a/XMonad/Actions/WindowBringer.hs b/XMonad/Actions/WindowBringer.hs index 27c42a4c7..3a10872e7 100644 --- a/XMonad/Actions/WindowBringer.hs +++ b/XMonad/Actions/WindowBringer.hs @@ -22,6 +22,7 @@ module XMonad.Actions.WindowBringer ( WindowBringerConfig(..), gotoMenu, gotoMenuConfig, gotoMenu', gotoMenuArgs, gotoMenuArgs', bringMenu, bringMenuConfig, bringMenu', bringMenuArgs, bringMenuArgs', + copyMenu, copyMenuConfig, copyMenu', copyMenuArgs, copyMenuArgs', windowMap, windowAppMap, windowMap', bringWindow, actionMenu ) where @@ -33,6 +34,7 @@ import XMonad import qualified XMonad as X import XMonad.Util.Dmenu (menuMapArgs) import XMonad.Util.NamedWindows (getName, getNameWMClass) +import XMonad.Actions.CopyWindow (copyWindow) -- $usage -- @@ -44,6 +46,7 @@ import XMonad.Util.NamedWindows (getName, getNameWMClass) -- -- > , ((modm .|. shiftMask, xK_g ), gotoMenu) -- > , ((modm .|. shiftMask, xK_b ), bringMenu) +-- > , ((modm .|. shiftMask, xK_y ), copyMenu) -- -- For detailed instructions on editing your key bindings, see -- . @@ -90,6 +93,37 @@ gotoMenu' cmd = gotoMenuConfig def { menuArgs = [], menuCommand = cmd } gotoMenuArgs' :: String -> [String] -> X () gotoMenuArgs' cmd args = gotoMenuConfig def { menuCommand = cmd, menuArgs = args } +-- | Pops open a dmenu with window titles. Choose one, and it will be copied into your current workspace. +copyMenu :: X () +copyMenu = copyMenuArgs def + +-- | Pops open a dmenu with window titles. Choose one, and it will be +-- copied into your current workspace. This version +-- accepts a configuration object. +copyMenuConfig :: WindowBringerConfig -> X () +copyMenuConfig wbConfig = actionMenu wbConfig copyBringWindow + +-- | Pops open a dmenu with window titles. Choose one, and it will be +-- copied into your current workspace. This version +-- takes a list of arguments to pass to dmenu. +copyMenuArgs :: [String] -> X () +copyMenuArgs args = copyMenuConfig def { menuArgs = args } + +-- | Pops open an application with window titles given over stdin. Choose one, +-- and it will be copied into your current workspace. +copyMenu' :: String -> X () +copyMenu' cmd = copyMenuConfig def { menuArgs = [], menuCommand = cmd } + +-- | Pops open an application with window titles given over stdin. Choose one, +-- and it will be copied into your current +-- workspace. This version allows arguments to the chooser to be specified. +copyMenuArgs' :: String -> [String] -> X () +copyMenuArgs' cmd args = copyMenuConfig def { menuArgs = args, menuCommand = cmd } + +-- | Brings a copy of the specified window into the current workspace. +copyBringWindow :: Window -> X.WindowSet -> X.WindowSet +copyBringWindow w ws = copyWindow w (W.currentTag ws) ws + -- | Pops open a dmenu with window titles. Choose one, and it will be -- dragged, kicking and screaming, into your current workspace. bringMenu :: X () diff --git a/xmonad-contrib.cabal b/xmonad-contrib.cabal index 0417a30cc..f40128b41 100644 --- a/xmonad-contrib.cabal +++ b/xmonad-contrib.cabal @@ -430,6 +430,7 @@ test-suite tests Selective SwapWorkspaces Utils + XMonad.Actions.CopyWindow XMonad.Actions.CycleRecentWS XMonad.Actions.CycleWS XMonad.Actions.FocusNth @@ -441,10 +442,12 @@ test-suite tests XMonad.Actions.SwapWorkspaces XMonad.Actions.TagWindows XMonad.Actions.WindowBringer + XMonad.Actions.WindowGo XMonad.Hooks.ManageDocks XMonad.Hooks.ManageHelpers XMonad.Hooks.UrgencyHook XMonad.Hooks.WorkspaceHistory + XMonad.Hooks.StatusBar.PP XMonad.Layout.Decoration XMonad.Layout.LayoutModifier XMonad.Layout.LimitWindows