-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Complete bindings to the dmenu and dmenu2 command line tools. -- -- Provides fuzzy selection via a GUI menu. @package dmenu @version 0.1.0.1 module DMenu -- | A state monad transformer in which the command line options of -- dmenu can be configured. type DMenuT = StateT Options -- | The MonadIO constraint additionally allows to spawn processes -- with System.Process in between. type MonadDMenu m = (MonadIO m, MonadState Options m) -- | When a spawned process fails, this type is used to represent the exit -- code and stderr output. type ProcessError = (Int, String) -- | Run a StateT Options m a action using the command line -- options from the config file or an empty set of options as initial -- state. -- -- For example -- --
--   import qualified DMenu
--   
--   main :: IO ()
--   main = DMenu.run $ do
--     DMenu.numLines .= 10
--     DMenu.prompt   .= "run"
--     liftIO . print =<< DMenu.selectM ["A","B","C"]
--   
run :: MonadIO m => DMenuT m a -> m a -- | Run DMenu with the command line options from m and a list of -- Strings from which the user should choose. selectM :: MonadDMenu m => [String] -> m (Either ProcessError String) -- | Convenience function combining run and selectM. -- -- The following example has the same behavior as the example for -- run: -- --
--   import qualified DMenu
--   
--   main :: IO ()
--   main = print =<< DMenu.select setOptions ["A","B","C"]
--   
--   setOptions :: DMenu.MonadDMenu m => m ()
--   setOptions = do
--     DMenu.numLines .= 10
--     DMenu.prompt   .= "run"
--   
select :: MonadIO m => DMenuT m () -> [String] -> m (Either ProcessError String) -- | Same as selectM, but allows the user to select from a list of -- arbitrary elements, which have a String representation. selectWithM :: MonadDMenu m => (a -> String) -> [a] -> m (Either ProcessError a) -- | Same as select, but allows the user to select from a list of -- arbitrary elements, which have a String representation. -- -- For example -- --
--   import qualified DMenu
--   
--   main :: IO ()
--   main = print =<< DMenu.selectWith setOptions show [1..10::Int]
--   
--   setOptions :: DMenu.MonadDMenu m => m ()
--   setOptions = do
--     DMenu.numLines .= 10
--     DMenu.prompt   .= "run"
--   
selectWith :: MonadIO m => DMenuT m () -> (a -> String) -> [a] -> m (Either ProcessError a) -- | Like selectM but uses the dmenu2 option -- filterMode, which returns not only the selected item, but all -- items which fuzzy match the input term. filterM :: MonadDMenu m => [String] -> m (Either ProcessError [String]) -- | Like select but uses the dmenu2 option -- filterMode, which returns not only the selected item, but all -- items which fuzzy match the input term. filter :: MonadIO m => DMenuT m () -> [String] -> m (Either ProcessError [String]) -- | Like selectWithM but uses the dmenu2 option -- filterMode, which returns not only the selected item, but all -- items which fuzzy match the input term. filterWithM :: MonadDMenu m => (a -> String) -> [a] -> m (Either ProcessError [a]) -- | Like selectWith but uses the dmenu2 option -- filterMode, which returns not only the selected item, but all -- items which fuzzy match the input term. filterWith :: MonadIO m => DMenuT m () -> (a -> String) -> [a] -> m (Either ProcessError [a]) -- | Contains the binary path and command line options of dmenu. The option -- descriptions are copied from the dmenu man page. data Options Options :: FilePath -> Bool -> Bool -> Bool -> Int -> Int -> String -> String -> Color -> Color -> Color -> Color -> Bool -> Options2 -> Bool -> Options -- | Path to the the dmenu executable file. Default looks for -- dmenu in the PATH enviroment variable. [_binaryPath] :: Options -> FilePath -- | -b; dmenu appears at the bottom of the screen. [_displayAtBottom] :: Options -> Bool -- | -f; dmenu grabs the keyboard before reading stdin. This is -- faster, but will lock up X until stdin reaches end-of-file. [_grabKeyboardBeforeStdin] :: Options -> Bool -- | -i; dmenu matches menu items case insensitively. [_caseInsensitive] :: Options -> Bool -- | -m screen; dmenu is displayed on the monitor number supplied. -- Monitor numbers are starting from 0. [_spawnOnMonitor] :: Options -> Int -- | -l lines; dmenu lists items vertically, with the given number -- of lines. [_numLines] :: Options -> Int -- | -p prompt; defines the prompt to be displayed to the left of -- the input field. [_prompt] :: Options -> String -- | -fn font; defines the font or font set used. eg. -- "fixed" or "Monospace-12:normal" (an xft font) [_font] :: Options -> String -- | -nb color; defines the normal background color. -- #RGB, #RRGGBB, and X color names are supported. [_normalBGColor] :: Options -> Color -- | -nf color; defines the normal foreground color. [_normalFGColor] :: Options -> Color -- | -sb color; defines the selected background color. [_selectedBGColor] :: Options -> Color -- | -sf color; defines the selected foreground color. [_selectedFGColor] :: Options -> Color -- | -v; prints version information to stdout, then exits. [_printVersionAndExit] :: Options -> Bool -- | Extra options only available in the dmenu2 fork. [_dmenu2] :: Options -> Options2 -- | When set to True, the dmenu2 options in -- _dmenu2 are ignored. This ensures compatibility with the normal -- dmenu. A user may set this flag in the configuration file. [_noDMenu2] :: Options -> Bool binaryPath :: Lens' Options FilePath displayAtBottom :: Lens' Options Bool grabKeyboardBeforeStdin :: Lens' Options Bool caseInsensitive :: Lens' Options Bool spawnOnMonitor :: Lens' Options Int numLines :: Lens' Options Int prompt :: Lens' Options String font :: Lens' Options String normalBGColor :: Lens' Options Color normalFGColor :: Lens' Options Color selectedBGColor :: Lens' Options Color selectedFGColor :: Lens' Options Color printVersionAndExit :: Lens' Options Bool -- | Contains the command line options of dmenu2 which are not -- part of dmenu. The _filterMode option is not listed; -- it can be implicitly used by using DMenu.filter instead of -- DMenu.select. The option descriptions are copied from the -- dmenu2 man page. data Options2 Options2 :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Int -> String -> String -> Double -> Double -> Color -> Int -> Int -> Int -> Int -> Int -> Color -> FilePath -> Options2 -- | -q; dmenu will not show any items if the search string is -- empty. [_displayNoItemsIfEmpty] :: Options2 -> Bool -- | -r; activates filter mode. All matching items currently shown -- in the list will be selected, starting with the item that is -- highlighted and wrapping around to the beginning of the list. -- (Note: Instead of setting this flag yourself, the -- dmenu filter functions can be used instead of the -- select functions.) [_filterMode] :: Options2 -> Bool -- | -z; dmenu uses fuzzy matching. It matches items that have all -- characters entered, in sequence they are entered, but there may be any -- number of characters between matched characters. For example it takes -- "txt" makes it to "*t*x*t" glob pattern and checks -- if it matches. [_fuzzyMatching] :: Options2 -> Bool -- | -t; dmenu uses space-separated tokens to match menu items. -- Using this overrides -z option. [_tokenMatching] :: Options2 -> Bool -- | -mask; dmenu masks input with asterisk characters -- (*). [_maskInputWithStar] :: Options2 -> Bool -- | -noinput; dmenu ignores input from stdin (equivalent to: -- echo | dmenu). [_ignoreStdin] :: Options2 -> Bool -- | -s screen; dmenu apears on the specified screen number. -- Number given corespondes to screen number in X optionsuration. [_spawnOnScreen] :: Options2 -> Int -- | -name name; defines window name for dmenu. Defaults to -- "dmenu". [_windowName] :: Options2 -> String -- | -class class; defines window class for dmenu. Defaults to -- "Dmenu". [_windowClass] :: Options2 -> String -- | -o opacity; defines window opacity for dmenu. Defaults to -- 1.0. [_windowOpacity] :: Options2 -> Double -- | -dim opacity; enables screen dimming when dmenu appers. Takes -- dim opacity as argument. [_windowDimOpacity] :: Options2 -> Double -- | -dc color; defines color of screen dimming. Active only when -- -dim in effect. Defautls to black (#000000) [_windowDimColor] :: Options2 -> Color -- | -h height; defines the height of the bar in pixels. [_heightInPixels] :: Options2 -> Int -- | -uh height; defines the height of the underline in pixels. [_underlineHeightInPixels] :: Options2 -> Int -- | -x xoffset; defines the offset from the left border of the -- screen. [_windowOffsetX] :: Options2 -> Int -- | -y yoffset; defines the offset from the top border of the -- screen. [_windowOffsetY] :: Options2 -> Int -- | -w width; defines the desired menu window width. [_width] :: Options2 -> Int -- | -uc color; defines the underline color. [_underlineColor] :: Options2 -> Color -- | -hist histfile; the file to use for history [_historyFile] :: Options2 -> FilePath displayNoItemsIfEmpty :: Lens' Options2 Bool filterMode :: Lens' Options2 Bool fuzzyMatching :: Lens' Options2 Bool tokenMatching :: Lens' Options2 Bool maskInputWithStar :: Lens' Options2 Bool ignoreStdin :: Lens' Options2 Bool spawnOnScreen :: Lens' Options2 Int windowName :: Lens' Options2 String windowClass :: Lens' Options2 String windowOpacity :: Lens' Options2 Double windowDimOpacity :: Lens' Options2 Double windowDimColor :: Lens' Options2 Color heightInPixels :: Lens' Options2 Int underlineHeightInPixels :: Lens' Options2 Int windowOffsetX :: Lens' Options2 Int windowOffsetY :: Lens' Options2 Int width :: Lens' Options2 Int underlineColor :: Lens' Options2 Color historyFile :: Lens' Options2 FilePath -- | Multiple representations for colors. -- -- For example, green can be defined as -- --
--   green1 = HexColor 0x00FF00
--   green2 = RGBColor 0 255 0
--   green3 = RGBColorF 0 1 0
--   
data Color HexColor :: Int -> Color RGBColor :: Int -> Int -> Int -> Color RGBColorF :: Float -> Float -> Float -> Color -- | Replace the target of a Lens or all of the targets of a -- Setter or Traversal in our monadic state with a new -- value, irrespective of the old. -- -- This is an infix version of assign. -- --
--   >>> execState (do _1 .= c; _2 .= d) (a,b)
--   (c,d)
--   
-- --
--   >>> execState (both .= c) (a,b)
--   (c,c)
--   
-- --
--   (.=) :: MonadState s m => Iso' s a       -> a -> m ()
--   (.=) :: MonadState s m => Lens' s a      -> a -> m ()
--   (.=) :: MonadState s m => Traversal' s a -> a -> m ()
--   (.=) :: MonadState s m => Setter' s a    -> a -> m ()
--   
-- -- It puts the state in the monad or it gets the hose again. (.=) :: MonadState s m => ASetter s s a b -> b -> m () infix 4 .=