xmonad 0.10 → 0.11
raw patch · 10 files changed
+172/−45 lines, 10 filesdep ~X11dep ~base
Dependency ranges changed: X11, base
Files
- README +6/−6
- XMonad/Config.hs +64/−7
- XMonad/Core.hs +7/−3
- XMonad/Main.hsc +9/−4
- XMonad/Operations.hs +28/−5
- man/xmonad.1 +7/−6
- man/xmonad.1.html +27/−9
- man/xmonad.hs +8/−0
- util/GenerateManpage.hs +1/−1
- xmonad.cabal +15/−4
README view
@@ -66,7 +66,7 @@ using GHC 6.6.x, you'll need to build and install Cabal from hackage first: - http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Cabal+ http://hackage.haskell.org/package/Cabal You can check which version you have with the command: @@ -80,9 +80,9 @@ provided. To check whether you've got a package run 'ghc-pkg list some_package_name'. You will need the following packages: - mtl http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mtl- unix http://hackage.haskell.org/cgi-bin/hackage-scripts/package/unix- X11 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/X11+ mtl http://hackage.haskell.org/package/mtl+ unix http://hackage.haskell.org/package/unix+ X11 http://hackage.haskell.org/package/X11 * Build xmonad: @@ -120,7 +120,7 @@ prompt/program launcher, and various other useful modules. XMonadContrib is available at: - latest release: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmonad-contrib+ latest release: http://hackage.haskell.org/package/xmonad-contrib darcs version: darcs get http://code.haskell.org/XMonadContrib @@ -135,7 +135,7 @@ For custom status bars: dzen http://gotmor.googlepages.com/dzen- xmobar http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar+ xmobar http://hackage.haskell.org/package/xmobar For a program dispatch menu:
XMonad/Config.hs view
@@ -27,11 +27,11 @@ import XMonad.Core as XMonad hiding (workspaces,manageHook,keys,logHook,startupHook,borderWidth,mouseBindings ,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor,focusFollowsMouse- ,handleEventHook)+ ,handleEventHook,clickJustFocuses) import qualified XMonad.Core as XMonad (workspaces,manageHook,keys,logHook,startupHook,borderWidth,mouseBindings ,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor,focusFollowsMouse- ,handleEventHook)+ ,handleEventHook,clickJustFocuses) import XMonad.Layout import XMonad.Operations@@ -157,6 +157,11 @@ focusFollowsMouse :: Bool focusFollowsMouse = True +-- | Whether a mouse click select the focus or is just passed to the window+clickJustFocuses :: Bool+clickJustFocuses = True++ -- | The xmonad key bindings. Add, modify or remove key bindings here. -- -- (The comment formatting character is used when generating the manpage)@@ -197,12 +202,13 @@ , ((modMask , xK_comma ), sendMessage (IncMasterN 1)) -- %! Increment the number of windows in the master area , ((modMask , xK_period), sendMessage (IncMasterN (-1))) -- %! Deincrement the number of windows in the master area - -- toggle the status bar gap- --, ((modMask , xK_b ), modifyGap (\i n -> let x = (XMonad.defaultGaps conf ++ repeat (0,0,0,0)) !! i in if n == x then (0,0,0,0) else x)) -- %! Toggle the status bar gap- -- quit, or restart , ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess)) -- %! Quit xmonad , ((modMask , xK_q ), spawn "if type xmonad; then xmonad --recompile && xmonad --restart; else xmessage xmonad not in \\$PATH: \"$PATH\"; fi") -- %! Restart xmonad++ , ((modMask .|. shiftMask, xK_slash ), spawn ("echo \"" ++ help ++ "\" | xmessage -file -")) -- %! Run xmessage with a summary of the default keybindings (useful for beginners)+ -- repeat the binding for non-American layout keyboards+ , ((modMask , xK_question), spawn ("echo \"" ++ help ++ "\" | xmessage -file -")) ] ++ -- mod-[1..9] %! Switch to workspace N@@ -218,7 +224,6 @@ , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] -- | Mouse bindings: default actions bound to mouse events--- mouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ()) mouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList -- mod-button1 %! Set the window to floating mode and move by dragging@@ -232,7 +237,7 @@ -- you may also bind events to the mouse scroll wheel (button4 and button5) ] --- | And, finally, the default set of configuration values itself+-- | The default set of configuration values itself defaultConfig = XConfig { XMonad.borderWidth = borderWidth , XMonad.workspaces = workspaces@@ -248,4 +253,56 @@ , XMonad.manageHook = manageHook , XMonad.handleEventHook = handleEventHook , XMonad.focusFollowsMouse = focusFollowsMouse+ , XMonad.clickJustFocuses = clickJustFocuses }++-- | Finally, a copy of the default bindings in simple textual tabular format.+help :: String+help = unlines ["The default modifier key is 'alt'. Default keybindings:",+ "",+ "-- launching and killing programs",+ "mod-Shift-Enter Launch xterminal",+ "mod-p Launch dmenu",+ "mod-Shift-p Launch gmrun",+ "mod-Shift-c Close/kill the focused window",+ "mod-Space Rotate through the available layout algorithms",+ "mod-Shift-Space Reset the layouts on the current workSpace to default",+ "mod-n Resize/refresh viewed windows to the correct size",+ "",+ "-- move focus up or down the window stack",+ "mod-Tab Move focus to the next window",+ "mod-Shift-Tab Move focus to the previous window",+ "mod-j Move focus to the next window",+ "mod-k Move focus to the previous window",+ "mod-m Move focus to the master window",+ "",+ "-- modifying the window order",+ "mod-Return Swap the focused window and the master window",+ "mod-Shift-j Swap the focused window with the next window",+ "mod-Shift-k Swap the focused window with the previous window",+ "",+ "-- resizing the master/slave ratio",+ "mod-h Shrink the master area",+ "mod-l Expand the master area",+ "",+ "-- floating layer support",+ "mod-t Push window back into tiling; unfloat and re-tile it",+ "",+ "-- increase or decrease number of windows in the master area",+ "mod-comma (mod-,) Increment the number of windows in the master area",+ "mod-period (mod-.) Deincrement the number of windows in the master area",+ "",+ "-- quit, or restart",+ "mod-Shift-q Quit xmonad",+ "mod-q Restart xmonad",+ "mod-[1..9] Switch to workSpace N",+ "",+ "-- Workspaces & screens",+ "mod-Shift-[1..9] Move client to workspace N",+ "mod-{w,e,r} Switch to physical/Xinerama screens 1, 2, or 3",+ "mod-Shift-{w,e,r} Move client to screen 1, 2, or 3",+ "",+ "-- Mouse bindings: default actions bound to mouse events",+ "mod-button1 Set the window to floating mode and move by dragging",+ "mod-button2 Raise the window to the top of the stack",+ "mod-button3 Set the window to floating mode and resize by dragging"]
XMonad/Core.hs view
@@ -26,7 +26,7 @@ runX, catchX, userCode, userCodeDef, io, catchIO, installSignalHandlers, uninstallSignalHandlers, withDisplay, withWindowSet, isRoot, runOnWorkspaces, getAtom, spawn, spawnPID, xfork, getXMonadDir, recompile, trace, whenJust, whenX,- atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, ManageHook, Query(..), runQuery+ atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_TAKE_FOCUS, ManageHook, Query(..), runQuery ) where import XMonad.StackSet hiding (modify)@@ -86,6 +86,8 @@ , mousePosition :: !(Maybe (Position, Position)) -- ^ position of the mouse according to -- the event currently being processed+ , currentEvent :: !(Maybe Event)+ -- ^ event currently being processed } -- todo, better name@@ -108,6 +110,7 @@ , logHook :: !(X ()) -- ^ The action to perform when the windows set is changed , startupHook :: !(X ()) -- ^ The action to perform on startup , focusFollowsMouse :: !Bool -- ^ Whether window entry events can change focus+ , clickJustFocuses :: !Bool -- ^ False to make a click which changes focus to be additionally passed to the window } @@ -202,10 +205,11 @@ getAtom str = withDisplay $ \dpy -> io $ internAtom dpy str False -- | Common non-predefined atoms-atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_STATE :: X Atom+atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_STATE, atom_WM_TAKE_FOCUS :: X Atom atom_WM_PROTOCOLS = getAtom "WM_PROTOCOLS" atom_WM_DELETE_WINDOW = getAtom "WM_DELETE_WINDOW" atom_WM_STATE = getAtom "WM_STATE"+atom_WM_TAKE_FOCUS = getAtom "WM_TAKE_FOCUS" ------------------------------------------------------------------------ -- LayoutClass handling. See particular instances in Operations.hs@@ -477,7 +481,7 @@ return (status == ExitSuccess) else return True where getModTime f = catch (Just <$> getModificationTime f) (\(SomeException _) -> return Nothing)- isSource = flip elem [".hs",".lhs",".hsc"]+ isSource = flip elem [".hs",".lhs",".hsc"] . takeExtension allFiles t = do let prep = map (t</>) . Prelude.filter (`notElem` [".",".."]) cs <- prep <$> catch (getDirectoryContents t) (\(SomeException _) -> return [])
XMonad/Main.hsc view
@@ -121,7 +121,8 @@ , keyActions = keys xmc xmc , buttonActions = mouseBindings xmc xmc , mouseFocused = False- , mousePosition = Nothing }+ , mousePosition = Nothing+ , currentEvent = Nothing } st = XState { windowset = initialWinset@@ -163,7 +164,7 @@ prehandle e = let mouse = do guard (ev_event_type e `elem` evs) return (fromIntegral (ev_x_root e) ,fromIntegral (ev_y_root e))- in local (\c -> c { mousePosition = mouse }) (handleWithHook e)+ in local (\c -> c { mousePosition = mouse, currentEvent = Just e }) (handleWithHook e) evs = [ keyPress, keyRelease, enterNotify, leaveNotify , buttonPress, buttonRelease] @@ -247,12 +248,16 @@ | t == buttonPress = do -- If it's the root window, then it's something we -- grabbed in grabButtons. Otherwise, it's click-to-focus.+ dpy <- asks display isr <- isRoot w m <- cleanMask $ ev_state e mact <- asks (M.lookup (m, b) . buttonActions) case mact of- (Just act) | isr -> act $ ev_subwindow e- _ -> focus w+ Just act | isr -> act $ ev_subwindow e+ _ -> do+ focus w+ ctf <- asks (clickJustFocuses . config)+ unless ctf $ io (allowEvents dpy replayPointer currentTime) broadcastMessage e -- Always send button events. -- entered a normal window: focus it if focusFollowsMouse is set to
XMonad/Operations.hs view
@@ -24,7 +24,7 @@ import Data.Maybe import Data.Monoid (Endo(..)) import Data.List (nub, (\\), find)-import Data.Bits ((.|.), (.&.), complement)+import Data.Bits ((.|.), (.&.), complement, testBit) import Data.Ratio import qualified Data.Map as M import qualified Data.Set as S@@ -283,11 +283,14 @@ -- | setButtonGrab. Tell whether or not to intercept clicks on a given window setButtonGrab :: Bool -> Window -> X ()-setButtonGrab grab w = withDisplay $ \d -> io $- if grab+setButtonGrab grab w = do+ pointerMode <- asks $ \c -> if clickJustFocuses (config c)+ then grabModeAsync+ else grabModeSync+ withDisplay $ \d -> io $ if grab then forM_ [button1, button2, button3] $ \b -> grabButton d b anyModifier w False buttonPressMask- grabModeAsync grabModeSync none none+ pointerMode grabModeSync none none else ungrabButton d anyButton anyModifier w -- ---------------------------------------------------------------------@@ -325,7 +328,27 @@ -- If we ungrab buttons on the root window, we lose our mouse bindings. whenX (not <$> isRoot w) $ setButtonGrab False w- io $ setInputFocus dpy w revertToPointerRoot 0++ hints <- io $ getWMHints dpy w+ protocols <- io $ getWMProtocols dpy w+ wmprot <- atom_WM_PROTOCOLS+ wmtf <- atom_WM_TAKE_FOCUS+ currevt <- asks currentEvent+ let inputHintSet = wmh_flags hints `testBit` inputHintBit++ when ((inputHintSet && wmh_input hints) || (not inputHintSet)) $+ io $ do setInputFocus dpy w revertToPointerRoot 0+ when (wmtf `elem` protocols) $+ io $ allocaXEvent $ \ev -> do+ setEventType ev clientMessage+ setClientMessageEvent ev w wmprot 32 wmtf $ maybe currentTime event_time currevt+ sendEvent dpy w False noEventMask ev+ where event_time ev =+ if (ev_event_type ev) `elem` timedEvents then+ ev_time ev+ else+ currentTime+ timedEvents = [ keyPress, keyRelease, buttonPress, buttonRelease, enterNotify, leaveNotify, selectionRequest ] ------------------------------------------------------------------------ -- Message handling
man/xmonad.1 view
@@ -1,4 +1,4 @@-.TH xmonad 1 "25 October 09" xmonad-0.10 "xmonad manual".TH "" "" +.TH xmonad 1 "31 December 2012" xmonad-0.11 "xmonad manual".TH "" "" .SH Name .PP xmonad - a tiling window manager@@ -190,11 +190,6 @@ .RS .RE .TP-.B mod-b-Toggle the status bar gap-.RS-.RE-.TP .B mod-shift-q Quit xmonad .RS@@ -202,6 +197,12 @@ .TP .B mod-q Restart xmonad+.RS+.RE+.TP+.B mod-shift-slash+Run xmessage with a summary of the default keybindings (useful for+beginners) .RS .RE .TP
man/xmonad.1.html view
@@ -2,11 +2,31 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />+ <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="generator" content="pandoc" /> <title></title>+ <style type="text/css">+table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {+ margin: 0; padding: 0; vertical-align: baseline; border: none; }+table.sourceCode { width: 100%; }+td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }+td.sourceCode { padding-left: 5px; }+code > span.kw { color: #007020; font-weight: bold; }+code > span.dt { color: #902000; }+code > span.dv { color: #40a070; }+code > span.bn { color: #40a070; }+code > span.fl { color: #40a070; }+code > span.ch { color: #4070a0; }+code > span.st { color: #4070a0; }+code > span.co { color: #60a0b0; font-style: italic; }+code > span.ot { color: #007020; }+code > span.al { color: #ff0000; font-weight: bold; }+code > span.fu { color: #06287e; }+code > span.er { color: #ff0000; font-weight: bold; }+ </style> </head> <body>-<h1>xmonad-0.10</h1><p>Section: xmonad manual (1)<br/>Updated: 25 October 09</p><hr/>+<h1>xmonad-0.11</h1><p>Section: xmonad manual (1)<br/>Updated: 31 December 2012</p><hr/> <div id="TOC"> <ul> <li><a href="#name">Name</a></li>@@ -113,15 +133,15 @@ <dt>mod-period</dt> <dd><p>Deincrement the number of windows in the master area</p> </dd>-<dt>mod-b</dt>-<dd><p>Toggle the status bar gap</p>-</dd> <dt>mod-shift-q</dt> <dd><p>Quit xmonad</p> </dd> <dt>mod-q</dt> <dd><p>Restart xmonad</p> </dd>+<dt>mod-shift-slash</dt>+<dd><p>Run xmessage with a summary of the default keybindings (useful for beginners)</p>+</dd> <dt>mod-[1..9]</dt> <dd><p>Switch to workspace N</p> </dd>@@ -146,16 +166,14 @@ </dl> <h1 id="examples"><a href="#TOC">Examples</a></h1> <p>To use xmonad as your window manager add to your <em>~/.xinitrc</em> file:</p>-<pre class="sourceCode haskell"><code>exec xmonad-</code></pre>+<pre class="sourceCode literate haskell"><code class="sourceCode haskell">exec xmonad</code></pre> <h1 id="customization"><a href="#TOC">Customization</a></h1> <p>xmonad is customized in ~/.xmonad/xmonad.hs, and then restarting with mod-q.</p> <p>You can find many extensions to the core feature set in the xmonad- contrib package, available through your package manager or from <a href="http://xmonad.org">xmonad.org</a>.</p> <h2 id="modular-configuration"><a href="#TOC">Modular Configuration</a></h2> <p>As of <em>xmonad-0.9</em>, any additional Haskell modules may be placed in <em>~/.xmonad/lib/</em> are available in GHC's searchpath. Hierarchical modules are supported: for example, the file <em>~/.xmonad/lib/XMonad/Stack/MyAdditions.hs</em> could contain:</p>-<pre class="sourceCode haskell"><code>module XMonad.Stack.MyAdditions (function1) where- function1 = error "function1: Not implemented yet!"-</code></pre>+<pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="kw">module</span> <span class="dt">XMonad.Stack.MyAdditions</span> (function1) <span class="kw">where</span>+ function1 <span class="fu">=</span> <span class="fu">error</span> <span class="st">"function1: Not implemented yet!"</span></code></pre> <p>Your xmonad.hs may then import XMonad.Stack.MyAdditions as if that module was contained within xmonad or xmonad-contrib.</p> <h1 id="bugs"><a href="#TOC">Bugs</a></h1> <p>Probably. If you find any, please report them to the <a href="http://code.google.com/p/xmonad/issues/list">bugtracker</a></p>
man/xmonad.hs view
@@ -23,6 +23,10 @@ myFocusFollowsMouse :: Bool myFocusFollowsMouse = True +-- Whether clicking on a window to focus also passes the click to the window+myClickJustFocuses :: Bool+myClickJustFocuses = False+ -- Width of the window border in pixels. -- myBorderWidth = 1@@ -123,6 +127,9 @@ -- Restart xmonad , ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")++ -- Run xmessage with a summary of the default keybindings (useful for beginners)+ , ((modMask .|. shiftMask, xK_slash ), spawn ("echo \"" ++ help ++ "\" | xmessage -file -")) ] ++ @@ -255,6 +262,7 @@ -- simple stuff terminal = myTerminal, focusFollowsMouse = myFocusFollowsMouse,+ clickJustFocuses = myClickJustFocuses, borderWidth = myBorderWidth, modMask = myModMask, workspaces = myWorkspaces,
util/GenerateManpage.hs view
@@ -36,7 +36,7 @@ import Text.Pandoc -- works with 1.6 -releaseDate = "18 November 2011"+releaseDate = "31 December 2012" trim :: String -> String trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace
xmonad.cabal view
@@ -1,5 +1,5 @@ name: xmonad-version: 0.10+version: 0.11 homepage: http://xmonad.org synopsis: A tiling window manager description:@@ -20,11 +20,22 @@ extra-source-files: README TODO CONFIG STYLE tests/loc.hs tests/Properties.hs man/xmonad.1.markdown man/xmonad.1 man/xmonad.1.html util/GenerateManpage.hs-cabal-version: >= 1.2+cabal-version: >= 1.6+bug-reports: http://code.google.com/p/xmonad/issues/list build-type: Simple -data-files: man/xmonad.hs+tested-with: GHC==7.6.1,+ GHC==7.4.1,+ GHC==7.2.1,+ GHC==6.12.3,+ GHC==6.10.4 +data-files: man/xmonad.hs, man/xmonad.1, man/xmonad.1.html++source-repository head+ type: darcs+ location: http://code.haskell.org/xmonad+ flag small_base description: Choose the new smaller, split-up base package. @@ -46,7 +57,7 @@ build-depends: base < 5 && >=3, containers, directory, process, filepath, extensible-exceptions else build-depends: base < 3- build-depends: X11>=1.5.0.0 && < 1.6, mtl, unix,+ build-depends: X11>=1.5 && < 1.7, mtl, unix, utf8-string >= 0.3 && < 0.4 if true