[xmonad] darcs patch: generic menu and window bringer

Travis B. Hartwell nafai at travishartwell.net
Sun Oct 26 21:00:18 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Travis B. Hartwell wrote:
> I've had to make some patches for XMonadContrib in order to support the
> new Gtk replacement for dmenu I have written:

Attached is a new patch including the changes that sjanssen recommended
on IRC.  Thanks for the recommendations and the simplification!

One note.  I had to upgrade my haddock from what it in Ubuntu Hardy
Heron (version 0.8) to the latest so that it wouldn't choke on
processing XMonad.Util.XSelection because of the C Preprocessor
Directives.  Just a note for anyone trying to do a darcs record or
building the haddock docs.

Thanks again!

- --
Travis B. Hartwell
Software Toolsmith

Blog:
http://www.travishartwell.net/blog

Where to find me:
http://www.travishartwell.net/blog/static/where_to_find_me
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJBRKhIfupsj9YJrURAuqkAJ0VgadC6B44OarWKaAyQuXQEgVyogCg3HyJ
tL0axYrloUJWRLFvWThGvA4=
=OI9o
-----END PGP SIGNATURE-----
-------------- next part --------------
Sun Oct 26 18:55:23 MDT 2008  Travis B. Hartwell <nafai at travishartwell.net>
  * generic menu and window bringer

New patches:

[generic menu and window bringer
Travis B. Hartwell <nafai at travishartwell.net>**20081027005523] {
hunk ./XMonad/Actions/WindowBringer.hs 18
 -----------------------------------------------------------------------------
 
 module XMonad.Actions.WindowBringer (
-                                    -- * Usage
-                                    -- $usage
-                                    gotoMenu, bringMenu, windowMap,
-                                    bringWindow
-                                   ) where
+				    -- * Usage
+				    -- $usage
+				    gotoMenu, gotoMenu', bringMenu, windowMap,
+				    bringWindow
+				   ) where
 
 import Data.Char (toLower)
 import qualified Data.Map as M
hunk ./XMonad/Actions/WindowBringer.hs 30
 import qualified XMonad.StackSet as W
 import XMonad
 import qualified XMonad as X
-import XMonad.Util.Dmenu (dmenuMap)
+import XMonad.Util.Dmenu (menuMap)
 import XMonad.Util.NamedWindows (getName)
 
 -- $usage
hunk ./XMonad/Actions/WindowBringer.hs 53
 gotoMenu :: X ()
 gotoMenu = actionMenu W.focusWindow
 
+gotoMenu' :: String -> X ()
+gotoMenu' menuCmd = actionMenu' menuCmd W.focusWindow
+
 -- | Pops open a dmenu with window titles. Choose one, and it will be
 --   dragged, kicking and screaming, into your current workspace.
 bringMenu :: X ()
hunk ./XMonad/Actions/WindowBringer.hs 68
 -- | Calls dmenuMap to grab the appropriate Window, and hands it off to action
 --   if found.
 actionMenu :: (Window -> X.WindowSet -> X.WindowSet) -> X()
-actionMenu action = windowMap >>= dmenuMap >>= flip X.whenJust (windows . action)
+actionMenu action = actionMenu' "dmenu" action
+
+actionMenu' :: String -> (Window -> X.WindowSet -> X.WindowSet) -> X()
+actionMenu' menuCmd action = windowMap >>= menuMapFunction >>= flip X.whenJust (windows . action)
+    where
+      menuMapFunction :: M.Map String a -> X (Maybe a)
+      menuMapFunction selectionMap = menuMap menuCmd selectionMap
 
 -- | A map from window names to Windows.
 windowMap :: X (M.Map String Window)
hunk ./XMonad/Util/Dmenu.hs 18
 -----------------------------------------------------------------------------
 
 module XMonad.Util.Dmenu (
-                            -- * Usage
-                            -- $usage
-                            dmenu, dmenuXinerama, dmenuMap
-                           ) where
+			    -- * Usage
+			    -- $usage
+			    dmenu, dmenuXinerama, dmenuMap, menu, menuMap
+			   ) where
 
 import XMonad
 import qualified XMonad.StackSet as W
hunk ./XMonad/Util/Dmenu.hs 43
     io $ runProcessWithInput "dmenu" ["-xs", show (curscreen+1)] (unlines opts)
 
 dmenu :: [String] -> X String
-dmenu opts = io $ runProcessWithInput "dmenu" [] (unlines opts)
+dmenu opts = menu "dmenu" opts
 
hunk ./XMonad/Util/Dmenu.hs 45
-dmenuMap :: M.Map String a -> X (Maybe a)
-dmenuMap selectionMap = do
-  selection <- dmenu (M.keys selectionMap)
+menu :: String -> [String] -> X String
+menu menuCmd opts = io $ runProcessWithInput menuCmd [] (unlines opts)
+
+menuMap :: String -> M.Map String a -> X (Maybe a)
+menuMap menuCmd selectionMap = do
+  selection <- menuFunction (M.keys selectionMap)
   return $ M.lookup selection selectionMap
hunk ./XMonad/Util/Dmenu.hs 52
+      where
+        menuFunction = menu menuCmd
hunk ./XMonad/Util/Dmenu.hs 55
+dmenuMap :: M.Map String a -> X (Maybe a)
+dmenuMap selectionMap = menuMap "dmenu" selectionMap
}

Context:

[Prompt.hs rename deleteConsecutiveDuplicates
gwern0 at gmail.com**20081008205131
 That name is really unwieldy and long.
] 
[Prompt.hs: have historyCompletion filter dupes
gwern0 at gmail.com**20081008204710
 Specifically, it calls deleteConsecutiveDuplicates on the end product. uniqSort reverses order in an unfortunate way, so we don't use that.
 The use-case is when a user has added the same input many times - as it stands, if the history records 30 'top's or whatever, the completion will show 30 'top' entries! This fixes that.
] 
[Prompt.hs: tweak haddocks
gwern0 at gmail.com**20081008204649] 
[Prompt.hs: mv uniqSort to next to its confreres, and mention the trade-off
gwern0 at gmail.com**20081008192645] 
[Do not consider XMONAD_TIMER unknown
Joachim Breitner <mail at joachim-breitner.de>**20081008195643] 
[Kill window without focusing it first
Joachim Breitner <mail at joachim-breitner.de>**20081005002533
 This patch requires the patch "add killWindow function" in xmonad.
 Before this patch, people would experience “workspace flicker” when closing
 a window via EWMH that is not on the current workspace, for example when
 quitting pidgin via the panel icon.
] 
[let MagnifyLess actually magnify less
daniel at wagner-home.com**20081015153911] 
[Actions.Search: add a few search engines
intrigeri at boum.org**20081008104033
 
 Add Debian {package, bug, tracking system} search engines, as well as Google
 Images and isohunt.
 
] 
[Implement HiddenNonEmptyWS with HiddenWS and NonEmptyWS
Joachim Breitner <mail at joachim-breitner.de>**20081006211027
 (Just to reduce code duplication)
] 
[Add straightforward HiddenWS to WSType
Joachim Breitner <mail at joachim-breitner.de>**20081006210548
 With NonEmptyWS and HiddenNonEmptyWS present, HiddenWS is obviously missing.
] 
[Merge emptyLayoutMod into redoLayout
Joachim Breitner <mail at joachim-breitner.de>**20081005190220
 This removes the emptyLayoutMod method from the LayoutModifier class, and
 change the Stack parameter to redoLayout to a Maybe Stack one. It also changes
 all affected code. This should should be a refactoring without any change in
 program behaviour.
] 
[SmartBorders even for empty layouts
Joachim Breitner <mail at joachim-breitner.de>**20081005184426
 Fixes: http://code.google.com/p/xmonad/issues/detail?id=223
] 
[Paste.hs: improve haddocks
gwern0 at gmail.com**20080927150158] 
[Paste.hs: fix haddock
gwern0 at gmail.com**20080927145238] 
[minor explanatory comment
daniel at wagner-home.com**20081003015919] 
[XMonad.Layout.HintedGrid: add GridRatio (--no-test because of haddock breakage)
Lukas Mai <l.mai at web.de>**20080930141715] 
[XMonad.Util.Font: UTF8 -> USE_UTF8
Lukas Mai <l.mai at web.de>**20080930140056] 
[Paste.hs: implement noModMask suggestion
gwern0 at gmail.com**20080926232056] 
[fix a divide by zero error in Grid
daniel at wagner-home.com**20080926204148] 
[-DUTF8 flag with -DUSE_UTF8
gwern0 at gmail.com**20080921154014] 
[XSelection.hs: use CPP to compile against utf8-string
gwern0 at gmail.com**20080920151615] 
[add XMonad.Config.Azerty
Devin Mullins <me at twifkak.com>**20080924044946] 
[flip GridRatio to match convention (x/y)
Devin Mullins <me at twifkak.com>**20080922033354] 
[let Grid have a configurable aspect ratio goal
daniel at wagner-home.com**20080922010950] 
[Paste.hs: +warning about ASCII limitations
gwern0 at gmail.com**20080921155038] 
[Paste.hs: shorten comment lines to under 80 columns per sjanssen
gwern0 at gmail.com**20080921154950] 
[Forgot to enable historyFilter :(
Spencer Janssen <spencerjanssen at gmail.com>**20080921094254] 
[Prompt: add configurable history filters
Spencer Janssen <spencerjanssen at gmail.com>**20080921093453] 
[Update my config to use 'statusBar'
Spencer Janssen <spencerjanssen at gmail.com>**20080921063513] 
[Rename pasteKey functions to sendKey
Spencer Janssen <spencerjanssen at gmail.com>**20080921062016] 
[DynamicLog: doc fixes
Spencer Janssen <spencerjanssen at gmail.com>**20080921061314] 
[Move XMonad.Util.XPaste to XMonad.Util.Paste
Spencer Janssen <spencerjanssen at gmail.com>**20080921060947] 
[Depend on X11 >= 1.4.3
Spencer Janssen <spencerjanssen at gmail.com>**20080921055456] 
[statusBar now supplies the action to toggle struts
Spencer Janssen <spencerjanssen at gmail.com>**20080918013858] 
[cleanup - use currentTag
Devin Mullins <me at twifkak.com>**20080921011159] 
[XPaste.hs: improve author info
gwern0 at gmail.com**20080920152342] 
[+XMonad.Util.XPaste: a module for pasting strings to windows
gwern0 at gmail.com**20080920152106] 
[UrgencyHook bug fix: cleanupUrgents should clean up reminders, too
Devin Mullins <me at twifkak.com>**20080920062117] 
[Sketch of XMonad.Config.Monad
Spencer Janssen <spencerjanssen at gmail.com>**20080917081838] 
[raiseMaster
seanmce33 at gmail.com**20080912184830] 
[Add missing space between dzen command and flags
Daniel Neri <daniel.neri at sigicom.com>**20080915131009] 
[Big DynamicLog refactor.  Added statusBar, improved compositionality for dzen and xmobar
Spencer Janssen <spencerjanssen at gmail.com>**20080913205931
 Compatibility notes:
     - dzen type change
     - xmobar type change
     - dynamicLogDzen removed
     - dynamicLogXmobar removed
] 
[Take maintainership of XMonad.Prompt
Spencer Janssen <spencerjanssen at gmail.com>**20080911230442] 
[Overhaul Prompt to use a zipper for history navigation.  Fixes issue #216
Spencer Janssen <spencerjanssen at gmail.com>**20080911225940] 
[Use the new completion on tab setting
Spencer Janssen <spencerjanssen at gmail.com>**20080911085940] 
[Only start to show the completion window with more than one match
Joachim Breitner <mail at joachim-breitner.de>**20080908110129] 
[XPrompt: Add showCompletionOnTab option
Joachim Breitner <mail at joachim-breitner.de>**20080908105758
 This patch partially implements
 http://code.google.com/p/xmonad/issues/detail?id=215
 It adds a XPConfig option that, if enabled, hides the completion window
 until the user presses Tab once. Default behaviour is preserved.
 TODO: If Tab causes a unique completion, continue to hide the completion
 window.
] 
[XMonad.Actions.Plane.planeKeys: function to make easier to configure
Marco Túlio Gontijo e Silva <marcot at riseup.net>**20080714153601] 
[XMonad.Actions.Plane: removed unneeded hiding
Marco Túlio Gontijo e Silva <marcot at riseup.net>**20080714152631] 
[Improvements in documentation
Marco Túlio Gontijo e Silva <marcot at riseup.net>**20080709002425] 
[Fix haddock typos in XMonad.Config.{Desktop,Gnome,Kde}
Spencer Janssen <spencerjanssen at gmail.com>**20080911040808] 
[add clearUrgents for your keys
Devin Mullins <me at twifkak.com>**20080909055425] 
[add reminder functionality to UrgencyHook
Devin Mullins <me at twifkak.com>**20080824200548
 I'm considering rewriting remindWhen and suppressWhen as UrgencyHookModifiers, so to speak. Bleh.
] 
[TAG 0.8
Spencer Janssen <spencerjanssen at gmail.com>**20080905195420] 
Patch bundle hash:
8e62031fc2a08c470cb8a0e33f969c3a633499f4


More information about the xmonad mailing list