Copyright | Clemens Fruhwirth <clemens@endorphin.org> Max Magorsch <max@magorsch.de> |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | Max Magorsch <max@magorsch.de> |
Stability | unstable |
Portability | unportable |
Safe Haskell | None |
Language | Haskell2010 |
GridSelect.Extras adds a method to XMonad.Actions.GridSelect that displays a message at the top of the screen while using the normal GridSelect.
Synopsis
- runSelectedActionWithMessageAndIcon :: GSConfig (X ()) -> String -> [[Bool]] -> [(String, X ())] -> X ()
- data GSConfig a = GSConfig {
- gs_cellheight :: Integer
- gs_cellwidth :: Integer
- gs_cellpadding :: Integer
- gs_colorizer :: a -> Bool -> X (String, String)
- gs_font :: String
- gs_navigate :: TwoD a (Maybe a)
- gs_rearranger :: Rearranger a
- gs_originFractX :: Double
- gs_originFractY :: Double
- gs_bordercolor :: String
- def :: Default a => a
- buildDefaultGSConfig :: (a -> Bool -> X (String, String)) -> GSConfig a
- defaultNavigation :: TwoD a (Maybe a)
Usage
You can use this module with the following in your ~/.xmonad/xmonad.hs
:
import qualified GridSelect.Extras
Then add a keybinding, e.g.
, ((modm, xK_g), gridselect gsconfig message actions) where gridselect = GridSelect.Extras.runSelectedActionWithMessage gsconfig = GridSelect.Extras.def message = "Please choose an option:" actions = [ ("Option #1", unsafeSpawn "notify-send 'Option #1'"), ("Option #2", unsafeSpawn "notify-send 'Option #2'") ]
This module also supports displaying an icon in the message window. To do so, just use runSelectedActionWithMessageAndIcon
like so:
, ((modm, xK_g), gridselect gsconfig message icon actions) where gridselect = GridSelect.Extras.runSelectedActionWithMessageAndIcon icon = [[True, False, False], [False, True, False], [True, False, True ]] -- ...
runSelectedActionWithMessageAndIcon :: GSConfig (X ()) -> String -> [[Bool]] -> [(String, X ())] -> X () Source #
Select an action and run it in the X monad. Furthermore display a message on top of the screen.
Screenshots
Selecting an action:
Customizing
It is possible to customize GridSelect.Extras the same way GridSelect is customized. Please refer to the GridSelect Documentation for further information.
Configuration
The Default
instance gives a basic configuration for gridselect
, with
the colorizer chosen based on the type.
If you want to replace the gs_colorizer
field, use buildDefaultGSConfig
instead of def
to avoid ambiguous type variables.
GSConfig | |
|
buildDefaultGSConfig :: (a -> Bool -> X (String, String)) -> GSConfig a Source #
Builds a default gs config from a colorizer function.
defaultNavigation :: TwoD a (Maybe a) Source #
By default gridselect used the defaultNavigation action, which
binds left,right,up,down and vi-style h,l,j,k navigation. Return
quits gridselect, returning the selected element, while Escape
cancels the selection. Slash enters the substring search mode. In
substring search mode, every string-associated keystroke is
added to a search string, which narrows down the object
selection. Substring search mode comes back to regular navigation
via Return, while Escape cancels the search. If you want that
navigation style, add defaultNavigation
as gs_navigate
to your
GSConfig
object. This is done by buildDefaultGSConfig
automatically.