darcs patch: XMonad.Config.PlainConfig
I've already pushed this patch (it's a new module, so that should be safe), but I'm creating this thread to make it more visible, since there's likely to be more discussion surrounding it and other configuration alternatives. Braden Shepherdson shepheb New patches: [Added XMonad.Config.PlainConfig: proof-of-concept GHC-less plain text configuration file parser Braden Shepherdson <Braden.Shepherdson@gmail.com>**20080517222916 An example of the config file format can be found in the Haddock. Notably missing features are docks and more layouts than just the standard three. ] { addfile ./XMonad/Config/PlainConfig.hs hunk ./XMonad/Config/PlainConfig.hs 1 +{-# LANGUAGE + FlexibleInstances, + FlexibleContexts, + MultiParamTypeClasses, + ExistentialQuantification + #-} + +------------------------------------------------------------------------- +-- | +-- Module : XMonad.Config.PlainConfig +-- Copyright : Braden Shepherdson <Braden.Shepherdson@gmail.com> +-- License : BSD3 +-- +-- Maintainer : Braden Shepherdson <Braden.Shepherdson@gmail.com> +-- +-- Proof-of-concept (but usable) plain-text configuration file +-- parser, for use instead of xmonad.hs. Does not require recompilation, +-- allowing xmonad to be free of the GHC dependency. +-- +------------------------------------------------------------------------- + + +module XMonad.Config.PlainConfig + ( + -- * Introduction + -- $usage + + -- * Supported Layouts + -- $layouts + + -- * Support Key Bindings + -- $keys + + -- * Other Notes + -- $notes + + -- * Example Config File + -- $example + + plainConfig ,readConfig, checkConfig + ) +where + + +import XMonad +import System.Exit + +import qualified XMonad.StackSet as W +import qualified Data.Map as M +import Data.List +import Data.Maybe (isJust,fromJust) +import Data.Char (isSpace) + + +--import Control.Monad +import Control.Monad.Error +import Control.Monad.Identity + +import Control.Arrow ((&&&)) + +import Text.ParserCombinators.ReadP + +import System.IO +import Control.Exception (bracket) + +import XMonad.Util.EZConfig (mkKeymap) + + + +-- $usage +-- The @xmonad.hs@ file is very minimal when used with PlainConfig. +-- It typically contains only the following: +-- +-- > module Main where +-- > import XMonad +-- > import XMonad.Config.PlainConfig (plainConfig) +-- > main = plainConfig +-- +-- The 'plainConfig' function parses @~\/.xmonad\/xmonad.conf@, +-- the format of which is described below. + + +-- $layouts +-- Only 'Tall', 'Wide' and 'Full' are supported at present. + + + +-- $keys +-- +-- Key bindings are specified as a pair of an arbitrary EZConfig and +-- one of the following: +-- +-- @ Name Haskell equivalent Default binding(s)@ +-- +-- * @spawn \<cmd\> spawn \"\<cmd\>\" none@ +-- +-- * @kill kill M-S-c@ +-- +-- * @nextLayout sendMessage NextLayout M-\<Space\>@ +-- +-- * @refresh refresh M-S-\<Space\>@ +-- +-- * @focusDown windows W.focusDown M-\<Tab\>, M-j@ +-- +-- * @focusUp windows W.focusUp M-k@ +-- +-- * @focusMaster windows W.focusMaster M-m@ +-- +-- * @swapDown windows W.swapDown M-S-j@ +-- +-- * @swapUp windows W.swapUp M-S-k@ +-- +-- * @swapMaster windows W.swapMaster M-\<Return\>@ +-- +-- * @shrink sendMessage Shrink M-h@ +-- +-- * @expand sendMessage Expand M-l@ +-- +-- * @sink withFocused $ windows . W.sink M-t@ +-- +-- * @incMaster sendMessage (IncMasterN 1) M-,@ +-- +-- * @decMaster sendMessage (IncMasterN (-1)) M-.@ +-- +-- * @quit io $ exitWith ExitSuccess M-S-q@ +-- +-- * @restart broadcastMessageReleaseResources >> restart \"xmonad\" True M-q@ +-- + + +-- $notes +-- Submaps are allowed. +-- These settings override the defaults. Changes made here will be used over +-- the default bindings for those keys. + + +-- $example +-- An example @~\/.xmonad\/xmonad.conf@ file follows: +-- +-- @modMask = 3@ +-- +-- @numlockMask = 2@ +-- +-- @borderWidth = 1@ +-- +-- @normalBorderColor = #dddddd@ +-- +-- @focusedBorderColor = #00ff00@ +-- +-- @terminal=urxvt@ +-- +-- @workspaces=[\"1: IRC\",\"2: Web\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]@ +-- +-- @focusFollowsMouse=True@ +-- +-- @layouts=[\"Tall\",\"Full\",\"Wide\"]@ +-- +-- @key=(\"M-x t\", \"spawn xmessage Test\")@ +-- +-- @manageHook=(ClassName \"MPlayer\" , \"float\" )@ +-- +-- @manageHook=(ClassName \"Gimp\" , \"float\" )@ +-- +-- @manageHook=(Resource \"desktop_window\", \"ignore\" )@ +-- +-- @manageHook=(Resource \"kdesktop\" , \"ignore\" )@ +-- +-- @manageHook=(Resource \"gnome-panel\" , \"ignore\" )@ +-- + + + + + + +---------------------------------------------------------------- +------ Several functions for parsing the key-value file. ------- +---------------------------------------------------------------- + +parseKVBy :: Char -> ReadP (String,String) +parseKVBy sep = do + skipSpaces + k <- munch1 (\x -> x /= ' ' && x /= sep) + skipSpaces + char kvSep + skipSpaces + v <- munch1 (\x -> x /= ' ') --or EOS + return (k,v) + +parseKVVBy :: Char -> ReadP (String,String) +parseKVVBy sep = do + skipSpaces + k <- munch1 (\x -> x /= ' ' && x /= sep) + skipSpaces + char kvSep + skipSpaces + v <- munch1 (const True) -- until EOS + return (k,v) + + +kvSep :: Char +kvSep = '=' + +parseKV, parseKVV :: ReadP (String,String) +parseKV = parseKVBy kvSep +parseKVV = parseKVVBy kvSep + + + +readKV :: String -> Integer -> RC (String,String) +readKV s ln = case readP_to_S parseKV s of + [((k,v),"")] -> return (k,v) --single, correct parse + [] -> throwError [(ln,"No parse")] + _ -> do + case readP_to_S parseKVV s of + [((k,v),"")] -> return (k,v) --single, correct parse + [] -> throwError [(ln,"No parse")] + xs -> throwError [(ln,"Ambiguous parse: " + ++ show xs)] + + + +isComment :: String -> Bool +isComment = not . null . readP_to_S parseComment + where parseComment = skipSpaces >> char '#' >> return () + -- null means failed parse, so _not_ a comment. + + +isBlank :: String -> Bool +isBlank = null . filter (not . isSpace) + + +type RC = ErrorT [(Integer,String)] Identity + +instance Error [(Integer,String)] where + noMsg = [(-1, "Unknown error.")] + strMsg s = [(-1, s)] + + +parseFile :: [String] -> RC (XConfig Layout) +parseFile ss = parseLines baseConfig theLines + where theLines = filter (not . liftM2 (||) isComment isBlank . snd) + $ zip [1..] ss + + + +parseLines :: XConfig Layout -> [(Integer,String)] -> RC (XConfig Layout) +parseLines = foldM parse + + +parse :: XConfig Layout -> (Integer, String) -> RC (XConfig Layout) +parse xc (ln,s) = do + (k,v) <- readKV s ln + case M.lookup k commands of + Nothing -> throwError [(ln,"Unknown command: "++k)] + Just f -> f v ln xc + + + + +---------------------------------------------------------------- +-- Now the semantic parts, that convert from the relevant -- +-- key-value entries to values in an XConfig -- +---------------------------------------------------------------- + + + +type Command = String -> Integer -> XConfig Layout -> RC (XConfig Layout) + +commands :: M.Map String Command +commands = M.fromList $ + [("modMask" , cmd_modMask ) + ,("numlockMask" , cmd_numlockMask ) + ,("normalBorderColor" , cmd_normalBorderColor ) + ,("focusedBorderColor" , cmd_focusedBorderColor) + ,("terminal" , cmd_terminal ) + ,("workspaces" , cmd_workspaces ) + ,("focusFollowsMouse" , cmd_focusFollowsMouse ) + ,("layouts" , cmd_layouts ) + ,("key" , cmd_key ) + ,("manageHook" , cmd_manageHook ) + ,("borderWidth" , cmd_borderWidth ) + ] + + +-- | Behind-the-scenes helper for both 'cmd_modMask' and 'cmd_numlockMask'. +genericModKey :: (KeyMask -> XConfig Layout) -> Command +genericModKey f s ln _ = do + x <- rcRead s ln :: RC Integer + case lookup x (zip [1..] [mod1Mask,mod2Mask,mod3Mask,mod4Mask,mod5Mask]) of + Just y -> return $ f y + Nothing -> throwError [(ln,"Invalid mod key number: "++ show x)] + + +-- | Reads the mod key modifier number. +cmd_modMask :: Command +cmd_modMask s ln xc = genericModKey (\k -> xc{modMask = k}) s ln xc + +-- | Reads the numlock key modifier number. +cmd_numlockMask :: Command +cmd_numlockMask s ln xc = genericModKey (\k -> xc{numlockMask = k}) s ln xc + + +-- | Reads the border width. +cmd_borderWidth :: Command +cmd_borderWidth s ln xc = do + w <- rcRead s ln + return $ xc { borderWidth = w } + + +-- | Reads the colors but just keeps them as RRGGBB Strings. +cmd_normalBorderColor, cmd_focusedBorderColor :: Command +cmd_normalBorderColor s _ xc = return $ xc{ normalBorderColor = s } +cmd_focusedBorderColor s _ xc = return $ xc{ focusedBorderColor = s } + + +-- | Reads the terminal. It is just a String, no parsing. +cmd_terminal :: Command +cmd_terminal s _ xc = return $ xc{ terminal = s } + + +-- | Reads the workspace tag list. This is given as a Haskell [String]. +cmd_workspaces :: Command +cmd_workspaces s ln xc = rcRead s ln >>= \x -> return xc{ workspaces = x } + + +-- | Reads the focusFollowsMouse, as a Haskell Bool. +cmd_focusFollowsMouse :: Command +cmd_focusFollowsMouse s ln xc = rcRead s ln >>= + \x -> return xc{focusFollowsMouse = x} + + +-- | The list known layouts, mapped by name. +-- An easy location for improvement is to add more contrib layouts here. +layouts :: M.Map String (Layout Window) +layouts = M.fromList + [("Tall", Layout (Tall 1 (3/100) (1/2))) + ,("Wide", Layout (Mirror (Tall 1 (3/100) (1/2)))) + ,("Full", Layout Full) + ] + + +-- | Expects a [String], the strings being layout names. Quotes required. +-- Draws from the `layouts' list above. +cmd_layouts :: Command +cmd_layouts s ln xc = do + xs <- rcRead s ln -- read the list of strings + let ls = map (id &&& (flip M.lookup) layouts) xs + when (null ls) $ throwError [(ln,"Empty layout list")] + case filter (not . isJust . snd) ls of + [] -> return $ xc{ layoutHook = foldr1 + (\(Layout l) (Layout r) -> + Layout (l ||| r)) (map (fromJust . snd) ls) + } + ys -> throwError $ map (\(x,_) -> (ln, "Unknown layout: "++ x)) ys + + + +-- | A Map from names to key binding actions. +key_actions :: M.Map String (X ()) +key_actions = M.fromList + [("kill" , kill ) + ,("nextLayout" , sendMessage NextLayout ) + --,("prevLayout" , sendMessage PrevLayout ) + --,("resetLayout" , setLayout $ XMonad.layoutHook conf) + ,("refresh" , refresh ) + ,("focusDown" , windows W.focusDown ) + ,("focusUp" , windows W.focusUp ) + ,("focusMaster" , windows W.focusMaster ) + ,("swapMaster" , windows W.swapMaster ) + ,("swapDown" , windows W.swapDown ) + ,("swapUp" , windows W.swapUp ) + ,("shrink" , sendMessage Shrink ) + ,("expand" , sendMessage Expand ) + ,("sink" , withFocused $ windows . W.sink) + ,("incMaster" , sendMessage (IncMasterN 1)) + ,("decMaster" , sendMessage (IncMasterN (-1))) + ,("quit" , io $ exitWith ExitSuccess) + ,("restart" , broadcastMessage ReleaseResources + >> restart "xmonad" True) + ] + + +-- | Expects keys as described in the preamble, as +-- (\"EZConfig key name\", \"action name\"), +-- eg. (\"M-S-t\", \"spawn thunderbird\") +-- One key per "key=" line. +cmd_key :: Command +cmd_key s ln xc = do + (k,v) <- rcRead s ln + if "spawn " `isPrefixOf` v + then return $ xc { + keys = \c -> M.union (mkKeymap c + [(k, spawn (drop 6 v))] + ) ((keys xc) c) + } + else do + case M.lookup v key_actions of + Nothing -> throwError [(ln, "Unknown key action \"" ++ v ++ "\"")] + Just ac -> return $ + xc { keys = \c -> M.union (mkKeymap c [(k, ac)]) + ((keys xc) c) + } + + + +-- | Map of names to actions for 'ManageHook's. +manageHook_actions :: M.Map String ManageHook +manageHook_actions = M.fromList + [("float" , doFloat ) + ,("ignore" , doIgnore ) + ] + + +-- | Parses 'ManageHook's in the form given in the preamble. +-- eg. (ClassName \"MPlayer\", \"float\") +cmd_manageHook :: Command +cmd_manageHook s ln xc = do + (k,v) <- rcRead s ln + let q = parseQuery k + if "toWorkspace " `isPrefixOf` v + then return $ xc { manageHook = manageHook xc <+> + (q --> doShift (drop 12 v)) + } + else case M.lookup v manageHook_actions of + Nothing -> throwError [(ln, "Unknown ManageHook action \"" + ++ v ++ "\"")] + Just ac -> return $ xc { manageHook = manageHook xc <+> (q --> ac) } + + + +-- | Core of the ManageHook expression parser. +-- Taken from Roman Cheplyaka's WindowProperties +parseQuery :: Property -> Query Bool +parseQuery (Title s) = title =? s +parseQuery (ClassName s) = className =? s +parseQuery (Resource s) = resource =? s +parseQuery (And p q) = parseQuery p <&&> parseQuery q +parseQuery (Or p q) = parseQuery p <&&> parseQuery q +parseQuery (Not p) = not `fmap` parseQuery p +parseQuery (Const b) = return b + + +-- | Property constructors are quite self-explaining. +-- Taken from Roman Cheplyaka's WindowProperties +data Property = Title String + | ClassName String + | Resource String + | And Property Property + | Or Property Property + | Not Property + | Const Bool + deriving (Read, Show) + + + +-- | A wrapping of the read function into the RC monad. +rcRead :: (Read a) => String -> Integer -> RC a +rcRead s ln = case reads s of + [(x,"")] -> return x + _ -> throwError [(ln, "Failed to parse value")] + + + +-- | The standard Config.hs 'defaultConfig', with the layout wrapped. +baseConfig :: XConfig Layout +baseConfig = defaultConfig{ layoutHook = Layout (layoutHook defaultConfig) } + + + +-- | Core function that attempts to parse @~\/.xmonad\/xmonad.conf@ +readConfig :: IO (Maybe (XConfig Layout)) +readConfig = do + cs <- bracket (openFile "/home/braden/.xmonad/xmonad.conf" ReadMode) + (\h -> hClose h) -- vv force the lazy IO + (\h -> (lines `fmap` hGetContents h) >>= \ss -> + length ss `seq` return ss) + let xce = runIdentity $ runErrorT $ parseFile cs + case xce of + Left es -> mapM_ (\(ln,e) -> + putStrLn $ "readConfig error: line "++show ln++ + ": "++ e) es + >> return Nothing + Right xc -> return $ Just xc + + +-- | Attempts to run readConfig, and checks if it failed. +checkConfig :: IO Bool +checkConfig = isJust `fmap` readConfig + + + +{- REMOVED: It was for debugging, and causes an 'orphaned instances' + warning to boot. + + + +-- | Reads in the config, and then prints the resulting XConfig +dumpConfig :: IO () +dumpConfig = readConfig >>= print + + +instance Show (XConfig Layout) where + show x = "XConfig { " + ++ "normalBorderColor = "++ normalBorderColor x ++", " + ++ "focusedBorderColor = "++ focusedBorderColor x++", " + ++ "terminal = "++ terminal x ++", " + ++ "workspaces = "++ show (workspaces x) ++", " + ++ "numlockMask = "++ show (numlockMask x) ++", " + ++ "modMask = "++ show (modMask x) ++", " + ++ "borderWidth = "++ show (borderWidth x) ++", " + ++ "focusFollowsMouse = "++ show (focusFollowsMouse x) ++", " + ++ "layouts = "++ show (layoutHook x) ++" }" + +-} + +-- | Handles the unwrapping of the Layout. Intended for use as +-- @main = plainConfig@ +plainConfig :: IO () +plainConfig = do + conf <- readConfig + case conf of + (Just xc@XConfig{layoutHook= (Layout l)}) -> + xmonad (xc{ layoutHook = l }) + Nothing -> + spawn $ "xmessage Failed to read xmonad.conf. See xmonad.errors." + hunk ./xmonad-contrib.cabal 106 + XMonad.Config.PlainConfig } Context: [I no longer use ScratchWorkspace. David Roundy <droundy@darcs.net>**20080516185715] [fix bug in smartBorders when combined with decorated windows. David Roundy <droundy@darcs.net>**20080516184855] [decent documentation for UrgencyHook Devin Mullins <me@twifkak.com>**20080515082222 Blame it on lack of sleep. Or perhaps the causation is the reverse. ] [X.A.WindowNavigation: currentPosition and setPosition share the same `inside` logic, now Devin Mullins <me@twifkak.com>**20080515062211 Aside from documentation, this is pretty much usable, now. ] [X.A.WindowNavigation: have currentPosition handle axes independently Devin Mullins <me@twifkak.com>**20080515053330 This improves some subtle interactions between mod-j/k and mod-w/a/s/d, though that might not become very apparent until I fix setPosition. ] [fix compile warnings in BoringWindows Devin Mullins <me@twifkak.com>**20080515051728] [add BoringWindows module to make certain windows skipped when rotating focus. David Roundy <droundy@darcs.net>**20080514162846] [UrgencyHook: some documentation (more is needed) Devin Mullins <me@twifkak.com>**20080514080104] [UrgencyHook: got rid of the need for instances to know about suppressWhen Devin Mullins <me@twifkak.com>**20080514072217 This changes the API a little bit, but that's what you get for using a day-old feature from darcs. ] [move AppLauncher from Actions module to Prompt module zhen.sydow@gmail.com**20080513201252] [X.A.WindowNavigation: comment cleanup Devin Mullins <me@twifkak.com>**20080513091313] [windowRect now compensates for border width Devin Mullins <me@twifkak.com>**20080513090151 Odd that I have to do (Rectangle x y (w + 2 * bw) (h + 2 * bw)) -- you'd think the window would be centered within the bordered area. ] [X.A.WindowNavigation: update TODO Devin Mullins <me@twifkak.com>**20080513044229] [X.A.WindowNavigation: minor cleanup Devin Mullins <me@twifkak.com>**20080512170410] [X.A.WindowNavigation: simplify inr somewhat Devin Mullins <me@twifkak.com>**20080512090647] [X.A.WindowNavigation: clarity Devin Mullins <me@twifkak.com>**20080512085338] [X.A.WindowNavigation: ugh, typo Devin Mullins <me@twifkak.com>**20080512082228] [X.A.WindowNavigation: implement swap, extract withTargetWindow commonality Devin Mullins <me@twifkak.com>**20080512064715 Why doesn't mapWindows exist already? ] [add more flexible withWindowNavigationKeys Devin Mullins <me@twifkak.com>**20080512050637 Names aren't permanent yet, so don't cry if they change. ] [X.A.WindowNavigation: TODO Devin Mullins <me@twifkak.com>**20080511222116] [X.A.WindowNavigation: add withWindowNavigation, for easy setup Devin Mullins <me@twifkak.com>**20080511220458 This should be more flexible than it is -- I've got an idea, but am interested to hear others. ] [X.A.WindowNavigation: fix currentPosition Devin Mullins <me@twifkak.com>**20080511212128 Now properly deals with an unitialized state (e.g. from a restart) or an inconsistent state (e.g. from using mod-j/k). Deserves cleanup. ] [X.A.WindowNavigation: add TODOs Devin Mullins <me@twifkak.com>**20080511211326] [X.A.WindowNavigation state is now workspace-specific Devin Mullins <me@twifkak.com>**20080511071656 racking up some code debt, here... ] [X.A.WindowNavigation: minor doco changes Devin Mullins <me@twifkak.com>**20080506074235] [add draft XMonad.Actions.WindowNavigation Devin Mullins <me@twifkak.com>**20080504050022 This is an experiment with replacing the WindowNavigation LayoutModifier with one that simply adds keybindings and stores state in an IORef. Credit to droundy for the original code -- hopefully I'm not butchering it. The end intent is to add Xinerama support, but it'll be a little while before I get there. ] [new contrib module to launch apps with command line parameters zhen.sydow@gmail.com**20080513134754] [pull suppressWhen logic into main WithUrgencyHook handler Devin Mullins <me@twifkak.com>**20080513075247 In order for this to work, I added a new UrgencyHook method to communicate the SuppressWhen value. I'm not sure if this is actually better than just providing a convenience function, but it's an easy switch. ] [add suppressWhen option to dzenUrgencyHook Devin Mullins <me@twifkak.com>**20080513054615] [WindowNavigation: extract navigable function Devin Mullins <me@twifkak.com>**20080422045248] [UrgencyHook: doc typo Devin Mullins <me@twifkak.com>**20080512052137] [UrgencyHook: extract whenNotVisible Devin Mullins <me@twifkak.com>**20080512041852] [SpawnUrgencyHook, FWIW Devin Mullins <me@twifkak.com>**20080512040449] [make UrgencyHook an EventHook Devin Mullins <me@twifkak.com>**20080512024822 This gets rid of the stupid bug that led to a need for the clearBit hack, and allowed me to simplify the types (since EventHooks aren't required to parameterize on the window type). Config files need not change, unless they declare instances of UrgencyHook, in which case, they should remove "Window" as is seen in this patch. ] ['xmobar' function added to DynamicLog for running xmobar with some defaults Ivan N. Veselov <veselov@gmail.com>**20080508194918] [HintedTile: Fix mistake in documentation. lithis <xmonad@selg.hethrael.org>**20080508003552] [Use gnome-session-save for the mod-shift-q binding Spencer Janssen <sjanssen@cse.unl.edu>**20080507082205] [Use the named constant 'none' rather than 0 Spencer Janssen <sjanssen@cse.unl.edu>**20080507081854] [HintedTile: Improve documentation. lithis <xmonad@selg.hethrael.org>**20080508000245] [Whitespace only Spencer Janssen <sjanssen@cse.unl.edu>**20080507031306] [Add a binding for Gnome's "Run Application" dialog Spencer Janssen <sjanssen@cse.unl.edu>**20080507031127] [Add some keybindings to the Kde config Spencer Janssen <sjanssen@cse.unl.edu>**20080507022658] [Indentation Spencer Janssen <sjanssen@cse.unl.edu>**20080507022553] [Add ToggleStruts to the desktop config Spencer Janssen <sjanssen@cse.unl.edu>**20080507022516] [Refactor my config Spencer Janssen <sjanssen@cse.unl.edu>**20080507021504] [Add XMonad.Config.Kde Spencer Janssen <sjanssen@cse.unl.edu>**20080507020833] [Don't move the pointer if the user is moving the mouse Klaus Weidner <kweidner@pobox.com>**20080417022234 This patch depends on the following xmonad core patch: Remember if focus changes were caused by mouse actions or by key commands If the user was moving the mouse, it's not appropriate to move the pointer around in resonse to focus changes. Do that only in response to keyboard commands. ] [Missing pragmas Don Stewart <dons@galois.com>**20080506053402] [Add full documentation Don Stewart <dons@galois.com>**20080505210546] [minor cleanup on getName Devin Mullins <me@twifkak.com>**20080504054923] [bug doco for UrgencyHook Devin Mullins <me@twifkak.com>**20080426203638] [NamedWindows: when converting the text property, handle the empty list. Spencer Janssen <sjanssen@cse.unl.edu>**20080502104249 This fixes a "Prelude.head" exception observed with windows that have no title. Reproduce by placing several windows in the tabbed layout, then starting 'xterm -name ""'. Thanks to Andrea for pointing out the issue. ] [Fix issue #179 by handling events correctly Andrea Rossato <andrea.rossato@unibz.it>**20080501062357] [My monitor is larger now :) Spencer Janssen <sjanssen@cse.unl.edu>**20080430083026] [manageHooks for my config Spencer Janssen <sjanssen@cse.unl.edu>**20080430082536] [Remove redundant type signature Spencer Janssen <sjanssen@cse.unl.edu>**20080430082447] [Add XMonad.Config.Desktop and XMonad.Config.Gnome Spencer Janssen <sjanssen@cse.unl.edu>**20080430082253] [Alphabetize exposed-modules Spencer Janssen <sjanssen@cse.unl.edu>**20080430035453] [new contrib layout: XMonad.Layout.SimplestFloat - A floating layout like SimpleFloat, but without decoration joamaki@gmail.com**20080424220957] [stricitfy some gap fields Don Stewart <dons@galois.com>**20080427191247] [XMonad.Hooks.ManageHelpers: quick&dirty support for _NET_WM_STATE_FULLSCREEN Lukas Mai <l.mai@web.de>**20080426132745] [XMonad.Hooks.Script: haddock fixes Lukas Mai <l.mai@web.de>**20080426132629] [Error fix for Tabbed when tabbar always shown Ivan.Miljenovic@gmail.com**20080424063135] [remove my config file -- the wiki is where its at. Don Stewart <dons@galois.com>**20080419195650] [tweaks to docs for SimpleDecoration Don Stewart <dons@galois.com>**20080418215155] [Allow tabbar to always be shown. Ivan.Miljenovic@gmail.com**20080415043728 Patch take 4, hopefully the final version. Includes droundy's suggestions. ] [polish Don Stewart <dons@galois.com>**20080418033133] [Script-based hooks Trevor Elliott <trevor@galois.com>**20080416213024] [Don't strictify the Display component, this triggers a bug in GHC 6.6 Spencer Janssen <sjanssen@cse.unl.edu>**20080416185733] [Fix to IM modifier. Roman Cheplyaka <roma@ro-che.info>**20080414232437 Avoid differentiating integrated stack by using StackSet.filter. ] [IM layout converted to LayoutModifier, which can be applied to any layout Ivan N. Veselov <veselov@gmail.com>**20080413205824] [stictify some fields Don Stewart <dons@galois.com>**20080413070117] [strictify some fields Don Stewart <dons@galois.com>**20080413065958] [Fix window order in EWMH Joachim Breitner <mail@joachim-breitner.de>**20080411134411 For pagers to draw the stacking order correctly, the focused window has to be the last in the list. Thus put an appropriate implementation of allWindows into the Module. This does not work perfectly with floating windows. ] [remove myself as maintainer of CopyWindow. David Roundy <droundy@darcs.net>**20080409144333 I'm not sure who's maintaining this, but it's not me. ] [XMonad.Util.WindowProperties: add WM_WINDOW_ROLE as Role Roman Cheplyaka <roma@ro-che.info>**20080409174935] [Generalize copyWindow, minor style change Spencer Janssen <sjanssen@cse.unl.edu>**20080408210050] [XMonad.Actions.CopyWindow: added copyToAll and killAllOtherCopies functions Ivan N. Veselov <veselov@gmail.com>**20080408195111] [XMonad.Actions.UpdatePointer: doc fix Lukas Mai <l.mai@web.de>**20080407152741] [XMonad.Util.Font: minor reformatting Lukas Mai <l.mai@web.de>**20080406020935] [DynamicLog: resolve merge conflict Lukas Mai <l.mai@web.de>**20080406020527] [Encode the entire DynamicLog output, instead of just window title. lithis <xmonad@selg.hethrael.org>**20080329031537] [DynamicLog: add support for UTF-8 locales when compiled with XFT or UFT-8 support Andrea Rossato <andrea.rossato@unibz.it>**20080313102643] [XMonad.Util.Font: don't call setlocale; core does it for us Lukas Mai <l.mai@web.de>**20080406013123] [XMonad.Util.NamedWindows: fix imports Lukas Mai <l.mai@web.de>**20080326172745] [Changed getName to use locale-aware functions Mats Jansborg <mats@jansb.org>**20070819132104 Rewrote getName using getTextProperty and wcTextPropertyToTextList. ] [Added next-window versions of the raise* functions. Ian Zerny <ian@zerny.dk>**20080405182900] [XMonad.Layout.Master: initial import Lukas Mai <l.mai@web.de>**20080404220734] [update contrib for applySizeHints changes Lukas Mai <l.mai@web.de>**20080404220558] [XMonad.Hooks.ManageDocks: haddock fix Lukas Mai <l.mai@web.de>**20080404220532] [MultiToggle/Instances: ghc 6.6 can't parse LANGUAGE pragma Brent Yorgey <byorgey@gmail.com>**20080404200157] [Document _NET_ACTIVE_WINDOW behaviour more exactly Joachim Breitner <mail@joachim-breitner.de>**20080404072944] [_NET_ACTIVE_WINDOW moves windows if necessary Joachim Breitner <mail@joachim-breitner.de>*-20080402143811 This makes EWMH behave a bit more like metacity: If _NET_ACTIVE_WINDOW is received and the window is not on the current worspace, it is brought here (instead of the workspace switched to the other one). So for example, if you click on the pidgin icon in the panel and the buddy list is already open some where it is moved here. ] [onstart=lower, solves floating dzen issue Don Stewart <dons@galois.com>**20080403203425] [some bang patterns Don Stewart <dons@galois.com>**20080403172246] [have 'dzen' use autoStruts to detect the gaps Don Stewart <dons@galois.com>**20080403003130] [Actions/Search.hs: add dictionary.com search Brent Yorgey <byorgey@gmail.com>**20080402150521] [_NET_ACTIVE_WINDOW moves windows if necessary Joachim Breitner <mail@joachim-breitner.de>**20080402143811 This makes EWMH behave a bit more like metacity: If _NET_ACTIVE_WINDOW is received and the window is not on the current worspace, it is brought here (instead of the workspace switched to the other one). So for example, if you click on the pidgin icon in the panel and the buddy list is already open some where it is moved here. ] [HintedGrid: guesstimate window flexibility and layout rigid windows first Lukas Mai <l.mai@web.de>**20080402042846] [HintedGrid: try both bottom-up/top-down window placement to minimize unused space Lukas Mai <l.mai@web.de>**20080402012538] [Grid/HintedGrid: use an ncolumns formula inspired by dwm's "optimal" mode Lukas Mai <l.mai@web.de>**20080402012126] [XMonad.Layout.Gaps: new contrib module for manual gap support, in the few cases where ManageDocks is not appropriate (dock apps that don't set STRUTS properly, adjusting for a display that is cut off on one edge, etc.) Brent Yorgey <byorgey@gmail.com>**20080402003742] [improve WindowGo.hs Haddock formatting gwern0@gmail.com**20080401023130] [forgot a haddock for getEditor in Shell.hs gwern0@gmail.com**20080401022012] [WindowGo.hs: +raiseBrowser, raiseEditor gwern0@gmail.com**20080401021740 Specialize runOrRaise in the same way as with Actions.Search, for one's browser and one's editors. ] [RunOrRaise.hs: FF 3 doesn't use the "Firefox-bin" classname gwern0@gmail.com**20080401015049] [Search.hs: remove an argument from selectSearch and promptSearch gwern0@gmail.com**20080401013947 The new getBrowser function allows us to mv the old selectSearch and promptSearch aside as too-general functions, and replace them with new versions, which employ getBrowser to supply one more argument. This allows us to replace the tedious 'selectSearch google "firefox"; selectSearch yahoo "firefox"...' with shorter 'selectSearch google' and so on. One less argument. Also, update the docs. ] [Shell.hs: +getBrowser, getEditor, helper function gwern0@gmail.com**20080401013447 The helper function asks the shell for the value of a variable, else returns the second argument. getBrowser and getEditor obviously specialize it for two particular possibly queries ] [XMonad.Layout.HintedGrid: initial import Lukas Mai <l.mai@web.de>**20080401231722] [Documentation improvement. Roman Cheplyaka <roma@ro-che.info>**20080401134305] [Remove broken link to screenshot. Roman Cheplyaka <roma@ro-che.info>**20080331210854] [MultiToggle: add new XMonad.Layout.MultiToggle.Instances module for common instances of Transformer, update MultiToggle docs accordingly Brent Yorgey <byorgey@gmail.com>**20080331201739] [XMonad.Actions.CycleRecentWS: initial import Michal Janeczek <janeczek@gmail.com>**20080331111906] [XMonad.Hooks.ManageDocks: export checkDoc Lukas Mai <l.mai@web.de>**20080331012911] [XMonad.Layout.Grid: fix indentation Lukas Mai <l.mai@web.de>**20080330004859] [move Direction type from WindowNavigation to ManageDocks (ManageDocks will move into the core, taking Direction with it) Brent Yorgey <byorgey@gmail.com>**20080331010127] [ManageDocks: clean up + add more documentation Brent Yorgey <byorgey@gmail.com>**20080331002929] [Util.Run, Hooks.DynamicLog: re-export hPutStrLn and hPutStr from Util.Run for convenience, and update DynamicLog documentation to show proper imports Brent Yorgey <byorgey@gmail.com>**20080328205446] [ManageDocks: add avoidStrutsOn, for covering some docks and not others by default. Brent Yorgey <byorgey@gmail.com>**20080327203940] [ManageDocks: add ability to toggle individual gaps independently Brent Yorgey <byorgey@gmail.com>**20080327111722] [PerWorkspace: add modWorkspace(s) combinators, for selectively applying layout modifiers to certain workspaces but not others Brent Yorgey <byorgey@gmail.com>**20080326214351] [Haddock fix Roman Cheplyaka <roma@ro-che.info>**20080330134435] [Remove stale status gaps code Spencer Janssen <sjanssen@cse.unl.edu>**20080329230737] [TAG 0.7 Spencer Janssen <sjanssen@cse.unl.edu>**20080329202416] Patch bundle hash: 860f33474aa3b21e2dfad86a426c7d8ffed75292
Hi, a few comments from my side. Am Samstag, den 17.05.2008, 18:40 -0400 schrieb Braden Shepherdson:
+ +-- | The standard Config.hs 'defaultConfig', with the layout wrapped. +baseConfig :: XConfig Layout +baseConfig = defaultConfig{ layoutHook = Layout (layoutHook defaultConfig) }
Could you make it possible to pass the default configuration to readConfig as an parameter, so that I can change some defaults for the Debian package?
+-- | Core function that attempts to parse @~\/.xmonad\/xmonad.conf@ +readConfig :: IO (Maybe (XConfig Layout)) +readConfig = do + cs <- bracket (openFile "/home/braden/.xmonad/xmonad.conf" ReadMode)
You surely want to make that independent of the users’ login name, do you :-)
+-- | Handles the unwrapping of the Layout. Intended for use as +-- @main = plainConfig@ +plainConfig :: IO () +plainConfig = do + conf <- readConfig + case conf of + (Just xc@XConfig{layoutHook= (Layout l)}) -> + xmonad (xc{ layoutHook = l }) + Nothing -> + spawn $ "xmessage Failed to read xmonad.conf. See xmonad.errors." +
What happens here if there is no xmonad.conf. Does it use the baseConfig, or does it produce an error? Greetings, Joachim -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de ICQ#: 74513189 Jabber-ID: nomeata@joachim-breitner.de
Joachim Breitner wrote:
You surely want to make that independent of the users’ login name, do you :-)
You're right, of course. *cough* I had some trouble with using ~, actually, so I hard-coded my username. Probably need to use System.Environment to extract $HOME? Unfortunately I'm busy with an assignment today so I can't make these edits. If some helpful soul out there wants to fix it, please do.
What happens here if there is no xmonad.conf. Does it use the baseConfig, or does it produce an error?
I just tried it, and the test shows that it, er, crashes xmonad silently. Obviously that's undesirable. Again, I'm short on time. I'll hopefully be able to dig into these issues tomorrow if no one else fixes them in the meantime.
Greetings, Joachim
Braden Shepherdson shepheb
On 2008 May 18, at 15:51, Braden Shepherdson wrote:
I had some trouble with using ~, actually, so I hard-coded my username. Probably need to use System.Environment to extract $HOME?
http://www.ece.cmu.edu/~allbery/TildeExpand.hs -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
* Braden Shepherdson <Braden.Shepherdson@gmail.com> [2008-05-18 15:51:31-0400]
Joachim Breitner wrote:
You surely want to make that independent of the users’ login name, do you :-)
You're right, of course. *cough*
I had some trouble with using ~, actually, so I hard-coded my username. Probably need to use System.Environment to extract $HOME?
Unfortunately I'm busy with an assignment today so I can't make these edits. If some helpful soul out there wants to fix it, please do.
Fixed. Didn't test it, but it should work. -- Roman I. Cheplyaka (aka Feuerbach @ IRC)
participants (4)
-
Braden Shepherdson -
Brandon S. Allbery KF8NH -
Joachim Breitner -
Roman Cheplyaka