mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Added allApplications to XMonad.Prompt.Window
This commit is contained in:
parent
7100e7db4f
commit
a8d41df92b
16
CHANGES.md
16
CHANGES.md
@ -25,11 +25,11 @@
|
|||||||
### New Modules
|
### New Modules
|
||||||
|
|
||||||
* `XMonad.Layout.TallMastersCombo`
|
* `XMonad.Layout.TallMastersCombo`
|
||||||
A layout combinator that support Shrink, Expand, and IncMasterN just as
|
A layout combinator that support Shrink, Expand, and IncMasterN just as
|
||||||
the 'Tall' layout, and also support operations of two master windows:
|
the 'Tall' layout, and also support operations of two master windows:
|
||||||
a main master, which is the original master window;
|
a main master, which is the original master window;
|
||||||
a sub master, the first window of the second pane.
|
a sub master, the first window of the second pane.
|
||||||
This combinator can be nested, and has a good support for using
|
This combinator can be nested, and has a good support for using
|
||||||
'XMonad.Layout.Tabbed' as a sublayout.
|
'XMonad.Layout.Tabbed' as a sublayout.
|
||||||
|
|
||||||
* `XMonad.Layout.TwoPanePersistent`
|
* `XMonad.Layout.TwoPanePersistent`
|
||||||
@ -79,6 +79,16 @@
|
|||||||
Made password prompts traverse symlinks when gathering password names for
|
Made password prompts traverse symlinks when gathering password names for
|
||||||
autocomplete.
|
autocomplete.
|
||||||
|
|
||||||
|
* `XMonad.Prompt.Window`
|
||||||
|
|
||||||
|
Added 'allApplications' function which maps application executable
|
||||||
|
names to it's underlying window.
|
||||||
|
|
||||||
|
* `XMonad.Prompt.WindowBringer`
|
||||||
|
|
||||||
|
Added 'windowApMap' function which maps application executable
|
||||||
|
names to it's underlying window.
|
||||||
|
|
||||||
* `XMonad.Actions.DynamicProjects`
|
* `XMonad.Actions.DynamicProjects`
|
||||||
|
|
||||||
Make the input directory read from the prompt in `DynamicProjects`
|
Make the input directory read from the prompt in `DynamicProjects`
|
||||||
|
@ -21,7 +21,7 @@ module XMonad.Actions.WindowBringer (
|
|||||||
WindowBringerConfig(..),
|
WindowBringerConfig(..),
|
||||||
gotoMenu, gotoMenuConfig, gotoMenu', gotoMenuArgs, gotoMenuArgs',
|
gotoMenu, gotoMenuConfig, gotoMenu', gotoMenuArgs, gotoMenuArgs',
|
||||||
bringMenu, bringMenuConfig, bringMenu', bringMenuArgs, bringMenuArgs',
|
bringMenu, bringMenuConfig, bringMenu', bringMenuArgs, bringMenuArgs',
|
||||||
windowMap, windowMap', bringWindow, actionMenu
|
windowMap, windowAppMap, windowMap', bringWindow, actionMenu
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Applicative((<$>))
|
import Control.Applicative((<$>))
|
||||||
@ -31,7 +31,7 @@ import qualified XMonad.StackSet as W
|
|||||||
import XMonad
|
import XMonad
|
||||||
import qualified XMonad as X
|
import qualified XMonad as X
|
||||||
import XMonad.Util.Dmenu (menuMapArgs)
|
import XMonad.Util.Dmenu (menuMapArgs)
|
||||||
import XMonad.Util.NamedWindows (getName)
|
import XMonad.Util.NamedWindows (getName, getNameWMClass)
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
--
|
--
|
||||||
@ -137,6 +137,10 @@ actionMenu WindowBringerConfig{ menuCommand = cmd
|
|||||||
windowMap :: X (M.Map String Window)
|
windowMap :: X (M.Map String Window)
|
||||||
windowMap = windowMap' decorateName
|
windowMap = windowMap' decorateName
|
||||||
|
|
||||||
|
-- | A map from application executable names to Windows.
|
||||||
|
windowAppMap :: X (M.Map String Window)
|
||||||
|
windowAppMap = windowMap' decorateAppName
|
||||||
|
|
||||||
-- | A map from window names to Windows, given a windowTitler function.
|
-- | A map from window names to Windows, given a windowTitler function.
|
||||||
windowMap' :: (X.WindowSpace -> Window -> X String) -> X (M.Map String Window)
|
windowMap' :: (X.WindowSpace -> Window -> X String) -> X (M.Map String Window)
|
||||||
windowMap' titler = do
|
windowMap' titler = do
|
||||||
@ -152,3 +156,11 @@ decorateName :: X.WindowSpace -> Window -> X String
|
|||||||
decorateName ws w = do
|
decorateName ws w = do
|
||||||
name <- show <$> getName w
|
name <- show <$> getName w
|
||||||
return $ name ++ " [" ++ W.tag ws ++ "]"
|
return $ name ++ " [" ++ W.tag ws ++ "]"
|
||||||
|
|
||||||
|
-- | Returns the window name as will be listed in dmenu. This will
|
||||||
|
-- return the executable name of the window along with it's workspace
|
||||||
|
-- ID.
|
||||||
|
decorateAppName :: X.WindowSpace -> Window -> X String
|
||||||
|
decorateAppName ws w = do
|
||||||
|
name <- show <$> getNameWMClass w
|
||||||
|
return $ name ++ " [" ++ W.tag ws ++ "]"
|
||||||
|
@ -22,6 +22,7 @@ module XMonad.Prompt.Window
|
|||||||
windowPrompt,
|
windowPrompt,
|
||||||
windowMultiPrompt,
|
windowMultiPrompt,
|
||||||
allWindows,
|
allWindows,
|
||||||
|
allApplications,
|
||||||
wsWindows,
|
wsWindows,
|
||||||
XWindowMap,
|
XWindowMap,
|
||||||
|
|
||||||
@ -120,6 +121,10 @@ windowPromptBringCopy c = windowPrompt c BringCopy windowMap
|
|||||||
allWindows :: XWindowMap
|
allWindows :: XWindowMap
|
||||||
allWindows = windowMap
|
allWindows = windowMap
|
||||||
|
|
||||||
|
-- | A helper to get the map of all applications
|
||||||
|
allApplications :: XWindowMap
|
||||||
|
allApplications = windowAppMap
|
||||||
|
|
||||||
-- | A helper to get the map of windows of the current workspace.
|
-- | A helper to get the map of windows of the current workspace.
|
||||||
wsWindows :: XWindowMap
|
wsWindows :: XWindowMap
|
||||||
wsWindows = withWindowSet (return . W.index) >>= winmap
|
wsWindows = withWindowSet (return . W.index) >>= winmap
|
||||||
|
@ -18,6 +18,7 @@ module XMonad.Util.NamedWindows (
|
|||||||
-- $usage
|
-- $usage
|
||||||
NamedWindow,
|
NamedWindow,
|
||||||
getName,
|
getName,
|
||||||
|
getNameWMClass,
|
||||||
withNamedWindow,
|
withNamedWindow,
|
||||||
unName
|
unName
|
||||||
) where
|
) where
|
||||||
@ -55,6 +56,20 @@ getName w = withDisplay $ \d -> do
|
|||||||
|
|
||||||
io $ getIt `E.catch` \(SomeException _) -> ((`NW` w) . resName) `fmap` getClassHint d w
|
io $ getIt `E.catch` \(SomeException _) -> ((`NW` w) . resName) `fmap` getClassHint d w
|
||||||
|
|
||||||
|
-- | Get 'NamedWindow' using 'wM_CLASS'
|
||||||
|
getNameWMClass :: Window -> X NamedWindow
|
||||||
|
getNameWMClass w =
|
||||||
|
withDisplay $ \d
|
||||||
|
-- TODO, this code is ugly and convoluted -- clean it up
|
||||||
|
-> do
|
||||||
|
let getIt = bracket getProp (xFree . tp_value) (fmap (`NW` w) . copy)
|
||||||
|
getProp = getTextProperty d w wM_CLASS
|
||||||
|
copy prop =
|
||||||
|
fromMaybe "" . listToMaybe <$> wcTextPropertyToTextList d prop
|
||||||
|
io $
|
||||||
|
getIt `E.catch` \(SomeException _) ->
|
||||||
|
((`NW` w) . resName) `fmap` getClassHint d w
|
||||||
|
|
||||||
unName :: NamedWindow -> Window
|
unName :: NamedWindow -> Window
|
||||||
unName (NW _ w) = w
|
unName (NW _ w) = w
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user