| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Core.Select
Synopsis
- selectWith :: [String] -> [ByteString] -> String -> IO (Either ProcessError ByteString)
- tryRead :: FilePath -> IO Items
- runUpdate :: ByteString -> Config -> Items -> IO ()
- getExecutables :: IO [ByteString]
- evalDirs :: [ByteString] -> IO [ByteString]
- showItems :: Items -> ByteString
- makeNewEntries :: [ByteString] -> Items
- sortByValues :: Items -> [ByteString]
Interacting with dmenu
Arguments
| :: [String] | List of options to give to dmenu. |
| -> [ByteString] | List of executables from which the user should select. |
| -> String | The dmenu executable. |
| -> IO (Either ProcessError ByteString) | The selection made by the user, or a |
Run dmenu with the given command line options and a list of entries from which the user should choose.
Originally select.
Interacting with the history file
tryRead :: FilePath -> IO Items Source #
Try to read a file that contains a map. Return an empty map if the file doesn't exist.
Arguments
| :: ByteString | What the user picked. |
| -> Config | User config containing things that interest us. |
| -> Items | Map prior to selection. |
| -> IO () |
Do the appropriate things with the user selection and update the history file.
Interacting with the system
getExecutables :: IO [ByteString] Source #
Get all executables from all dirs in $PATH.
evalDirs :: [ByteString] -> IO [ByteString] Source #
Apply evalDir to some list of file paths.
Pretty printing
showItems :: Items -> ByteString Source #
Pretty print our items.
Utility
makeNewEntries :: [ByteString] -> Items Source #
Turn a list into Items and set all starting values to 0.
sortByValues :: Items -> [ByteString] Source #
Sort Items by its values and return the list of keys.
This will make often used commands bubble up to the top.