mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
Docstring parser for generating xmonad build configs with default settings for extensions
This commit is contained in:
parent
39180985fb
commit
d0adeca94a
@ -28,6 +28,9 @@ import XMonadContrib.LayoutHelpers ( idModify )
|
|||||||
-- > import XMonadContrib.Accordion
|
-- > import XMonadContrib.Accordion
|
||||||
-- > defaultLayouts = [ accordion ]
|
-- > defaultLayouts = [ accordion ]
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Accordion
|
||||||
|
-- %layout , accordion
|
||||||
|
|
||||||
accordion :: Eq a => Layout a
|
accordion :: Eq a => Layout a
|
||||||
accordion = Layout { doLayout = accordionLayout, modifyLayout = idModify }
|
accordion = Layout { doLayout = accordionLayout, modifyLayout = idModify }
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@ module XMonadContrib.Anneal ( Rated(Rated), the_value, the_rating
|
|||||||
import System.Random ( StdGen, Random, mkStdGen, randomR )
|
import System.Random ( StdGen, Random, mkStdGen, randomR )
|
||||||
import Control.Monad.State ( State, runState, put, get, gets, modify )
|
import Control.Monad.State ( State, runState, put, get, gets, modify )
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Anneal
|
||||||
|
|
||||||
data Rated a b = Rated !a !b
|
data Rated a b = Rated !a !b
|
||||||
deriving ( Show )
|
deriving ( Show )
|
||||||
instance Functor (Rated a) where
|
instance Functor (Rated a) where
|
||||||
|
@ -30,6 +30,8 @@ import XMonadContrib.LayoutHelpers ( idModify )
|
|||||||
--
|
--
|
||||||
-- > import XMonadContrib.Circle
|
-- > import XMonadContrib.Circle
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Circle
|
||||||
|
|
||||||
circle :: Layout Window
|
circle :: Layout Window
|
||||||
circle = Layout { doLayout = \r s -> do { layout <- raiseFocus $ circleLayout r $ integrate s
|
circle = Layout { doLayout = \r s -> do { layout <- raiseFocus $ circleLayout r $ integrate s
|
||||||
; return (layout, Nothing) }
|
; return (layout, Nothing) }
|
||||||
|
6
Combo.hs
6
Combo.hs
@ -32,7 +32,7 @@ import StackSet ( integrate, differentiate )
|
|||||||
--
|
--
|
||||||
-- and add something like
|
-- and add something like
|
||||||
--
|
--
|
||||||
-- > simpleStacking $ combo (twoPane 0.03 0.5) [(full,1),(tabbed shrinkText,1)]
|
-- > simpleStacking $ combo (twoPane 0.03 0.5) [(full,1),(tabbed shrinkText defaultTConf,1)]
|
||||||
--
|
--
|
||||||
-- to your defaultLayouts.
|
-- to your defaultLayouts.
|
||||||
--
|
--
|
||||||
@ -43,6 +43,10 @@ import StackSet ( integrate, differentiate )
|
|||||||
-- windows this section should hold. This number is ignored for the last
|
-- windows this section should hold. This number is ignored for the last
|
||||||
-- layout, which will hold any excess windows.
|
-- layout, which will hold any excess windows.
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Combo
|
||||||
|
-- %import XMonadContrib.SimpleStacking
|
||||||
|
-- %layout , simpleStacking $ combo (twoPane 0.03 0.5) [(full,1),(tabbed shrinkText defaultTConf,1)]
|
||||||
|
|
||||||
combo :: Layout (Layout a, Int) -> [(Layout a, Int)] -> Layout a
|
combo :: Layout (Layout a, Int) -> [(Layout a, Int)] -> Layout a
|
||||||
combo super origls = Layout { doLayout = \r s -> arrange r (integrate s), modifyLayout = message }
|
combo super origls = Layout { doLayout = \r s -> arrange r (integrate s), modifyLayout = message }
|
||||||
where arrange _ [] = return ([], Nothing)
|
where arrange _ [] = return ([], Nothing)
|
||||||
|
@ -42,7 +42,7 @@ import Data.Maybe
|
|||||||
--
|
--
|
||||||
-- and add a keybinding to the runCommand action:
|
-- and add a keybinding to the runCommand action:
|
||||||
--
|
--
|
||||||
-- > , ((modMask .|. controlMask, xK_y), runCommand)
|
-- > , ((modMask .|. controlMask, xK_y), runCommand commands)
|
||||||
--
|
--
|
||||||
-- and define the list commands:
|
-- and define the list commands:
|
||||||
--
|
--
|
||||||
@ -54,6 +54,11 @@ import Data.Maybe
|
|||||||
-- 'commands'. (If you like it enough, you may even want to get rid
|
-- 'commands'. (If you like it enough, you may even want to get rid
|
||||||
-- of many of your other key bindings!)
|
-- of many of your other key bindings!)
|
||||||
|
|
||||||
|
-- %def commands :: [(String, X ())]
|
||||||
|
-- %def commands = defaultCommands
|
||||||
|
-- %import XMonadContrib.Commands
|
||||||
|
-- %keybind , ((modMask .|. controlMask, xK_y), runCommand commands)
|
||||||
|
|
||||||
commandMap :: [(String, X ())] -> M.Map String (X ())
|
commandMap :: [(String, X ())] -> M.Map String (X ())
|
||||||
commandMap c = M.fromList c
|
commandMap c = M.fromList c
|
||||||
|
|
||||||
|
@ -43,6 +43,17 @@ import StackSet
|
|||||||
--
|
--
|
||||||
-- > , ((modMask .|. shiftMask, xK_c ), kill1) -- @@ Close the focused window
|
-- > , ((modMask .|. shiftMask, xK_c ), kill1) -- @@ Close the focused window
|
||||||
|
|
||||||
|
-- %import XMonadContrib.CopyWindow
|
||||||
|
-- %keybind -- comment out default close window binding above if you uncomment this:
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_c ), kill1) -- @@ Close the focused window
|
||||||
|
-- %keybindlist ++
|
||||||
|
-- %keybindlist -- mod-[1..9] @@ Switch to workspace N
|
||||||
|
-- %keybindlist -- mod-shift-[1..9] @@ Move client to workspace N
|
||||||
|
-- %keybindlist -- mod-control-shift-[1..9] @@ Copy client to workspace N
|
||||||
|
-- %keybindlist [((m .|. modMask, k), f i)
|
||||||
|
-- %keybindlist | (i, k) <- zip workspaces [xK_1 ..]
|
||||||
|
-- %keybindlist , (f, m) <- [(view, 0), (shift, shiftMask), (copy, shiftMask .|. controlMask)]]
|
||||||
|
|
||||||
-- | copy. Copy a window to a new workspace.
|
-- | copy. Copy a window to a new workspace.
|
||||||
copy :: WorkspaceId -> X ()
|
copy :: WorkspaceId -> X ()
|
||||||
copy n = windows (copy' n)
|
copy n = windows (copy' n)
|
||||||
|
@ -48,6 +48,9 @@ import Graphics.X11 (Window)
|
|||||||
-- > , ((modMask, xK_d ), withFocused demanage)
|
-- > , ((modMask, xK_d ), withFocused demanage)
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- %import XMonadContrib.DeManage
|
||||||
|
-- %keybind , ((modMask, xK_d ), withFocused demanage)
|
||||||
|
|
||||||
-- | Stop managing the current focused window.
|
-- | Stop managing the current focused window.
|
||||||
demanage :: Window -> X ()
|
demanage :: Window -> X ()
|
||||||
demanage w = do
|
demanage w = do
|
||||||
|
2
Dmenu.hs
2
Dmenu.hs
@ -30,6 +30,8 @@ import Control.Monad.State
|
|||||||
--
|
--
|
||||||
-- > import XMonadContrib.Dmenu
|
-- > import XMonadContrib.Dmenu
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Dmenu
|
||||||
|
|
||||||
runProcessWithInput :: FilePath -> [String] -> String -> IO String
|
runProcessWithInput :: FilePath -> [String] -> String -> IO String
|
||||||
runProcessWithInput cmd args input = do
|
runProcessWithInput cmd args input = do
|
||||||
(pin, pout, perr, ph) <- runInteractiveProcess cmd args Nothing Nothing
|
(pin, pout, perr, ph) <- runInteractiveProcess cmd args Nothing Nothing
|
||||||
|
@ -36,6 +36,9 @@ import StackSet
|
|||||||
--
|
--
|
||||||
-- > , ((modMask, xK_Return), dwmpromote)
|
-- > , ((modMask, xK_Return), dwmpromote)
|
||||||
|
|
||||||
|
-- %import XMonadContrib.DwmPromote
|
||||||
|
-- %keybind , ((modMask, xK_Return), dwmpromote)
|
||||||
|
|
||||||
dwmpromote :: X ()
|
dwmpromote :: X ()
|
||||||
dwmpromote = windows swap
|
dwmpromote = windows swap
|
||||||
|
|
||||||
|
@ -40,6 +40,10 @@ import qualified StackSet as S
|
|||||||
-- > import XMonadContrib.DynamicLog
|
-- > import XMonadContrib.DynamicLog
|
||||||
-- > logHook = dynamicLog
|
-- > logHook = dynamicLog
|
||||||
|
|
||||||
|
-- %import XMonadContrib.DynamicLog
|
||||||
|
-- %def -- comment out default logHook definition above if you uncomment this:
|
||||||
|
-- %def logHook = dynamicLog
|
||||||
|
|
||||||
|
|
||||||
-- |
|
-- |
|
||||||
-- Perform an arbitrary action on each state change.
|
-- Perform an arbitrary action on each state change.
|
||||||
|
@ -41,6 +41,10 @@ import qualified Operations as O
|
|||||||
-- Now you can jump to an empty workspace with mod-m. Mod-shift-m will
|
-- Now you can jump to an empty workspace with mod-m. Mod-shift-m will
|
||||||
-- tag the current window to an empty workspace and view it.
|
-- tag the current window to an empty workspace and view it.
|
||||||
|
|
||||||
|
-- %import XMonadContrib.FindEmptyWorkspace
|
||||||
|
-- %keybind , ((modMask, xK_m ), viewEmptyWorkspace)
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_m ), tagToEmptyWorkspace)
|
||||||
|
|
||||||
|
|
||||||
-- | Find the first hidden empty workspace in a StackSet. Returns
|
-- | Find the first hidden empty workspace in a StackSet. Returns
|
||||||
-- Nothing if all workspaces are in use. Function searches currently
|
-- Nothing if all workspaces are in use. Function searches currently
|
||||||
|
@ -48,6 +48,9 @@ import Graphics.X11.Xlib.Extras
|
|||||||
-- a value between 0 and 1 indicating position, and return a value indicating
|
-- a value between 0 and 1 indicating position, and return a value indicating
|
||||||
-- the corresponding position if plain Flex.linear was used.
|
-- the corresponding position if plain Flex.linear was used.
|
||||||
|
|
||||||
|
-- %import qualified XMonadContrib.FlexibleManipulate as Flex
|
||||||
|
-- %mousebind , ((modMask, button1), (\\w -> focus w >> Flex.mouseWindow Flex.linear w))
|
||||||
|
|
||||||
discrete, linear, resize, position :: Double -> Double
|
discrete, linear, resize, position :: Double -> Double
|
||||||
|
|
||||||
discrete x | x < 0.33 = 0
|
discrete x | x < 0.33 = 0
|
||||||
|
@ -32,6 +32,9 @@ import Foreign.C.Types
|
|||||||
-- > [ ...
|
-- > [ ...
|
||||||
-- > , ((modMask, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) ]
|
-- > , ((modMask, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) ]
|
||||||
|
|
||||||
|
-- %import qualified XMonadContrib.FlexibleResize as Flex
|
||||||
|
-- %mousebind , ((modMask, button3), (\\w -> focus w >> Flex.mouseResizeWindow w))
|
||||||
|
|
||||||
mouseResizeWindow :: Window -> X ()
|
mouseResizeWindow :: Window -> X ()
|
||||||
mouseResizeWindow w = whenX (isClient w) $ withDisplay $ \d -> do
|
mouseResizeWindow w = whenX (isClient w) $ withDisplay $ \d -> do
|
||||||
io $ raiseWindow d w
|
io $ raiseWindow d w
|
||||||
|
@ -27,6 +27,12 @@ import XMonad
|
|||||||
-- > ++ [((mod4Mask, k), focusNth i)
|
-- > ++ [((mod4Mask, k), focusNth i)
|
||||||
-- > | (i, k) <- zip [0 .. 8] [xK_1 ..]]
|
-- > | (i, k) <- zip [0 .. 8] [xK_1 ..]]
|
||||||
|
|
||||||
|
-- %import XMonadContrib.FocusNth
|
||||||
|
-- %keybdindextra ++
|
||||||
|
-- %keybdindextra -- mod4-[1..9] @@ Switch to window N
|
||||||
|
-- %keybdindextra [((mod4Mask, k), focusNth i)
|
||||||
|
-- %keybdindextra | (i, k) <- zip [0 .. 8] [xK_1 ..]]
|
||||||
|
|
||||||
focusNth :: Int -> X ()
|
focusNth :: Int -> X ()
|
||||||
focusNth = windows . modify' . focusNth'
|
focusNth = windows . modify' . focusNth'
|
||||||
|
|
||||||
|
@ -27,6 +27,10 @@ import XMonadContrib.LayoutHelpers ( layoutModify, idModMod )
|
|||||||
-- > import XMonadContrib.LayoutHints
|
-- > import XMonadContrib.LayoutHints
|
||||||
-- > defaultLayouts = [ layoutHints tiled , layoutHints $ mirror tiled ]
|
-- > defaultLayouts = [ layoutHints tiled , layoutHints $ mirror tiled ]
|
||||||
|
|
||||||
|
-- %import XMonadContrib.LayoutHints
|
||||||
|
-- %layout , layoutHints tiled
|
||||||
|
-- %layout , layoutHints $ mirror tiled
|
||||||
|
|
||||||
-- | Expand a size by the given multiple of the border width. The
|
-- | Expand a size by the given multiple of the border width. The
|
||||||
-- multiple is most commonly 1 or -1.
|
-- multiple is most commonly 1 or -1.
|
||||||
adjBorders :: Dimension -> D -> D
|
adjBorders :: Dimension -> D -> D
|
||||||
|
@ -40,6 +40,10 @@ import Graphics.X11.Xlib.Extras
|
|||||||
-- > , ((modMask .|. shiftMask, xK_space), layoutScreens 2 (twoPane 0.5 0.5))
|
-- > , ((modMask .|. shiftMask, xK_space), layoutScreens 2 (twoPane 0.5 0.5))
|
||||||
-- > , ((controlMask .|. modMask .|. shiftMask, xK_space), rescreen)
|
-- > , ((controlMask .|. modMask .|. shiftMask, xK_space), rescreen)
|
||||||
|
|
||||||
|
-- %import XMonadContrib.LayoutScreens
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_space), layoutScreens 2 (twoPane 0.5 0.5))
|
||||||
|
-- %keybind , ((controlMask .|. modMask .|. shiftMask, xK_space), rescreen)
|
||||||
|
|
||||||
layoutScreens :: Int -> Layout Int -> X ()
|
layoutScreens :: Int -> Layout Int -> X ()
|
||||||
layoutScreens nscr _ | nscr < 1 = trace $ "Can't layoutScreens with only " ++ show nscr ++ " screens."
|
layoutScreens nscr _ | nscr < 1 = trace $ "Can't layoutScreens with only " ++ show nscr ++ " screens."
|
||||||
layoutScreens nscr l =
|
layoutScreens nscr l =
|
||||||
|
@ -24,6 +24,10 @@ import StackSet
|
|||||||
-- > import XMonadContrib.MagicFocus
|
-- > import XMonadContrib.MagicFocus
|
||||||
-- > defaultLayouts = [ magicFocus tiled , magicFocus $ mirror tiled ]
|
-- > defaultLayouts = [ magicFocus tiled , magicFocus $ mirror tiled ]
|
||||||
|
|
||||||
|
-- %import XMonadContrib.MagicFocus
|
||||||
|
-- %layout , magicFocus tiled
|
||||||
|
-- %layout , magicFocus $ mirror tiled
|
||||||
|
|
||||||
magicFocus :: Layout Window -> Layout Window
|
magicFocus :: Layout Window -> Layout Window
|
||||||
magicFocus l = l { doLayout = \r s -> withWindowSet (return . peek) >>= (doLayout l) r . swap s
|
magicFocus l = l { doLayout = \r s -> withWindowSet (return . peek) >>= (doLayout l) r . swap s
|
||||||
, modifyLayout = \x -> fmap magicFocus `fmap` modifyLayout l x }
|
, modifyLayout = \x -> fmap magicFocus `fmap` modifyLayout l x }
|
||||||
|
@ -30,6 +30,10 @@ import XMonadContrib.LayoutHelpers
|
|||||||
-- > import XMonadContrib.Magnifier
|
-- > import XMonadContrib.Magnifier
|
||||||
-- > defaultLayouts = [ magnifier tiled , magnifier $ mirror tiled ]
|
-- > defaultLayouts = [ magnifier tiled , magnifier $ mirror tiled ]
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Magnifier
|
||||||
|
-- %layout , magnifier tiled
|
||||||
|
-- %layout , magnifier $ mirror tiled
|
||||||
|
|
||||||
-- | Increase the size of the window that has focus, unless it is the master window.
|
-- | Increase the size of the window that has focus, unless it is the master window.
|
||||||
magnifier :: Layout Window -> Layout Window
|
magnifier :: Layout Window -> Layout Window
|
||||||
magnifier = layoutModify (unlessMaster applyMagnifier) idModMod
|
magnifier = layoutModify (unlessMaster applyMagnifier) idModMod
|
||||||
|
10
Mosaic.hs
10
Mosaic.hs
@ -59,6 +59,16 @@ import XMonadContrib.Anneal
|
|||||||
-- > , ((controlMask .|. modMask .|. shiftMask, xK_o ), withNamedWindow (sendMessage . flexibleWindow))
|
-- > , ((controlMask .|. modMask .|. shiftMask, xK_o ), withNamedWindow (sendMessage . flexibleWindow))
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Mosaic
|
||||||
|
-- %keybind , ((controlMask .|. modMask .|. shiftMask, xK_h), withNamedWindow (sendMessage . tallWindow))
|
||||||
|
-- %keybind , ((controlMask .|. modMask .|. shiftMask, xK_l), withNamedWindow (sendMessage . wideWindow))
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_h ), withNamedWindow (sendMessage . shrinkWindow))
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_l ), withNamedWindow (sendMessage . expandWindow))
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_s ), withNamedWindow (sendMessage . squareWindow))
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_o ), withNamedWindow (sendMessage . myclearWindow))
|
||||||
|
-- %keybind , ((controlMask .|. modMask .|. shiftMask, xK_o ), withNamedWindow (sendMessage . flexibleWindow))
|
||||||
|
-- %layout , mosaic 0.25 0.5 M.empty
|
||||||
|
|
||||||
data HandleWindow = ExpandWindow NamedWindow | ShrinkWindow NamedWindow
|
data HandleWindow = ExpandWindow NamedWindow | ShrinkWindow NamedWindow
|
||||||
| SquareWindow NamedWindow | ClearWindow NamedWindow
|
| SquareWindow NamedWindow | ClearWindow NamedWindow
|
||||||
| TallWindow NamedWindow | WideWindow NamedWindow
|
| TallWindow NamedWindow | WideWindow NamedWindow
|
||||||
|
@ -40,6 +40,10 @@ import {-# SOURCE #-} Config (borderWidth)
|
|||||||
--
|
--
|
||||||
-- > defaultLayouts = [ noBorders full, ... ]
|
-- > defaultLayouts = [ noBorders full, ... ]
|
||||||
|
|
||||||
|
-- %import XMonadContrib.NoBorders
|
||||||
|
-- %layout -- prepend noBorders to default layouts above to remove their borders, like so:
|
||||||
|
-- %layout , noBorders full
|
||||||
|
|
||||||
noBorders :: Layout a -> Layout a
|
noBorders :: Layout a -> Layout a
|
||||||
noBorders = withBorder 0
|
noBorders = withBorder 0
|
||||||
|
|
||||||
|
@ -30,6 +30,9 @@ import XMonadContrib.LayoutHelpers ( idModify )
|
|||||||
-- > import XMonadContrib.Roledex
|
-- > import XMonadContrib.Roledex
|
||||||
-- > defaultLayouts = [ roledex ]
|
-- > defaultLayouts = [ roledex ]
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Roledex
|
||||||
|
-- %layout , roledex
|
||||||
|
|
||||||
roledex :: Eq a => Layout a
|
roledex :: Eq a => Layout a
|
||||||
roledex = Layout { doLayout = roledexLayout, modifyLayout = idModify }
|
roledex = Layout { doLayout = roledexLayout, modifyLayout = idModify }
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@ import XMonad
|
|||||||
-- This operation will rotate all windows except the master window, while the focus
|
-- This operation will rotate all windows except the master window, while the focus
|
||||||
-- stays where it is. It is usefull together with the TwoPane-Layout (see XMonadContrib.TwoPane).
|
-- stays where it is. It is usefull together with the TwoPane-Layout (see XMonadContrib.TwoPane).
|
||||||
|
|
||||||
|
-- %import XMonadContrib.RotSlaves
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_Tab ), rotSlavesUp)
|
||||||
|
|
||||||
rotSlavesUp,rotSlavesDown :: X ()
|
rotSlavesUp,rotSlavesDown :: X ()
|
||||||
rotSlavesUp = windows $ modify' (rotSlaves' (\l -> (tail l)++[head l]))
|
rotSlavesUp = windows $ modify' (rotSlaves' (\l -> (tail l)++[head l]))
|
||||||
rotSlavesDown = windows $ modify' (rotSlaves' (\l -> [last l]++(init l)))
|
rotSlavesDown = windows $ modify' (rotSlaves' (\l -> [last l]++(init l)))
|
||||||
|
@ -35,6 +35,10 @@ import qualified Operations as O
|
|||||||
-- > , ((modMask .|. shiftMask, xK_Right), rotView True)
|
-- > , ((modMask .|. shiftMask, xK_Right), rotView True)
|
||||||
-- > , ((modMask .|. shiftMask, xK_Left), rotView False)
|
-- > , ((modMask .|. shiftMask, xK_Left), rotView False)
|
||||||
|
|
||||||
|
-- %import XMonadContrib.RotView
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_Right), rotView True)
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_Left), rotView False)
|
||||||
|
|
||||||
rotView :: Bool -> X ()
|
rotView :: Bool -> X ()
|
||||||
rotView b = do
|
rotView b = do
|
||||||
ws <- gets windowset
|
ws <- gets windowset
|
||||||
|
@ -48,6 +48,11 @@ import System.Environment
|
|||||||
-- > , ((modMask .|. controlMask, xK_x), shellPrompt defaultXPConfig)
|
-- > , ((modMask .|. controlMask, xK_x), shellPrompt defaultXPConfig)
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- %cabalbuilddep readline>=1.0
|
||||||
|
-- %import XMonadContrib.XPrompt
|
||||||
|
-- %import XMonadContrib.ShellPrompt
|
||||||
|
-- %keybind , ((modMask .|. controlMask, xK_x), shellPrompt defaultXPConfig)
|
||||||
|
|
||||||
data Shell = Shell
|
data Shell = Shell
|
||||||
|
|
||||||
instance XPrompt Shell where
|
instance XPrompt Shell where
|
||||||
|
@ -32,5 +32,8 @@ import XMonad
|
|||||||
--
|
--
|
||||||
-- a popup date menu will now be bound to mod-d
|
-- a popup date menu will now be bound to mod-d
|
||||||
|
|
||||||
|
-- %import XMonadContrib.SimpleDate
|
||||||
|
-- %keybind , ((modMask, xK_d ), date)
|
||||||
|
|
||||||
date :: X ()
|
date :: X ()
|
||||||
date = spawn "(date; sleep 10) | dzen2"
|
date = spawn "(date; sleep 10) | dzen2"
|
||||||
|
@ -25,6 +25,9 @@ import Graphics.X11.Xlib
|
|||||||
-- > import XMonadContrib.SinkAll
|
-- > import XMonadContrib.SinkAll
|
||||||
-- > keys = [ ((modMask .|. shiftMask, xK_t), sinkAll) ]
|
-- > keys = [ ((modMask .|. shiftMask, xK_t), sinkAll) ]
|
||||||
|
|
||||||
|
-- %import XMonadContrib.SinkAll
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_t), sinkAll)
|
||||||
|
|
||||||
sinkAll :: X ()
|
sinkAll :: X ()
|
||||||
sinkAll = withAll sink
|
sinkAll = withAll sink
|
||||||
|
|
||||||
|
@ -33,11 +33,10 @@ import XMonadContrib.LayoutHelpers
|
|||||||
--
|
--
|
||||||
-- > import XMonadContrib.Spiral
|
-- > import XMonadContrib.Spiral
|
||||||
--
|
--
|
||||||
-- > defaultLayouts :: [Layout]
|
-- > defaultLayouts = [ full, spiral (1 % 1), ... ]
|
||||||
-- > defaultLayouts = [ full,
|
|
||||||
-- > tall defaultWindowsInMaster defaultDelta (1%2),
|
-- %import XMonadContrib.Spiral
|
||||||
-- > wide defaultWindowsInMaster defaultDelta (1%2),
|
-- %layout , spiral (1 % 1)
|
||||||
-- > spiral (1 % 1) ]
|
|
||||||
|
|
||||||
fibs :: [Integer]
|
fibs :: [Integer]
|
||||||
fibs = 1 : 1 : (zipWith (+) fibs (tail fibs))
|
fibs = 1 : 1 : (zipWith (+) fibs (tail fibs))
|
||||||
|
@ -38,6 +38,8 @@ import XMonadContrib.LayoutHelpers ( l2lModDo, idModify )
|
|||||||
-- > [(twoPane 0.03 0.2,1),(combo [(twoPane 0.03 0.8,1),(square,1)]
|
-- > [(twoPane 0.03 0.2,1),(combo [(twoPane 0.03 0.8,1),(square,1)]
|
||||||
-- > [(tabbed,3),(tabbed,30),(tabbed,1),(tabbed,1)]
|
-- > [(tabbed,3),(tabbed,30),(tabbed,1),(tabbed,1)]
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Square
|
||||||
|
|
||||||
square :: Layout a
|
square :: Layout a
|
||||||
square = Layout { doLayout = l2lModDo arrange, modifyLayout = idModify }
|
square = Layout { doLayout = l2lModDo arrange, modifyLayout = idModify }
|
||||||
where arrange :: Rectangle -> [a] -> [(a, Rectangle)]
|
where arrange :: Rectangle -> [a] -> [(a, Rectangle)]
|
||||||
|
@ -37,6 +37,10 @@ import System.Environment
|
|||||||
-- > , ((modMask .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
|
-- > , ((modMask .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- %import XMonadContrib.XPrompt
|
||||||
|
-- %import XMonadContrib.SshPrompt
|
||||||
|
-- %keybind , ((modMask .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
|
||||||
|
|
||||||
data Ssh = Ssh
|
data Ssh = Ssh
|
||||||
|
|
||||||
instance XPrompt Ssh where
|
instance XPrompt Ssh where
|
||||||
|
@ -43,6 +43,14 @@ anyModifier will not work, because that is a special value passed to XGrabKey()
|
|||||||
and not an actual modifier.
|
and not an actual modifier.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Submap
|
||||||
|
-- %keybind , ((modMask, xK_a), submap . M.fromList $
|
||||||
|
-- %keybind [ ((0, xK_n), spawn "mpc next")
|
||||||
|
-- %keybind , ((0, xK_p), spawn "mpc prev")
|
||||||
|
-- %keybind , ((0, xK_z), spawn "mpc random")
|
||||||
|
-- %keybind , ((0, xK_space), spawn "mpc toggle")
|
||||||
|
-- %keybind ])
|
||||||
|
|
||||||
submap :: M.Map (KeyMask, KeySym) (X ()) -> X ()
|
submap :: M.Map (KeyMask, KeySym) (X ()) -> X ()
|
||||||
submap keys = do
|
submap keys = do
|
||||||
XConf { theRoot = root, display = d } <- ask
|
XConf { theRoot = root, display = d } <- ask
|
||||||
|
@ -51,6 +51,9 @@ import XMonadContrib.LayoutHelpers ( idModify )
|
|||||||
-- > defaultLayouts = [ tabbed shrinkText myconfig
|
-- > defaultLayouts = [ tabbed shrinkText myconfig
|
||||||
-- > , ... ]
|
-- > , ... ]
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Tabbed
|
||||||
|
-- %layout , tabbed shrinkText defaultTConf
|
||||||
|
|
||||||
data TConf =
|
data TConf =
|
||||||
TConf { activeColor :: String
|
TConf { activeColor :: String
|
||||||
, inactiveColor :: String
|
, inactiveColor :: String
|
||||||
|
@ -37,7 +37,10 @@ import Graphics.X11.Xlib
|
|||||||
--
|
--
|
||||||
-- and add, to the list of layouts:
|
-- and add, to the list of layouts:
|
||||||
--
|
--
|
||||||
-- > threeCol
|
-- > threeCol nmaster delta ratio
|
||||||
|
|
||||||
|
-- %import XMonadContrib.ThreeColumns
|
||||||
|
-- %layout , threeCol nmaster delta ratio
|
||||||
|
|
||||||
threeCol :: Int -> Rational -> Rational -> Layout a
|
threeCol :: Int -> Rational -> Rational -> Layout a
|
||||||
threeCol nmaster delta frac =
|
threeCol nmaster delta frac =
|
||||||
|
@ -32,7 +32,10 @@ import StackSet ( focus, up, down)
|
|||||||
--
|
--
|
||||||
-- and add, to the list of layouts:
|
-- and add, to the list of layouts:
|
||||||
--
|
--
|
||||||
-- > twoPane defaultDelta (1%2)
|
-- > twoPane delta (1%2)
|
||||||
|
|
||||||
|
-- %import XMonadContrib.TwoPane
|
||||||
|
-- %layout , twoPane delta (1%2)
|
||||||
|
|
||||||
twoPane :: Rational -> Rational -> Layout a
|
twoPane :: Rational -> Rational -> Layout a
|
||||||
twoPane delta split = Layout { doLayout = \r s -> return (arrange r s,Nothing), modifyLayout = message }
|
twoPane delta split = Layout { doLayout = \r s -> return (arrange r s,Nothing), modifyLayout = message }
|
||||||
|
7
Warp.hs
7
Warp.hs
@ -45,6 +45,13 @@ my Config.hs:
|
|||||||
Note that warping to a particular screen may change the focus.
|
Note that warping to a particular screen may change the focus.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
-- %import XMonadContrib.Warp
|
||||||
|
-- %keybind , ((modMask, xK_z ), warpToWindow (1%2) (1%2)) -- @@ Move pointer to currently focused window
|
||||||
|
-- %keybindlist ++
|
||||||
|
-- %keybindlist -- mod-ctrl-{w,e,r} @@ Move mouse pointer to screen 1, 2, or 3
|
||||||
|
-- %keybindlist [((modMask .|. controlMask, key), warpToScreen sc (1%2) (1%2))
|
||||||
|
-- %keybindlist | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]]
|
||||||
|
|
||||||
fraction :: (Integral a, Integral b) => Rational -> a -> b
|
fraction :: (Integral a, Integral b) => Rational -> a -> b
|
||||||
fraction f x = floor (f * fromIntegral x)
|
fraction f x = floor (f * fromIntegral x)
|
||||||
|
|
||||||
|
@ -46,6 +46,12 @@ import XMonadContrib.XPrompt ( defaultXPConfig )
|
|||||||
--
|
--
|
||||||
-- > , ((modMask .|. shiftMask, xK_x ), changeDir defaultXPConfig)
|
-- > , ((modMask .|. shiftMask, xK_x ), changeDir defaultXPConfig)
|
||||||
|
|
||||||
|
-- %import XMonadContrib.WorkspaceDir
|
||||||
|
-- %keybind , ((modMask .|. shiftMask, xK_x ), changeDir defaultXPConfig)
|
||||||
|
-- %layout -- prepend 'map (workspaceDir "~")' to defaultLayouts definition above,
|
||||||
|
-- %layout -- just before the list, like the following (don't uncomment next line):
|
||||||
|
-- %layout -- defaultLayouts = map (workspaceDir "~") [ tiled, ... ]
|
||||||
|
|
||||||
|
|
||||||
data Chdir = Chdir String deriving ( Typeable )
|
data Chdir = Chdir String deriving ( Typeable )
|
||||||
instance Message Chdir
|
instance Message Chdir
|
||||||
|
@ -34,6 +34,10 @@ import XMonadContrib.Commands (defaultCommands, runCommand')
|
|||||||
-- > , ((modMask .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
|
-- > , ((modMask .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- %import XMonadContrib.XPrompt
|
||||||
|
-- %import XMonadContrib.XMonadPrompt
|
||||||
|
-- %keybind , ((modMask .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
|
||||||
|
|
||||||
data XMonad = XMonad
|
data XMonad = XMonad
|
||||||
|
|
||||||
instance XPrompt XMonad where
|
instance XPrompt XMonad where
|
||||||
|
206
scripts/generate-configs.sh
Normal file
206
scripts/generate-configs.sh
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# generate-configs.sh - Docstring parser for generating xmonad build configs
|
||||||
|
# with default settings for extensions
|
||||||
|
# Author: Alex Tarkovsky <alextarkovsky@gmail.com>
|
||||||
|
# Released into the public domain
|
||||||
|
|
||||||
|
# This script parses custom docstrings specifying build-time configuration data
|
||||||
|
# from xmonad extension source files, then inserts the data into copies of
|
||||||
|
# xmonad's Config.hs and xmonad.cabal files accordingly.
|
||||||
|
#
|
||||||
|
# Usage: generate-configs.sh PATH_TO_CONTRIBS
|
||||||
|
#
|
||||||
|
# Run this script from the directory containing xmonad's main Config.hs and
|
||||||
|
# xmonad.cabal files, otherwise you'll need to change the value of
|
||||||
|
# $REPO_DIR_BASE below.
|
||||||
|
#
|
||||||
|
# The docstring markup can be extended as needed. Currently the following tags
|
||||||
|
# are defined, shown with some examples:
|
||||||
|
#
|
||||||
|
# ~~~~~
|
||||||
|
#
|
||||||
|
# %cabalbuilddep
|
||||||
|
#
|
||||||
|
# Cabal build dependency. Value is appended to the "build-depends" line in
|
||||||
|
# xmonad.cabal and automatically prefixed with ", ". NB: Don't embed
|
||||||
|
# comments in this tag!
|
||||||
|
#
|
||||||
|
# -- %cabalbuilddep readline>=1.0
|
||||||
|
#
|
||||||
|
# %def
|
||||||
|
#
|
||||||
|
# General definition. Value is appended to the end of Config.sh.
|
||||||
|
#
|
||||||
|
# -- %def commands :: [(String, X ())]
|
||||||
|
# -- %def commands = defaultCommands
|
||||||
|
#
|
||||||
|
# %import
|
||||||
|
#
|
||||||
|
# Module needed by Config.sh to build the extension. Value is appended to
|
||||||
|
# the end of the default import list in Config.sh and automatically
|
||||||
|
# prefixed with "import ".
|
||||||
|
#
|
||||||
|
# -- %import XMonadContrib.Accordion
|
||||||
|
# -- %import qualified XMonadContrib.FlexibleManipulate as Flex
|
||||||
|
#
|
||||||
|
# %keybind
|
||||||
|
#
|
||||||
|
# Tuple defining a key binding. Must be prefixed with ", ". Value is
|
||||||
|
# inserted at the end of the "keys" list in Config.sh.
|
||||||
|
#
|
||||||
|
# -- %keybind , ((modMask, xK_d), date)
|
||||||
|
#
|
||||||
|
# %keybindlist
|
||||||
|
#
|
||||||
|
# Same as %keybind, but instead of a key binding tuple the definition is a
|
||||||
|
# list of key binding tuples (or a list comprehension producing them). This
|
||||||
|
# list is concatenated to the "keys" list must begin with the "++" operator
|
||||||
|
# rather than ", ".
|
||||||
|
#
|
||||||
|
# -- %keybindlist ++
|
||||||
|
# -- %keybindlist -- mod-[1..9] @@ Switch to workspace N
|
||||||
|
# -- %keybindlist -- mod-shift-[1..9] @@ Move client to workspace N
|
||||||
|
# -- %keybindlist -- mod-control-shift-[1..9] @@ Copy client to workspace N
|
||||||
|
# -- %keybindlist [((m .|. modMask, k), f i)
|
||||||
|
# -- %keybindlist | (i, k) <- zip [0..fromIntegral (workspaces-1)] [xK_1 ..]
|
||||||
|
# -- %keybindlist , (f, m) <- [(view, 0), (shift, shiftMask), (copy, shiftMask .|. controlMask)]]
|
||||||
|
#
|
||||||
|
# %layout
|
||||||
|
#
|
||||||
|
# A layout. Must be prefixed with ", ". Value is inserted at the end of the
|
||||||
|
# "defaultLayouts" list in Config.sh.
|
||||||
|
#
|
||||||
|
# -- %layout , accordion
|
||||||
|
#
|
||||||
|
# %mousebind
|
||||||
|
#
|
||||||
|
# Tuple defining a mouse binding. Must be prefixed with ", ". Value is
|
||||||
|
# inserted at the end of the "mouseBindings" list in Config.sh.
|
||||||
|
#
|
||||||
|
# -- %mousebind , ((modMask, button3), (\\w -> focus w >> Flex.mouseResizeWindow w))
|
||||||
|
#
|
||||||
|
# ~~~~~
|
||||||
|
#
|
||||||
|
# NB: '/' and '\' characters must be escaped with a '\' character!
|
||||||
|
#
|
||||||
|
# Tags may also contain comments, as illustrated in the %keybindlist examples
|
||||||
|
# above. Comments are a good place for special user instructions:
|
||||||
|
#
|
||||||
|
# -- %def -- comment out default logHook definition above if you uncomment this:
|
||||||
|
# -- %def logHook = dynamicLog
|
||||||
|
|
||||||
|
if [[ -z "$1" || $# > 1 || ! -d "$1" ]] ; then
|
||||||
|
echo "Usage: generate-configs.sh PATH_TO_CONTRIB"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
REPO_DIR_BASE="."
|
||||||
|
|
||||||
|
CABAL_FILE_BASE="${REPO_DIR_BASE}/xmonad.cabal"
|
||||||
|
CABAL_FILE_CONTRIB="${1}/xmonad.cabal"
|
||||||
|
|
||||||
|
CONFIG_FILE_BASE="${REPO_DIR_BASE}/Config.hs"
|
||||||
|
CONFIG_FILE_CONTRIB="${1}/Config.hs"
|
||||||
|
|
||||||
|
# Markup tag to search for in source files.
|
||||||
|
TAG_CABALBUILDDEP="%cabalbuilddep"
|
||||||
|
TAG_DEF="%def"
|
||||||
|
TAG_IMPORT="%import"
|
||||||
|
TAG_KEYBIND="%keybind"
|
||||||
|
TAG_KEYBINDLIST="%keybindlist"
|
||||||
|
TAG_LAYOUT="%layout"
|
||||||
|
TAG_MOUSEBIND="%mousebind"
|
||||||
|
|
||||||
|
# Insert markers to search for in Config.sh and xmonad.cabal. Values are
|
||||||
|
# extended sed regular expressions.
|
||||||
|
INS_MARKER_CABALBUILDDEP='^build-depends:.*'
|
||||||
|
INS_MARKER_DEF='-- Extension-provided definitions$'
|
||||||
|
INS_MARKER_IMPORT='-- Extension-provided imports$'
|
||||||
|
INS_MARKER_KEYBIND='-- Extension-provided key bindings$'
|
||||||
|
INS_MARKER_KEYBINDLIST='-- Extension-provided key bindings lists$'
|
||||||
|
INS_MARKER_LAYOUT='-- Extension-provided layouts$'
|
||||||
|
INS_MARKER_MOUSEBIND='-- Extension-provided mouse bindings$'
|
||||||
|
|
||||||
|
# Literal indentation strings. Values may contain escaped chars such as \t.
|
||||||
|
INS_INDENT_CABALBUILDDEP=""
|
||||||
|
INS_INDENT_DEF=""
|
||||||
|
INS_INDENT_IMPORT=""
|
||||||
|
INS_INDENT_KEYBIND=" "
|
||||||
|
INS_INDENT_KEYBINDLIST=" "
|
||||||
|
INS_INDENT_LAYOUT=" "
|
||||||
|
INS_INDENT_MOUSEBIND=" "
|
||||||
|
|
||||||
|
# Prefix applied to inserted values after indent strings have been applied.
|
||||||
|
INS_PREFIX_CABALBUILDDEP=", "
|
||||||
|
INS_PREFIX_DEF="-- "
|
||||||
|
INS_PREFIX_IMPORT="--import "
|
||||||
|
INS_PREFIX_KEYBIND="-- "
|
||||||
|
INS_PREFIX_KEYBINDLIST="-- "
|
||||||
|
INS_PREFIX_LAYOUT="-- "
|
||||||
|
INS_PREFIX_MOUSEBIND="-- "
|
||||||
|
|
||||||
|
cp -f "${CABAL_FILE_BASE}" "${CABAL_FILE_CONTRIB}"
|
||||||
|
cp -f "${CONFIG_FILE_BASE}" "${CONFIG_FILE_CONTRIB}"
|
||||||
|
|
||||||
|
for extension_srcfile in $(ls --color=never -1 "${1}"/*.hs | head -n -1 | sort -r) ; do
|
||||||
|
for tag in $TAG_CABALBUILDDEP \
|
||||||
|
$TAG_DEF \
|
||||||
|
$TAG_IMPORT \
|
||||||
|
$TAG_KEYBIND \
|
||||||
|
$TAG_KEYBINDLIST \
|
||||||
|
$TAG_LAYOUT \
|
||||||
|
$TAG_MOUSEBIND ; do
|
||||||
|
|
||||||
|
ifs="$IFS"
|
||||||
|
IFS=$'\n'
|
||||||
|
tags=( $(sed -n -r -e "s/^.*--\s*${tag}\s//p" "${extension_srcfile}") )
|
||||||
|
IFS="${ifs}"
|
||||||
|
|
||||||
|
case $tag in
|
||||||
|
$TAG_CABALBUILDDEP) ins_indent=$INS_INDENT_CABALBUILDDEP
|
||||||
|
ins_marker=$INS_MARKER_CABALBUILDDEP
|
||||||
|
ins_prefix=$INS_PREFIX_CABALBUILDDEP
|
||||||
|
;;
|
||||||
|
$TAG_DEF) ins_indent=$INS_INDENT_DEF
|
||||||
|
ins_marker=$INS_MARKER_DEF
|
||||||
|
ins_prefix=$INS_PREFIX_DEF
|
||||||
|
;;
|
||||||
|
$TAG_IMPORT) ins_indent=$INS_INDENT_IMPORT
|
||||||
|
ins_marker=$INS_MARKER_IMPORT
|
||||||
|
ins_prefix=$INS_PREFIX_IMPORT
|
||||||
|
;;
|
||||||
|
$TAG_KEYBIND) ins_indent=$INS_INDENT_KEYBIND
|
||||||
|
ins_marker=$INS_MARKER_KEYBIND
|
||||||
|
ins_prefix=$INS_PREFIX_KEYBIND
|
||||||
|
;;
|
||||||
|
$TAG_KEYBINDLIST) ins_indent=$INS_INDENT_KEYBINDLIST
|
||||||
|
ins_marker=$INS_MARKER_KEYBINDLIST
|
||||||
|
ins_prefix=$INS_PREFIX_KEYBINDLIST
|
||||||
|
;;
|
||||||
|
$TAG_LAYOUT) ins_indent=$INS_INDENT_LAYOUT
|
||||||
|
ins_marker=$INS_MARKER_LAYOUT
|
||||||
|
ins_prefix=$INS_PREFIX_LAYOUT
|
||||||
|
;;
|
||||||
|
$TAG_MOUSEBIND) ins_indent=$INS_INDENT_MOUSEBIND
|
||||||
|
ins_marker=$INS_MARKER_MOUSEBIND
|
||||||
|
ins_prefix=$INS_PREFIX_MOUSEBIND
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Insert in reverse so values will ultimately appear in correct order.
|
||||||
|
for i in $( seq $(( ${#tags[*]} - 1 )) -1 0 ) ; do
|
||||||
|
[ -z "${tags[i]}" ] && continue
|
||||||
|
if [[ $tag == $TAG_CABALBUILDDEP ]] ; then
|
||||||
|
sed -i -r -e "s/${ins_marker}/\\0${ins_prefix}${tags[i]}/" "${CABAL_FILE_CONTRIB}"
|
||||||
|
else
|
||||||
|
sed -i -r -e "/${ins_marker}/{G;s/$/${ins_indent}${ins_prefix}${tags[i]}/;}" "${CONFIG_FILE_CONTRIB}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $tag != $TAG_CABALBUILDDEP && -n "${tags}" ]] ; then
|
||||||
|
ins_group_comment="${ins_indent}-- For extension $(basename $extension_srcfile .hs):"
|
||||||
|
sed -i -r -e "/${ins_marker}/{G;s/$/${ins_group_comment}/;}" "${CONFIG_FILE_CONTRIB}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user