From afdf0c9fbb8f390702fe45a16f6c0c3a17ca1606 Mon Sep 17 00:00:00 2001 From: Adam Vogt Date: Sat, 3 Oct 2009 20:19:27 +0200 Subject: Group functions in GridSelect haddock, add an inline screenshot. Ignore-this: 3c6f1c5aff4fe197aa965cbda23e1be7 darcs-hash:20091003181927-1499c-47cad25da8ad20cafdf323d4871432d144b26c64.gz --- XMonad/Actions/GridSelect.hs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'XMonad/Actions/GridSelect.hs') diff --git a/XMonad/Actions/GridSelect.hs b/XMonad/Actions/GridSelect.hs index 5808447..81db676 100644 --- a/XMonad/Actions/GridSelect.hs +++ b/XMonad/Actions/GridSelect.hs @@ -17,10 +17,16 @@ module XMonad.Actions.GridSelect ( -- * Usage -- $usage + + -- * Configuration GSConfig(..), + NavigateMap, + TwoDPosition, defaultGSConfig, defaultGSSpawnConfig, buildDefaultGSConfig, + + -- * Variations on 'gridselect' gridselect, gridselectWindow, withSelectedWindow, @@ -28,6 +34,8 @@ module XMonad.Actions.GridSelect ( goToSelected, spawnSelected, runSelectedAction, + + -- * Utility functions for customizing the 'GSConfig' fromClassName, defaultColorizer, colorRangeFromClassName @@ -60,7 +68,9 @@ import Data.Word (Word8) -- -- > , ((modMask x, xK_g), goToSelected defaultGSConfig) -- --- Screenshot: +-- Screenshot: +-- +-- <> -- -- This module also supports displaying arbitrary information in a grid and letting -- the user select from it. E.g. to spawn an application from a given list, you @@ -301,7 +311,7 @@ stringToRatio s = let gen = mkStdGen $ sum $ map fromEnum s -- | Brings up a 2D grid of elements in the center of the screen, and one can -- select an element with cursors keys. The selected element is returned. -gridselect :: forall a . GSConfig a -> [(String,a)] -> X (Maybe a) +gridselect :: GSConfig a -> [(String,a)] -> X (Maybe a) gridselect gsconfig elmap = withDisplay $ \dpy -> do rootw <- asks theRoot @@ -317,8 +327,7 @@ gridselect gsconfig elmap = screenHeight = toInteger $ rect_height s; selectedElement <- if (status == grabSuccess) then do - let restriction :: Integer -> (GSConfig a -> Integer) -> Double - restriction ss cs = ((fromInteger ss)/(fromInteger $ cs gsconfig)-1)/2 + let restriction ss cs = ((fromInteger ss)/(fromInteger $ cs gsconfig)-1)/2 restrictX = floor $ restriction screenWidth gs_cellwidth restrictY = floor $ restriction screenHeight gs_cellheight originPosX = floor $ ((gs_originFractX gsconfig) - (1/2)) * 2 * fromIntegral restrictX @@ -368,6 +377,7 @@ decorateName' :: Window -> X String decorateName' w = do fmap show $ getName w +-- | The default 'GSConfig' to use when selecting windows. defaultGSConfig :: GSConfig Window defaultGSConfig = buildDefaultGSConfig fromClassName -- cgit v1.2.3