<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <!-- Generated by HsColour, http://www.cs.york.ac.uk/fp/darcs/hscolour/ --> <title>XMonad/Doc/Extending.hs</title> <link type='text/css' rel='stylesheet' href='hscolour.css' /> </head> <body> <pre><a name="line-1"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span> <a name="line-2"></a><span class='hs-comment'>-- |</span> <a name="line-3"></a><span class='hs-comment'>-- Module : XMonad.Doc.Extending</span> <a name="line-4"></a><span class='hs-comment'>-- Copyright : (C) 2007 Andrea Rossato</span> <a name="line-5"></a><span class='hs-comment'>-- License : BSD3</span> <a name="line-6"></a><span class='hs-comment'>--</span> <a name="line-7"></a><span class='hs-comment'>-- Maintainer : andrea.rossato@unibz.it</span> <a name="line-8"></a><span class='hs-comment'>-- Stability : unstable</span> <a name="line-9"></a><span class='hs-comment'>-- Portability : portable</span> <a name="line-10"></a><span class='hs-comment'>--</span> <a name="line-11"></a><span class='hs-comment'>-- This module documents the xmonad-contrib library and</span> <a name="line-12"></a><span class='hs-comment'>-- how to use it to extend the capabilities of xmonad.</span> <a name="line-13"></a><span class='hs-comment'>--</span> <a name="line-14"></a><span class='hs-comment'>-- Reading this document should not require a deep knowledge of</span> <a name="line-15"></a><span class='hs-comment'>-- Haskell; the examples are intended to be useful and understandable</span> <a name="line-16"></a><span class='hs-comment'>-- for those users who do not know Haskell and don't want to have to</span> <a name="line-17"></a><span class='hs-comment'>-- learn it just to configure xmonad. You should be able to get by</span> <a name="line-18"></a><span class='hs-comment'>-- just fine by ignoring anything you don't understand and using the</span> <a name="line-19"></a><span class='hs-comment'>-- provided examples as templates. However, relevant Haskell features</span> <a name="line-20"></a><span class='hs-comment'>-- are discussed when appropriate, so this document will hopefully be</span> <a name="line-21"></a><span class='hs-comment'>-- useful for more advanced Haskell users as well.</span> <a name="line-22"></a><span class='hs-comment'>--</span> <a name="line-23"></a><span class='hs-comment'>-- Those wishing to be totally hardcore and develop their own xmonad</span> <a name="line-24"></a><span class='hs-comment'>-- extensions (it's easier than it sounds, we promise!) should read</span> <a name="line-25"></a><span class='hs-comment'>-- the documentation in "XMonad.Doc.Developing".</span> <a name="line-26"></a><span class='hs-comment'>--</span> <a name="line-27"></a><span class='hs-comment'>-- More configuration examples may be found on the Haskell wiki:</span> <a name="line-28"></a><span class='hs-comment'>--</span> <a name="line-29"></a><span class='hs-comment'>-- <<a href="http://haskell.org/haskellwiki/Xmonad/Config_archive">http://haskell.org/haskellwiki/Xmonad/Config_archive</a>></span> <a name="line-30"></a><span class='hs-comment'>--</span> <a name="line-31"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span> <a name="line-32"></a> <a name="line-33"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>XMonad</span><span class='hs-varop'>.</span><span class='hs-conid'>Doc</span><span class='hs-varop'>.</span><span class='hs-conid'>Extending</span> <a name="line-34"></a> <span class='hs-layout'>(</span> <a name="line-35"></a> <span class='hs-comment'>-- * The xmonad-contrib library</span> <a name="line-36"></a> <span class='hs-comment'>-- $library</span> <a name="line-37"></a> <a name="line-38"></a> <span class='hs-comment'>-- ** Actions</span> <a name="line-39"></a> <span class='hs-comment'>-- $actions</span> <a name="line-40"></a> <a name="line-41"></a> <span class='hs-comment'>-- ** Configurations</span> <a name="line-42"></a> <span class='hs-comment'>-- $configs</span> <a name="line-43"></a> <a name="line-44"></a> <span class='hs-comment'>-- ** Hooks</span> <a name="line-45"></a> <span class='hs-comment'>-- $hooks</span> <a name="line-46"></a> <a name="line-47"></a> <span class='hs-comment'>-- ** Layouts</span> <a name="line-48"></a> <span class='hs-comment'>-- $layouts</span> <a name="line-49"></a> <a name="line-50"></a> <span class='hs-comment'>-- ** Prompts</span> <a name="line-51"></a> <span class='hs-comment'>-- $prompts</span> <a name="line-52"></a> <a name="line-53"></a> <span class='hs-comment'>-- ** Utilities</span> <a name="line-54"></a> <span class='hs-comment'>-- $utils</span> <a name="line-55"></a> <a name="line-56"></a> <span class='hs-comment'>-- * Extending xmonad</span> <a name="line-57"></a> <span class='hs-comment'>-- $extending</span> <a name="line-58"></a> <a name="line-59"></a> <span class='hs-comment'>-- ** Editing key bindings</span> <a name="line-60"></a> <span class='hs-comment'>-- $keys</span> <a name="line-61"></a> <a name="line-62"></a> <span class='hs-comment'>-- *** Adding key bindings</span> <a name="line-63"></a> <span class='hs-comment'>-- $keyAdding</span> <a name="line-64"></a> <a name="line-65"></a> <span class='hs-comment'>-- *** Removing key bindings</span> <a name="line-66"></a> <span class='hs-comment'>-- $keyDel</span> <a name="line-67"></a> <a name="line-68"></a> <span class='hs-comment'>-- *** Adding and removing key bindings</span> <a name="line-69"></a> <span class='hs-comment'>-- $keyAddDel</span> <a name="line-70"></a> <a name="line-71"></a> <span class='hs-comment'>-- ** Editing mouse bindings</span> <a name="line-72"></a> <span class='hs-comment'>-- $mouse</span> <a name="line-73"></a> <a name="line-74"></a> <span class='hs-comment'>-- ** Editing the layout hook</span> <a name="line-75"></a> <span class='hs-comment'>-- $layoutHook</span> <a name="line-76"></a> <a name="line-77"></a> <span class='hs-comment'>-- ** Editing the manage hook</span> <a name="line-78"></a> <span class='hs-comment'>-- $manageHook</span> <a name="line-79"></a> <a name="line-80"></a> <span class='hs-comment'>-- ** The log hook and external status bars</span> <a name="line-81"></a> <span class='hs-comment'>-- $logHook</span> <a name="line-82"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span> <a name="line-83"></a> <a name="line-84"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span> <a name="line-85"></a><span class='hs-comment'>--</span> <a name="line-86"></a><span class='hs-comment'>-- The XmonadContrib Library</span> <a name="line-87"></a><span class='hs-comment'>--</span> <a name="line-88"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span> <a name="line-89"></a> <a name="line-90"></a><span class='hs-comment'>{- $library <a name="line-91"></a> <a name="line-92"></a>The xmonad-contrib (xmc) library is a set of extension modules <a name="line-93"></a>contributed by xmonad hackers and users, which provide additional <a name="line-94"></a>xmonad features. Examples include various layout modes (tabbed, <a name="line-95"></a>spiral, three-column...), prompts, program launchers, the ability to <a name="line-96"></a>manipulate windows and workspaces in various ways, alternate <a name="line-97"></a>navigation modes, and much more. There are also \"meta-modules\" <a name="line-98"></a>which make it easier to write new modules and extensions. <a name="line-99"></a> <a name="line-100"></a>This is a concise yet complete overview of the xmonad-contrib modules. <a name="line-101"></a>For more information about any particular module, just click on its <a name="line-102"></a>name to view its Haddock documentation; each module should come with <a name="line-103"></a>extensive documentation. If you find a module that could be better <a name="line-104"></a>documented, or has incorrect documentation, please report it as a bug <a name="line-105"></a>(<<a href="http://code.google.com/p/xmonad/issues/list">http://code.google.com/p/xmonad/issues/list</a>>)! <a name="line-106"></a> <a name="line-107"></a>-}</span> <a name="line-108"></a> <a name="line-109"></a><span class='hs-comment'>{- $actions <a name="line-110"></a> <a name="line-111"></a>In the @XMonad.Actions@ namespace you can find modules exporting <a name="line-112"></a>various functions that are usually intended to be bound to key <a name="line-113"></a>combinations or mouse actions, in order to provide functionality <a name="line-114"></a>beyond the standard keybindings provided by xmonad. <a name="line-115"></a> <a name="line-116"></a>See "XMonad.Doc.Extending#Editing_key_bindings" for instructions on how to <a name="line-117"></a>edit your key bindings. <a name="line-118"></a> <a name="line-119"></a>* "XMonad.Actions.Commands": <a name="line-120"></a> Allows you to run internal xmonad commands (X () actions) using <a name="line-121"></a> a dmenu menu in addition to key bindings. Requires dmenu and <a name="line-122"></a> the Dmenu XMonad.Actions module. <a name="line-123"></a> <a name="line-124"></a>* "XMonad.Actions.ConstrainedResize": <a name="line-125"></a> Lets you constrain the aspect ratio of a floating <a name="line-126"></a> window (by, say, holding shift while you resize). <a name="line-127"></a> Useful for making a nice circular XClock window. <a name="line-128"></a> <a name="line-129"></a>* "XMonad.Actions.CopyWindow": <a name="line-130"></a> Provides bindings to duplicate a window on multiple workspaces, <a name="line-131"></a> providing dwm-like tagging functionality. <a name="line-132"></a> <a name="line-133"></a>* "XMonad.Actions.CycleRecentWS": <a name="line-134"></a> Provides bindings to cycle through most recently used workspaces <a name="line-135"></a> with repeated presses of a single key (as long as modifier key is <a name="line-136"></a> held down). This is similar to how many window managers handle <a name="line-137"></a> window switching. <a name="line-138"></a> <a name="line-139"></a>* "XMonad.Actions.CycleSelectedLayouts": <a name="line-140"></a> This module allows to cycle through the given subset of layouts. <a name="line-141"></a> <a name="line-142"></a>* "XMonad.Actions.CycleWS": <a name="line-143"></a> Provides bindings to cycle forward or backward through the list of <a name="line-144"></a> workspaces, to move windows between workspaces, and to cycle <a name="line-145"></a> between screens. Replaces the former XMonad.Actions.RotView. <a name="line-146"></a> <a name="line-147"></a>* "XMonad.Actions.CycleWindows": <a name="line-148"></a> Provides bindings to cycle windows up or down on the current workspace <a name="line-149"></a> stack while maintaining focus in place. <a name="line-150"></a> <a name="line-151"></a>* "XMonad.Actions.DeManage": <a name="line-152"></a> This module provides a method to cease management of a window <a name="line-153"></a> without unmapping it. "XMonad.Hooks.ManageDocks" is a <a name="line-154"></a> more automated solution if your panel supports it. <a name="line-155"></a> <a name="line-156"></a>* "XMonad.Actions.DwmPromote": <a name="line-157"></a> Dwm-like swap function for xmonad. <a name="line-158"></a> Swaps focused window with the master window. If focus is in the <a name="line-159"></a> master, swap it with the next window in the stack. Focus stays in the <a name="line-160"></a> master. <a name="line-161"></a> <a name="line-162"></a>* "XMonad.Actions.DynamicWorkspaces": <a name="line-163"></a> Provides bindings to add and delete workspaces. Note that you may only <a name="line-164"></a> delete a workspace that is already empty. <a name="line-165"></a> <a name="line-166"></a>* "XMonad.Actions.FindEmptyWorkspace": <a name="line-167"></a> Find an empty workspace. <a name="line-168"></a> <a name="line-169"></a>* "XMonad.Actions.FlexibleManipulate": <a name="line-170"></a> Move and resize floating windows without warping the mouse. <a name="line-171"></a> <a name="line-172"></a>* "XMonad.Actions.FlexibleResize": <a name="line-173"></a> Resize floating windows from any corner. <a name="line-174"></a> <a name="line-175"></a>* "XMonad.Actions.FloatKeys": <a name="line-176"></a> Move and resize floating windows. <a name="line-177"></a> <a name="line-178"></a>* "XMonad.Layout.FloatSnap": <a name="line-179"></a> Move and resize floating windows using other windows and the edge of the <a name="line-180"></a> screen as guidelines. <a name="line-181"></a> <a name="line-182"></a>* "XMonad.Actions.FocusNth": <a name="line-183"></a> Focus the nth window of the current workspace. <a name="line-184"></a> <a name="line-185"></a>* "XMonad.Actions.GridSelect": <a name="line-186"></a> GridSelect displays items(e.g. the opened windows) in a 2D grid and lets <a name="line-187"></a> the user select from it with the cursor/hjkl keys or the mouse. <a name="line-188"></a> <a name="line-189"></a>* "XMonad.Actions.MessageFeedback": <a name="line-190"></a> Alternative to 'XMonad.Operations.sendMessage' that provides knowledge <a name="line-191"></a> of whether the message was handled, and utility functions based on <a name="line-192"></a> this facility. <a name="line-193"></a> <a name="line-194"></a>* "XMonad.Actions.MouseGestures": <a name="line-195"></a> Support for simple mouse gestures. <a name="line-196"></a> <a name="line-197"></a>* "XMonad.Actions.MouseResize": <a name="line-198"></a> A layout modifier to resize windows with the mouse by grabbing the <a name="line-199"></a> window's lower right corner. <a name="line-200"></a> <a name="line-201"></a>* "XMonad.Actions.NoBorders": <a name="line-202"></a> This module provides helper functions for dealing with window borders. <a name="line-203"></a> <a name="line-204"></a>* "XMonad.Actions.OnScreen": <a name="line-205"></a> Control workspaces on different screens (in xinerama mode). <a name="line-206"></a> <a name="line-207"></a>* "XMonad.Actions.PerWorkspaceKeys": <a name="line-208"></a> Define key-bindings on per-workspace basis. <a name="line-209"></a> <a name="line-210"></a>* "XMonad.Actions.PhysicalScreens": <a name="line-211"></a> Manipulate screens ordered by physical location instead of ID <a name="line-212"></a> <a name="line-213"></a>* "XMonad.Actions.Plane": <a name="line-214"></a> This module has functions to navigate through workspaces in a bidimensional <a name="line-215"></a> manner. <a name="line-216"></a> <a name="line-217"></a>* "XMonad.Actions.Promote": <a name="line-218"></a> Alternate promote function for xmonad. <a name="line-219"></a> <a name="line-220"></a>* "XMonad.Actions.RandomBackground": <a name="line-221"></a> An action to start terminals with a random background color <a name="line-222"></a> <a name="line-223"></a>* "XMonad.Actions.RotSlaves": <a name="line-224"></a> Rotate all windows except the master window and keep the focus in <a name="line-225"></a> place. <a name="line-226"></a> <a name="line-227"></a>* "XMonad.Actions.Search": <a name="line-228"></a> A module for easily running Internet searches on web sites through xmonad. <a name="line-229"></a> Modeled after the handy Surfraw CLI search tools at <https://secure.wikimedia.org/wikipedia/en/wiki/Surfraw>. <a name="line-230"></a> <a name="line-231"></a>* "XMonad.Actions.SimpleDate": <a name="line-232"></a> An example external contrib module for XMonad. <a name="line-233"></a> Provides a simple binding to dzen2 to print the date as a popup menu. <a name="line-234"></a> <a name="line-235"></a>* "XMonad.Actions.SinkAll": <a name="line-236"></a> (Deprecated) Provides a simple binding that pushes all floating windows on the <a name="line-237"></a> current workspace back into tiling. Instead, use the more general <a name="line-238"></a> "XMonad.Actions.WithAll" <a name="line-239"></a> <a name="line-240"></a>* "XMonad.Actions.SpawnOn": <a name="line-241"></a> Provides a way to modify a window spawned by a command(e.g shift it to the workspace <a name="line-242"></a> it was launched on) by using the _NET_WM_PID property that most windows set on creation. <a name="line-243"></a> <a name="line-244"></a>* "XMonad.Actions.Submap": <a name="line-245"></a> A module that allows the user to create a sub-mapping of key bindings. <a name="line-246"></a> <a name="line-247"></a>* "XMonad.Actions.SwapWorkspaces": <a name="line-248"></a> Lets you swap workspace tags, so you can keep related ones next to <a name="line-249"></a> each other, without having to move individual windows. <a name="line-250"></a> <a name="line-251"></a>* "XMonad.Actions.TagWindows": <a name="line-252"></a> Functions for tagging windows and selecting them by tags. <a name="line-253"></a> <a name="line-254"></a>* "XMonad.Actions.TopicSpace": <a name="line-255"></a> Turns your workspaces into a more topic oriented system. <a name="line-256"></a> <a name="line-257"></a>* "XMonad.Actions.UpdateFocus": <a name="line-258"></a> Updates the focus on mouse move in unfocused windows. <a name="line-259"></a> <a name="line-260"></a>* "XMonadContrib.UpdatePointer": <a name="line-261"></a> Causes the pointer to follow whichever window focus changes to. <a name="line-262"></a> <a name="line-263"></a>* "XMonad.Actions.Warp": <a name="line-264"></a> Warp the pointer to a given window or screen. <a name="line-265"></a> <a name="line-266"></a>* "XMonad.Actions.WindowBringer": <a name="line-267"></a> dmenu operations to bring windows to you, and bring you to windows. <a name="line-268"></a> That is to say, it pops up a dmenu with window names, in case you forgot <a name="line-269"></a> where you left your XChat. <a name="line-270"></a> <a name="line-271"></a>* "XMonad.Actions.WindowGo": <a name="line-272"></a> Defines a few convenient operations for raising (traveling to) windows based on XMonad's Query <a name="line-273"></a> monad, such as 'runOrRaise'. <a name="line-274"></a> <a name="line-275"></a>* "XMonad.Actions.WindowMenu": <a name="line-276"></a> Uses "XMonad.Actions.GridSelect" to display a number of actions related to <a name="line-277"></a> window management in the center of the focused window. <a name="line-278"></a> <a name="line-279"></a>* "XMonad.Actions.WindowNavigation": <a name="line-280"></a> Experimental rewrite of "XMonad.Layout.WindowNavigation". <a name="line-281"></a> <a name="line-282"></a>* "XMonad.Actions.WithAll": <a name="line-283"></a> Provides functions for performing a given action on all windows of <a name="line-284"></a> the current workspace. <a name="line-285"></a> <a name="line-286"></a>* "XMonad.Actions.WorkspaceCursors": <a name="line-287"></a> Like "XMonad.Actions.Plane" for an arbitrary number of dimensions. <a name="line-288"></a> <a name="line-289"></a>-}</span> <a name="line-290"></a> <a name="line-291"></a><span class='hs-comment'>{- $configs <a name="line-292"></a> <a name="line-293"></a>In the @XMonad.Config@ namespace you can find modules exporting the <a name="line-294"></a>configurations used by some of the xmonad and xmonad-contrib <a name="line-295"></a>developers. You can look at them for examples while creating your own <a name="line-296"></a>configuration; you can also simply import them and use them as your <a name="line-297"></a>own configuration, possibly with some modifications. <a name="line-298"></a> <a name="line-299"></a> <a name="line-300"></a>* "XMonad.Config.Arossato" <a name="line-301"></a> This module specifies my xmonad defaults. <a name="line-302"></a> <a name="line-303"></a>* "XMonad.Config.Azerty" <a name="line-304"></a> Fixes some keybindings for users of French keyboard layouts. <a name="line-305"></a> <a name="line-306"></a>* "XMonad.Config.Desktop" <a name="line-307"></a> This module provides core desktop environment settings used <a name="line-308"></a> in the Gnome, Kde, and Xfce config configs. It is also useful <a name="line-309"></a> for people using other environments such as lxde, or using <a name="line-310"></a> tray or panel applications without full desktop environments. <a name="line-311"></a> <a name="line-312"></a>* "XMonad.Config.Gnome" <a name="line-313"></a> <a name="line-314"></a>* "XMonad.Config.Kde" <a name="line-315"></a> <a name="line-316"></a>* "XMonad.Config.Sjanssen" <a name="line-317"></a> <a name="line-318"></a>* "XMonad.Config.Xfce" <a name="line-319"></a> <a name="line-320"></a>-}</span> <a name="line-321"></a> <a name="line-322"></a><span class='hs-comment'>{- $hooks <a name="line-323"></a> <a name="line-324"></a>In the @XMonad.Hooks@ namespace you can find modules exporting <a name="line-325"></a>hooks. Hooks are actions that xmonad performs when certain events <a name="line-326"></a>occur. The two most important hooks are: <a name="line-327"></a> <a name="line-328"></a>* 'XMonad.Core.manageHook': this hook is called when a new window <a name="line-329"></a> xmonad must take care of is created. This is a very powerful hook, <a name="line-330"></a> since it lets us examine the new window's properties and act <a name="line-331"></a> accordingly. For instance, we can configure xmonad to put windows <a name="line-332"></a> belonging to a given application in the float layer, not to manage <a name="line-333"></a> dock applications, or open them in a given workspace. See <a name="line-334"></a> "XMonad.Doc.Extending#Editing_the_manage_hook" for more information on <a name="line-335"></a> customizing 'XMonad.Core.manageHook'. <a name="line-336"></a> <a name="line-337"></a>* 'XMonad.Core.logHook': this hook is called when the stack of windows <a name="line-338"></a> managed by xmonad has been changed, by calling the <a name="line-339"></a> 'XMonad.Operations.windows' function. For instance <a name="line-340"></a> "XMonad.Hooks.DynamicLog" will produce a string (whose format can be <a name="line-341"></a> configured) to be printed to the standard output. This can be used <a name="line-342"></a> to display some information about the xmonad state in a status bar. <a name="line-343"></a> See "XMonad.Doc.Extending#The_log_hook_and_external_status_bars" for more <a name="line-344"></a> information. <a name="line-345"></a> <a name="line-346"></a>* 'XMonad.Core.handleEventHook': this hook is called on all events handled <a name="line-347"></a> by xmonad, thus it is extremely powerful. See "Graphics.X11.Xlib.Extras" <a name="line-348"></a> and xmonad source and development documentation for more details. <a name="line-349"></a> <a name="line-350"></a>Here is a list of the modules found in @XMonad.Hooks@: <a name="line-351"></a> <a name="line-352"></a>* "XMonad.Hooks.DynamicHooks": <a name="line-353"></a> One-shot and permanent ManageHooks that can be updated at runtime. <a name="line-354"></a> <a name="line-355"></a>* "XMonad.Hooks.DynamicLog": for use with 'XMonad.Core.logHook'; send <a name="line-356"></a> information about xmonad's state to standard output, suitable for <a name="line-357"></a> putting in a status bar of some sort. See <a name="line-358"></a> "XMonad.Doc.Extending#The_log_hook_and_external_status_bars". <a name="line-359"></a> <a name="line-360"></a>* "XMonad.Hooks.EwmhDesktops": <a name="line-361"></a> Makes xmonad use the EWMH hints to tell panel applications about its <a name="line-362"></a> workspaces and the windows therein. It also allows the user to interact <a name="line-363"></a> with xmonad by clicking on panels and window lists. <a name="line-364"></a> <a name="line-365"></a>* "XMonad.Hooks.FadeInactive": <a name="line-366"></a> Makes XMonad set the _NET_WM_WINDOW_OPACITY atom for inactive windows, <a name="line-367"></a> which causes those windows to become slightly translucent if something <a name="line-368"></a> like xcompmgr is running <a name="line-369"></a> <a name="line-370"></a>* "XMonad.Hooks.FloatNext": <a name="line-371"></a> Hook and keybindings for automatically sending the next <a name="line-372"></a> spawned window(s) to the floating layer. <a name="line-373"></a> <a name="line-374"></a>* "XMonad.Hooks.InsertPosition": <a name="line-375"></a> Configure where new windows should be added and which window should be <a name="line-376"></a> focused. <a name="line-377"></a> <a name="line-378"></a>* "XMonad.Hooks.ManageDocks": <a name="line-379"></a> This module provides tools to automatically manage 'dock' type programs, <a name="line-380"></a> such as gnome-panel, kicker, dzen, and xmobar. <a name="line-381"></a> <a name="line-382"></a>* "XMonad.Hooks.ManageHelpers": provide helper functions to be used <a name="line-383"></a> in @manageHook@. <a name="line-384"></a> <a name="line-385"></a>* "XMonad.Hooks.Place": <a name="line-386"></a> Automatic placement of floating windows. <a name="line-387"></a> <a name="line-388"></a>* "XMonad.Hooks.RestoreMinimized": <a name="line-389"></a> Lets you restore minimized windows (see "XMonad.Layout.Minimize") <a name="line-390"></a> by selecting them on a taskbar (listens for _NET_ACTIVE_WINDOW <a name="line-391"></a> and WM_CHANGE_STATE). <a name="line-392"></a> <a name="line-393"></a>* "XMonad.Hooks.Script": <a name="line-394"></a> Provides a simple interface for running a ~\/.xmonad\/hooks script with the <a name="line-395"></a> name of a hook. <a name="line-396"></a> <a name="line-397"></a>* "XMonad.Hooks.ServerMode": Allows sending commands to a running xmonad process. <a name="line-398"></a> <a name="line-399"></a>* "XMonad.Hooks.SetCursor": <a name="line-400"></a> Set a default mouse cursor on startup. <a name="line-401"></a> <a name="line-402"></a>* "XMonad.Hooks.SetWMName": <a name="line-403"></a> Sets the WM name to a given string, so that it could be detected using <a name="line-404"></a> _NET_SUPPORTING_WM_CHECK protocol. May be useful for making Java GUI <a name="line-405"></a> programs work. <a name="line-406"></a> <a name="line-407"></a>* "XMonad.Hooks.UrgencyHook": <a name="line-408"></a> UrgencyHook lets you configure an action to occur when a window demands <a name="line-409"></a> your attention. (In traditional WMs, this takes the form of \"flashing\" <a name="line-410"></a> on your \"taskbar.\" Blech.) <a name="line-411"></a> <a name="line-412"></a>* "XMonad.Hooks.WorkspaceByPos": <a name="line-413"></a> Useful in a dual-head setup: Looks at the requested geometry of <a name="line-414"></a> new windows and moves them to the workspace of the non-focused <a name="line-415"></a> screen if necessary. <a name="line-416"></a> <a name="line-417"></a>* "XMonad.Hooks.XPropManage": <a name="line-418"></a> A ManageHook matching on XProperties. <a name="line-419"></a> <a name="line-420"></a>-}</span> <a name="line-421"></a> <a name="line-422"></a><span class='hs-comment'>{- $layouts <a name="line-423"></a> <a name="line-424"></a>In the @XMonad.Layout@ namespace you can find modules exporting <a name="line-425"></a>contributed tiling algorithms, such as a tabbed layout, a circle, a spiral, <a name="line-426"></a>three columns, and so on. <a name="line-427"></a> <a name="line-428"></a>You will also find modules which provide facilities for combining <a name="line-429"></a>different layouts, such as "XMonad.Layout.Combo", "XMonad.Layout.ComboP", <a name="line-430"></a>"XMonad.Layout.LayoutBuilder", "XMonad.Layout.SubLayouts", or <a name="line-431"></a>"XMonad.Layout.LayoutCombinators". <a name="line-432"></a> <a name="line-433"></a>Layouts can be also modified with layout modifiers. A general <a name="line-434"></a>interface for writing layout modifiers is implemented in <a name="line-435"></a>"XMonad.Layout.LayoutModifier". <a name="line-436"></a> <a name="line-437"></a>For more information on using those modules for customizing your <a name="line-438"></a>'XMonad.Core.layoutHook' see "XMonad.Doc.Extending#Editing_the_layout_hook". <a name="line-439"></a> <a name="line-440"></a>* "XMonad.Layout.Accordion": <a name="line-441"></a> LayoutClass that puts non-focused windows in ribbons at the top and bottom <a name="line-442"></a> of the screen. <a name="line-443"></a> <a name="line-444"></a>* "XMonad.Layout.AutoMaster": <a name="line-445"></a> Provides layout modifier AutoMaster. It separates screen in two parts - <a name="line-446"></a> master and slave. Size of slave area automatically changes depending on <a name="line-447"></a> number of slave windows. <a name="line-448"></a> <a name="line-449"></a>* "XMonad.Layout.BorderResize": <a name="line-450"></a> This layout modifier will allow to resize windows by dragging their <a name="line-451"></a> borders with the mouse. However, it only works in layouts or modified <a name="line-452"></a> layouts that react to the SetGeometry message. <a name="line-453"></a> "XMonad.Layout.WindowArranger" can be used to create such a setup. <a name="line-454"></a> BorderResize is probably most useful in floating layouts. <a name="line-455"></a> <a name="line-456"></a>* "XMonad.Layout.BoringWindows": <a name="line-457"></a> BoringWindows is an extension to allow windows to be marked boring <a name="line-458"></a> <a name="line-459"></a>* "XMonad.Layout.CenteredMaster": <a name="line-460"></a> Two layout modifiers. centerMaster places master window at center, <a name="line-461"></a> on top of all other windows, which are managed by base layout. <a name="line-462"></a> topRightMaster is similar, but places master window in top right corner <a name="line-463"></a> instead of center. <a name="line-464"></a> <a name="line-465"></a>* "XMonad.Layout.Circle": <a name="line-466"></a> Circle is an elliptical, overlapping layout. <a name="line-467"></a> <a name="line-468"></a>* "XMonad.Layout.Column": <a name="line-469"></a> Provides Column layout that places all windows in one column. Windows <a name="line-470"></a> heights are calculated from equation: H1/H2 = H2/H3 = ... = q, where q is <a name="line-471"></a> given. With Shrink/Expand messages you can change the q value. <a name="line-472"></a> <a name="line-473"></a>* "XMonad.Layout.Combo": <a name="line-474"></a> A layout that combines multiple layouts. <a name="line-475"></a> <a name="line-476"></a>* "XMonad.Layout.ComboP": <a name="line-477"></a> A layout that combines multiple layouts and allows to specify where to put <a name="line-478"></a> new windows. <a name="line-479"></a> <a name="line-480"></a>* "XMonad.Layout.Cross": <a name="line-481"></a> A Cross Layout with the main window in the center. <a name="line-482"></a> <a name="line-483"></a>* "XMonad.Layout.Decoration": <a name="line-484"></a> A layout modifier and a class for easily creating decorated <a name="line-485"></a> layouts. <a name="line-486"></a> <a name="line-487"></a>* "XMonad.Layout.DecorationMadness": <a name="line-488"></a> A collection of decorated layouts: some of them may be nice, some <a name="line-489"></a> usable, others just funny. <a name="line-490"></a> <a name="line-491"></a>* "XMonad.Layout.Dishes": <a name="line-492"></a> Dishes is a layout that stacks extra windows underneath the master <a name="line-493"></a> windows. <a name="line-494"></a> <a name="line-495"></a>* "XMonad.Layout.DragPane": <a name="line-496"></a> Layouts that splits the screen either horizontally or vertically and <a name="line-497"></a> shows two windows. The first window is always the master window, and <a name="line-498"></a> the other is either the currently focused window or the second window in <a name="line-499"></a> layout order. See also "XMonad.Layout.MouseResizableTall" <a name="line-500"></a> <a name="line-501"></a>* "XMonad.Layout.DwmStyle": <a name="line-502"></a> A layout modifier for decorating windows in a dwm like style. <a name="line-503"></a> <a name="line-504"></a>* "XMonad.Layout.FixedColumn": <a name="line-505"></a> A layout much like Tall, but using a multiple of a window's minimum <a name="line-506"></a> resize amount instead of a percentage of screen to decide where to <a name="line-507"></a> split. This is useful when you usually leave a text editor or <a name="line-508"></a> terminal in the master pane and like it to be 80 columns wide. <a name="line-509"></a> <a name="line-510"></a>* "XMonad.Layout.Gaps": <a name="line-511"></a> Create manually-sized gaps along edges of the screen which will not <a name="line-512"></a> be used for tiling, along with support for toggling gaps on and <a name="line-513"></a> off. You probably want "XMonad.Hooks.ManageDocks". <a name="line-514"></a> <a name="line-515"></a>* "XMonad.Layout.Grid": <a name="line-516"></a> A simple layout that attempts to put all windows in a square grid. <a name="line-517"></a> <a name="line-518"></a>* "XMonad.Layout.GridVariants": <a name="line-519"></a> Two layouts: one is a variant of the Grid layout that allows the <a name="line-520"></a> desired aspect ratio of windows to be specified. The other is like <a name="line-521"></a> Tall but places a grid with fixed number of rows and columns in the <a name="line-522"></a> master area and uses an aspect-ratio-specified layout for the <a name="line-523"></a> slaves. <a name="line-524"></a> <a name="line-525"></a>* "XMonad.Layout.HintedGrid": <a name="line-526"></a> A not so simple layout that attempts to put all windows in a square grid <a name="line-527"></a> while obeying their size hints. <a name="line-528"></a> <a name="line-529"></a>* "XMonad.Layout.HintedTile": <a name="line-530"></a> A gapless tiled layout that attempts to obey window size hints, <a name="line-531"></a> rather than simply ignoring them. <a name="line-532"></a> <a name="line-533"></a>* "XMonad.Layout.IM": <a name="line-534"></a> Layout modfier suitable for workspace with multi-windowed instant messenger <a name="line-535"></a> (like Psi or Tkabber). <a name="line-536"></a> <a name="line-537"></a>* "XMonad.Layout.IndependentScreens": <a name="line-538"></a> Utility functions for simulating independent sets of workspaces on <a name="line-539"></a> each screen (like dwm's workspace model), using internal tags to <a name="line-540"></a> distinguish workspaces associated with each screen. <a name="line-541"></a> <a name="line-542"></a>* "XMonad.Layout.LayoutBuilder": <a name="line-543"></a> A layout combinator that sends a specified number of windows to one rectangle <a name="line-544"></a> and the rest to another. <a name="line-545"></a> <a name="line-546"></a>* "XMonad.Layout.LayoutCombinators": <a name="line-547"></a> The "XMonad.Layout.LayoutCombinators" module provides combinators <a name="line-548"></a> for easily combining multiple layouts into one composite layout, as <a name="line-549"></a> well as a way to jump directly to any particular layout (say, with <a name="line-550"></a> a keybinding) without having to cycle through other layouts to get <a name="line-551"></a> to it. <a name="line-552"></a> <a name="line-553"></a>* "XMonad.Layout.LayoutHints": <a name="line-554"></a> Make layouts respect size hints. <a name="line-555"></a> <a name="line-556"></a>* "XMonad.Layout.LayoutModifier": <a name="line-557"></a> A module for writing easy layout modifiers, which do not define a <a name="line-558"></a> layout in and of themselves, but modify the behavior of or add new <a name="line-559"></a> functionality to other layouts. If you ever find yourself writing <a name="line-560"></a> a layout which takes another layout as a parameter, chances are you <a name="line-561"></a> should be writing a LayoutModifier instead! <a name="line-562"></a> <a name="line-563"></a> In case it is not clear, this module is not intended to help you <a name="line-564"></a> configure xmonad, it is to help you write other extension modules. <a name="line-565"></a> So get hacking! <a name="line-566"></a> <a name="line-567"></a>* "XMonad.Layout.LayoutScreens": <a name="line-568"></a> Divide a single screen into multiple screens. <a name="line-569"></a> <a name="line-570"></a>* "XMonad.Layout.LimitWindows": <a name="line-571"></a> A layout modifier that limits the number of windows that can be shown. <a name="line-572"></a> <a name="line-573"></a>* "XMonad.Layout.MagicFocus": <a name="line-574"></a> Automagically put the focused window in the master area. <a name="line-575"></a> <a name="line-576"></a>* "XMonad.Layout.Magnifier": <a name="line-577"></a> Screenshot : <<a href="http://caladan.rave.org/magnifier.png">http://caladan.rave.org/magnifier.png</a>> <a name="line-578"></a> This is a layout modifier that will make a layout increase the size <a name="line-579"></a> of the window that has focus. <a name="line-580"></a> <a name="line-581"></a>* "XMonad.Layout.Master": <a name="line-582"></a> Layout modfier that adds a master window to another layout. <a name="line-583"></a> <a name="line-584"></a>* "XMonad.Layout.Maximize": <a name="line-585"></a> Temporarily yanks the focused window out of the layout to mostly fill <a name="line-586"></a> the screen. <a name="line-587"></a> <a name="line-588"></a>* "XMonad.Layout.MessageControl": <a name="line-589"></a> Provides message escaping and filtering facilities which <a name="line-590"></a> help control complex nested layouts. <a name="line-591"></a> <a name="line-592"></a>* "XMonad.Layout.Minimize": <a name="line-593"></a> Makes it possible to minimize windows, temporarily removing them <a name="line-594"></a> from the layout until they are restored. <a name="line-595"></a> <a name="line-596"></a>* "XMonad.Layout.Monitor": <a name="line-597"></a> Layout modfier for displaying some window (monitor) above other windows <a name="line-598"></a> <a name="line-599"></a>* "XMonad.Layout.Mosaic": <a name="line-600"></a> Based on MosaicAlt, but aspect ratio messages always change the aspect <a name="line-601"></a> ratios, and rearranging the window stack changes the window sizes. <a name="line-602"></a> <a name="line-603"></a>* "XMonad.Layout.MosaicAlt": <a name="line-604"></a> A layout which gives each window a specified amount of screen space <a name="line-605"></a> relative to the others. Compared to the 'Mosaic' layout, this one <a name="line-606"></a> divides the space in a more balanced way. <a name="line-607"></a> <a name="line-608"></a>* "XMonad.Layout.MouseResizableTile": <a name="line-609"></a> A layout in the spirit of "XMonad.Layout.ResizableTile", but with the option <a name="line-610"></a> to use the mouse to adjust the layout. <a name="line-611"></a> <a name="line-612"></a>* "XMonad.Layout.MultiToggle": <a name="line-613"></a> Dynamically apply and unapply transformers to your window layout. This can <a name="line-614"></a> be used to rotate your window layout by 90 degrees, or to make the <a name="line-615"></a> currently focused window occupy the whole screen (\"zoom in\") then undo <a name="line-616"></a> the transformation (\"zoom out\"). <a name="line-617"></a> <a name="line-618"></a>* "XMonad.Layout.Named": <a name="line-619"></a> A module for assigning a name to a given layout. <a name="line-620"></a> <a name="line-621"></a>* "XMonad.Layout.NoBorders": <a name="line-622"></a> Make a given layout display without borders. This is useful for <a name="line-623"></a> full-screen or tabbed layouts, where you don't really want to waste a <a name="line-624"></a> couple of pixels of real estate just to inform yourself that the visible <a name="line-625"></a> window has focus. <a name="line-626"></a> <a name="line-627"></a>* "XMonad.Layout.NoFrillsDecoration": <a name="line-628"></a> Most basic version of decoration for windows without any additional <a name="line-629"></a> modifications. In contrast to "XMonad.Layout.SimpleDecoration" this will <a name="line-630"></a> result in title bars that span the entire window instead of being only the <a name="line-631"></a> length of the window title. <a name="line-632"></a> <a name="line-633"></a>* "XMonad.Layout.OneBig": <a name="line-634"></a> Places one (master) window at top left corner of screen, and other (slave) <a name="line-635"></a> windows at the top. <a name="line-636"></a> <a name="line-637"></a>* "XMonad.Layout.PerWorkspace": <a name="line-638"></a> Configure layouts on a per-workspace basis: use layouts and apply <a name="line-639"></a> layout modifiers selectively, depending on the workspace. <a name="line-640"></a> <a name="line-641"></a>* "XMonad.Layout.Reflect": <a name="line-642"></a> Reflect a layout horizontally or vertically. <a name="line-643"></a> <a name="line-644"></a>* "XMonad.Layout.ResizableTile": <a name="line-645"></a> More useful tiled layout that allows you to change a width\/height of window. <a name="line-646"></a> See also "XMonad.Layout.MouseResizableTile". <a name="line-647"></a> <a name="line-648"></a>* "XMonad.Layout.ResizeScreen": <a name="line-649"></a> A layout transformer to have a layout respect a given screen <a name="line-650"></a> geometry. Mostly used with "Decoration" (the Horizontal and the <a name="line-651"></a> Vertical version will react to SetTheme and change their dimension <a name="line-652"></a> accordingly. <a name="line-653"></a> <a name="line-654"></a>* "XMonad.Layout.Roledex": <a name="line-655"></a> This is a completely pointless layout which acts like Microsoft's Flip 3D <a name="line-656"></a> <a name="line-657"></a>* "XMonad.Layout.ShowWName": <a name="line-658"></a> This is a layout modifier that will show the workspace name <a name="line-659"></a> <a name="line-660"></a>* "XMonad.Layout.SimpleDecoration": <a name="line-661"></a> A layout modifier for adding simple decorations to the windows of a <a name="line-662"></a> given layout. The decorations are in the form of ion-like tabs <a name="line-663"></a> for window titles. <a name="line-664"></a> <a name="line-665"></a>* "XMonad.Layout.SimpleFloat": <a name="line-666"></a> A basic floating layout. <a name="line-667"></a> <a name="line-668"></a>* "XMonad.Layout.Simplest": <a name="line-669"></a> A very simple layout. The simplest, afaik. Used as a base for <a name="line-670"></a> decorated layouts. <a name="line-671"></a> <a name="line-672"></a>* "XMonad.Layout.SimplestFloat": <a name="line-673"></a> A basic floating layout like SimpleFloat but without the decoration. <a name="line-674"></a> <a name="line-675"></a>* "XMonad.Layout.Spacing": <a name="line-676"></a> Add a configurable amount of space around windows. <a name="line-677"></a> <a name="line-678"></a>* "XMonad.Layout.Spiral": <a name="line-679"></a> A spiral tiling layout. <a name="line-680"></a> <a name="line-681"></a>* "XMonad.Layout.Square": <a name="line-682"></a> A layout that splits the screen into a square area and the rest of the <a name="line-683"></a> screen. <a name="line-684"></a> This is probably only ever useful in combination with <a name="line-685"></a> "XMonad.Layout.Combo". <a name="line-686"></a> It sticks one window in a square region, and makes the rest <a name="line-687"></a> of the windows live with what's left (in a full-screen sense). <a name="line-688"></a> <a name="line-689"></a>* "XMonad.Layout.StackTile": <a name="line-690"></a> A stacking layout, like dishes but with the ability to resize master pane. <a name="line-691"></a> Mostly useful on small screens. <a name="line-692"></a> <a name="line-693"></a>* "XMonad.Layout.SubLayouts": <a name="line-694"></a> A layout combinator that allows layouts to be nested. <a name="line-695"></a> <a name="line-696"></a>* "XMonad.Layout.TabBarDecoration": <a name="line-697"></a> A layout modifier to add a bar of tabs to your layouts. <a name="line-698"></a> <a name="line-699"></a>* "XMonad.Layout.Tabbed": <a name="line-700"></a> A tabbed layout for the Xmonad Window Manager <a name="line-701"></a> <a name="line-702"></a>* "XMonad.Layout.ThreeColumns": <a name="line-703"></a> A layout similar to tall but with three columns. With 2560x1600 pixels this <a name="line-704"></a> layout can be used for a huge main window and up to six reasonable sized <a name="line-705"></a> slave windows. <a name="line-706"></a> <a name="line-707"></a>* "XMonad.Layout.ToggleLayouts": <a name="line-708"></a> A module to toggle between two layouts. <a name="line-709"></a> <a name="line-710"></a>* "XMonad.Layout.TwoPane": <a name="line-711"></a> A layout that splits the screen horizontally and shows two windows. The <a name="line-712"></a> left window is always the master window, and the right is either the <a name="line-713"></a> currently focused window or the second window in layout order. <a name="line-714"></a> <a name="line-715"></a>* "XMonad.Layout.WindowArranger": <a name="line-716"></a> This is a pure layout modifier that will let you move and resize <a name="line-717"></a> windows with the keyboard in any layout. <a name="line-718"></a> <a name="line-719"></a>* "XMonad.Layout.WindowNavigation": <a name="line-720"></a> WindowNavigation is an extension to allow easy navigation of a workspace. <a name="line-721"></a> See also "XMonad.Actions.WindowNavigation". <a name="line-722"></a> <a name="line-723"></a>* "XMonad.Layout.WorkspaceDir": <a name="line-724"></a> WorkspaceDir is an extension to set the current directory in a workspace. <a name="line-725"></a> Actually, it sets the current directory in a layout, since there's no way I <a name="line-726"></a> know of to attach a behavior to a workspace. This means that any terminals <a name="line-727"></a> (or other programs) pulled up in that workspace (with that layout) will <a name="line-728"></a> execute in that working directory. Sort of handy, I think. <a name="line-729"></a> Note this extension requires the 'directory' package to be installed. <a name="line-730"></a> <a name="line-731"></a>-}</span> <a name="line-732"></a> <a name="line-733"></a><span class='hs-comment'>{- $prompts <a name="line-734"></a> <a name="line-735"></a>In the @XMonad.Prompt@ name space you can find modules providing <a name="line-736"></a>graphical prompts for getting user input and using it to perform <a name="line-737"></a>various actions. <a name="line-738"></a> <a name="line-739"></a>The "XMonad.Prompt" provides a library for easily writing new prompt <a name="line-740"></a>modules. <a name="line-741"></a> <a name="line-742"></a>These are the available prompts: <a name="line-743"></a> <a name="line-744"></a>* "XMonad.Prompt.AppLauncher": <a name="line-745"></a> A module for launch applicationes that receive parameters in the command <a name="line-746"></a> line. The launcher call a prompt to get the parameters. <a name="line-747"></a> <a name="line-748"></a>* "XMonad.Prompt.AppendFile": <a name="line-749"></a> A prompt for appending a single line of text to a file. Useful for <a name="line-750"></a> keeping a file of notes, things to remember for later, and so on--- <a name="line-751"></a> using a keybinding, you can write things down just about as quickly <a name="line-752"></a> as you think of them, so it doesn't have to interrupt whatever else <a name="line-753"></a> you're doing. <a name="line-754"></a> Who knows, it might be useful for other purposes as well! <a name="line-755"></a> <a name="line-756"></a>* "XMonad.Prompt.DirExec": <a name="line-757"></a> A directory file executables prompt for XMonad. This might be useful if you <a name="line-758"></a> don't want to have scripts in your PATH environment variable (same <a name="line-759"></a> executable names, different behavior) - otherwise you might want to use <a name="line-760"></a> "XMonad.Prompt.Shell" instead - but you want to have easy access to these <a name="line-761"></a> executables through the xmonad's prompt. <a name="line-762"></a> <a name="line-763"></a>* "XMonad.Prompt.Directory": <a name="line-764"></a> A directory prompt for XMonad <a name="line-765"></a> <a name="line-766"></a>* "XMonad.Prompt.Email": <a name="line-767"></a> A prompt for sending quick, one-line emails, via the standard GNU <a name="line-768"></a> \'mail\' utility (which must be in your $PATH). This module is <a name="line-769"></a> intended mostly as an example of using "XMonad.Prompt.Input" to <a name="line-770"></a> build an action requiring user input. <a name="line-771"></a> <a name="line-772"></a>* "XMonad.Prompt.Input": <a name="line-773"></a> A generic framework for prompting the user for input and passing it <a name="line-774"></a> along to some other action. <a name="line-775"></a> <a name="line-776"></a>* "XMonad.Prompt.Layout": <a name="line-777"></a> A layout-selection prompt for XMonad <a name="line-778"></a> <a name="line-779"></a>* "XMonad.Prompt.Man": <a name="line-780"></a> A manual page prompt for XMonad window manager. <a name="line-781"></a> TODO <a name="line-782"></a> * narrow completions by section number, if the one is specified <a name="line-783"></a> (like @\/etc\/bash_completion@ does) <a name="line-784"></a> <a name="line-785"></a>* "XMonad.Prompt.RunOrRaise": <a name="line-786"></a> A prompt for XMonad which will run a program, open a file, <a name="line-787"></a> or raise an already running program, depending on context. <a name="line-788"></a> <a name="line-789"></a>* "XMonad.Prompt.Shell": <a name="line-790"></a> A shell prompt for XMonad <a name="line-791"></a> <a name="line-792"></a>* "XMonad.Prompt.Ssh": <a name="line-793"></a> A ssh prompt for XMonad <a name="line-794"></a> <a name="line-795"></a>* "XMonad.Prompt.Theme": <a name="line-796"></a> A prompt for changing the theme of the current workspace <a name="line-797"></a> <a name="line-798"></a>* "XMonad.Prompt.Window": <a name="line-799"></a> xprompt operations to bring windows to you, and bring you to windows. <a name="line-800"></a> <a name="line-801"></a>* "XMonad.Prompt.Workspace": <a name="line-802"></a> A workspace prompt for XMonad <a name="line-803"></a> <a name="line-804"></a>* "XMonad.Prompt.XMonad": <a name="line-805"></a> A prompt for running XMonad commands <a name="line-806"></a> <a name="line-807"></a>Usually a prompt is called by some key binding. See <a name="line-808"></a>"XMonad.Doc.Extending#Editing_key_bindings", which includes examples <a name="line-809"></a>of adding some prompts. <a name="line-810"></a> <a name="line-811"></a>-}</span> <a name="line-812"></a> <a name="line-813"></a><span class='hs-comment'>{- $utils <a name="line-814"></a> <a name="line-815"></a>In the @XMonad.Util@ namespace you can find modules exporting various <a name="line-816"></a>utility functions that are used by the other modules of the <a name="line-817"></a>xmonad-contrib library. <a name="line-818"></a> <a name="line-819"></a>There are also utilities for helping in configuring xmonad or using <a name="line-820"></a>external utilities. <a name="line-821"></a> <a name="line-822"></a>A non complete list with a brief description: <a name="line-823"></a> <a name="line-824"></a>* "XMonad.Util.Cursor": configure the default cursor/pointer glyph. <a name="line-825"></a> <a name="line-826"></a>* "XMonad.Util.CustomKeys": configure key bindings (see <a name="line-827"></a> "XMonad.Doc.Extending#Editing_key_bindings"). <a name="line-828"></a> <a name="line-829"></a>* "XMonad.Util.Dmenu": <a name="line-830"></a> A convenient binding to dmenu. <a name="line-831"></a> Requires the process-1.0 package <a name="line-832"></a> <a name="line-833"></a>* "XMonad.Util.Dzen": <a name="line-834"></a> Handy wrapper for dzen. Requires dzen >= 0.2.4. <a name="line-835"></a> <a name="line-836"></a>* "XMonad.Util.EZConfig": configure key bindings easily, including a <a name="line-837"></a> parser for writing key bindings in "M-C-x" style. <a name="line-838"></a> <a name="line-839"></a>* "XMonad.Util.Font": A module for abstracting a font facility over <a name="line-840"></a> Core fonts and Xft <a name="line-841"></a> <a name="line-842"></a>* "XMonad.Util.Invisible": <a name="line-843"></a> A data type to store the layout state <a name="line-844"></a> <a name="line-845"></a>* "XMonad.Util.Loggers": <a name="line-846"></a> A collection of simple logger functions and formatting utilities <a name="line-847"></a> which can be used in the 'XMonad.Hooks.DynamicLog.ppExtras' field of <a name="line-848"></a> a pretty-printing status logger format. See "XMonad.Hooks.DynamicLog" <a name="line-849"></a> for more information. <a name="line-850"></a> <a name="line-851"></a>* "XMonad.Util.NamedActions": <a name="line-852"></a> A wrapper for keybinding configuration that can list the available <a name="line-853"></a> keybindings. <a name="line-854"></a> <a name="line-855"></a>* "XMonad.Util.NamedScratchpad": <a name="line-856"></a> Like "XMonad.Util.Scratchpad" toggle windows to and from the current <a name="line-857"></a> workspace. Supports several arbitrary applications at the same time. <a name="line-858"></a> <a name="line-859"></a>* "XMonad.Util.NamedWindows": <a name="line-860"></a> This module allows you to associate the X titles of windows with <a name="line-861"></a> them. <a name="line-862"></a> <a name="line-863"></a>* "XMonad.Util.Paste": <a name="line-864"></a> A module for sending key presses to windows. This modules provides generalized <a name="line-865"></a> and specialized functions for this task. <a name="line-866"></a> <a name="line-867"></a>* "XMonad.Util.Replace": <a name="line-868"></a> Implements a @--replace@ flag outside of core. <a name="line-869"></a> <a name="line-870"></a>* "XMonad.Util.Run": <a name="line-871"></a> This modules provides several commands to run an external process. <a name="line-872"></a> It is composed of functions formerly defined in "XMonad.Util.Dmenu" (by <a name="line-873"></a> Spencer Janssen), "XMonad.Util.Dzen" (by glasser\@mit.edu) and <a name="line-874"></a> XMonad.Util.RunInXTerm (by Andrea Rossato). <a name="line-875"></a> <a name="line-876"></a>* "XMonad.Util.Scratchpad": <a name="line-877"></a> Very handy hotkey-launched toggleable floating terminal window. <a name="line-878"></a> <a name="line-879"></a>* "XMonad.Util.StringProp": <a name="line-880"></a> Internal utility functions for storing Strings with the root window. <a name="line-881"></a> Used for global state like IORefs with string keys, but more latency, <a name="line-882"></a> persistent between xmonad restarts. <a name="line-883"></a> <a name="line-884"></a>* "XMonad.Util.Themes": <a name="line-885"></a> A (hopefully) growing collection of themes for decorated layouts. <a name="line-886"></a> <a name="line-887"></a>* "XMonad.Util.Timer": <a name="line-888"></a> A module for setting up timers <a name="line-889"></a> <a name="line-890"></a>* "XMonad.Util.Types": <a name="line-891"></a> Miscellaneous commonly used types. <a name="line-892"></a> <a name="line-893"></a>* "XMonad.Util.WindowProperties": <a name="line-894"></a> EDSL for specifying window properties; various utilities related to window <a name="line-895"></a> properties. <a name="line-896"></a> <a name="line-897"></a>* "XMonad.Util.XSelection": <a name="line-898"></a> A module for accessing and manipulating X Window's mouse selection (the buffer used in copy and pasting). <a name="line-899"></a> 'getSelection' and 'putSelection' are adaptations of Hxsel.hs and Hxput.hs from the XMonad-utils <a name="line-900"></a> <a name="line-901"></a>* "XMonad.Util.XUtils": <a name="line-902"></a> A module for painting on the screen <a name="line-903"></a> <a name="line-904"></a>-}</span> <a name="line-905"></a> <a name="line-906"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span> <a name="line-907"></a><span class='hs-comment'>--</span> <a name="line-908"></a><span class='hs-comment'>-- Extending Xmonad</span> <a name="line-909"></a><span class='hs-comment'>--</span> <a name="line-910"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span> <a name="line-911"></a> <a name="line-912"></a><span class='hs-comment'>{- $extending <a name="line-913"></a>#Extending_xmonad# <a name="line-914"></a> <a name="line-915"></a>Since the @xmonad.hs@ file is just another Haskell module, you may <a name="line-916"></a>import and use any Haskell code or libraries you wish, such as <a name="line-917"></a>extensions from the xmonad-contrib library, or other code you write <a name="line-918"></a>yourself. <a name="line-919"></a> <a name="line-920"></a>-}</span> <a name="line-921"></a> <a name="line-922"></a><span class='hs-comment'>{- $keys <a name="line-923"></a>#Editing_key_bindings# <a name="line-924"></a> <a name="line-925"></a>Editing key bindings means changing the 'XMonad.Core.XConfig.keys' <a name="line-926"></a>field of the 'XMonad.Core.XConfig' record used by xmonad. For <a name="line-927"></a>example, you could write: <a name="line-928"></a> <a name="line-929"></a>> import XMonad <a name="line-930"></a>> <a name="line-931"></a>> main = xmonad $ defaultConfig { keys = myKeys } <a name="line-932"></a> <a name="line-933"></a>and provide an appropriate definition of @myKeys@, such as: <a name="line-934"></a> <a name="line-935"></a>> myKeys conf@(XConfig {XMonad.modMask = modm}) = <a name="line-936"></a>> [ ((modm, xK_F12), xmonadPrompt defaultXPConfig) <a name="line-937"></a>> , ((modm, xK_F3 ), shellPrompt defaultXPConfig) <a name="line-938"></a>> ] <a name="line-939"></a> <a name="line-940"></a>This particular definition also requires importing "XMonad.Prompt", <a name="line-941"></a>"XMonad.Prompt.Shell", and "XMonad.Prompt.XMonad": <a name="line-942"></a> <a name="line-943"></a>> import XMonadPrompt <a name="line-944"></a>> import ... -- and so on <a name="line-945"></a> <a name="line-946"></a>For a list of the names of particular keys (such as xK_F12, and so <a name="line-947"></a>on), see <a name="line-948"></a><<a href="http://hackage.haskell.org/packages/archive/X11/latest/doc/html/Graphics-X11-Types.html">http://hackage.haskell.org/packages/archive/X11/latest/doc/html/Graphics-X11-Types.html</a>> <a name="line-949"></a> <a name="line-950"></a>Usually, rather than completely redefining the key bindings, as we did <a name="line-951"></a>above, we want to simply add some new bindings and\/or remove existing <a name="line-952"></a>ones. <a name="line-953"></a> <a name="line-954"></a>-}</span> <a name="line-955"></a> <a name="line-956"></a><span class='hs-comment'>{- $keyAdding <a name="line-957"></a>#Adding_key_bindings# <a name="line-958"></a> <a name="line-959"></a>Adding key bindings can be done in different ways. See the end of this <a name="line-960"></a>section for the easiest ways. The type signature of <a name="line-961"></a>'XMonad.Core.XConfig.keys' is: <a name="line-962"></a> <a name="line-963"></a>> keys :: XConfig Layout -> M.Map (ButtonMask,KeySym) (X ()) <a name="line-964"></a> <a name="line-965"></a>In order to add new key bindings, you need to first create an <a name="line-966"></a>appropriate 'Data.Map.Map' from a list of key bindings using <a name="line-967"></a>'Data.Map.fromList'. This 'Data.Map.Map' of new key bindings then <a name="line-968"></a>needs to be joined to a 'Data.Map.Map' of existing bindings using <a name="line-969"></a>'Data.Map.union'. <a name="line-970"></a> <a name="line-971"></a>Since we are going to need some of the functions of the "Data.Map" <a name="line-972"></a>module, before starting we must first import this modules: <a name="line-973"></a> <a name="line-974"></a>> import qualified Data.Map as M <a name="line-975"></a> <a name="line-976"></a> <a name="line-977"></a>For instance, if you have defined some additional key bindings like <a name="line-978"></a>these: <a name="line-979"></a> <a name="line-980"></a>> myKeys conf@(XConfig {XMonad.modMask = modm}) = <a name="line-981"></a>> [ ((modm, xK_F12), xmonadPrompt defaultXPConfig) <a name="line-982"></a>> , ((modm, xK_F3 ), shellPrompt defaultXPConfig) <a name="line-983"></a>> ] <a name="line-984"></a> <a name="line-985"></a>then you can create a new key bindings map by joining the default one <a name="line-986"></a>with yours: <a name="line-987"></a> <a name="line-988"></a>> newKeys x = M.union (keys defaultConfig x) (M.fromList (myKeys x)) <a name="line-989"></a> <a name="line-990"></a>Finally, you can use @newKeys@ in the 'XMonad.Core.XConfig.keys' field <a name="line-991"></a>of the configuration: <a name="line-992"></a> <a name="line-993"></a>> main = xmonad $ defaultConfig { keys = newKeys } <a name="line-994"></a> <a name="line-995"></a>All together, your @~\/.xmonad\/xmonad.hs@ would now look like this: <a name="line-996"></a> <a name="line-997"></a> <a name="line-998"></a>> module Main (main) where <a name="line-999"></a>> <a name="line-1000"></a>> import XMonad <a name="line-1001"></a>> <a name="line-1002"></a>> import qualified Data.Map as M <a name="line-1003"></a>> import Graphics.X11.Xlib <a name="line-1004"></a>> import XMonad.Prompt <a name="line-1005"></a>> import XMonad.Prompt.Shell <a name="line-1006"></a>> import XMonad.Prompt.XMonad <a name="line-1007"></a>> <a name="line-1008"></a>> main :: IO () <a name="line-1009"></a>> main = xmonad $ defaultConfig { keys = newKeys } <a name="line-1010"></a>> <a name="line-1011"></a>> newKeys x = M.union (keys defaultConfig x) (M.fromList (myKeys x)) <a name="line-1012"></a>> <a name="line-1013"></a>> myKeys conf@(XConfig {XMonad.modMask = modm}) = <a name="line-1014"></a>> [ ((modm, xK_F12), xmonadPrompt defaultXPConfig) <a name="line-1015"></a>> , ((modm, xK_F3 ), shellPrompt defaultXPConfig) <a name="line-1016"></a>> ] <a name="line-1017"></a> <a name="line-1018"></a>There are much simpler ways to accomplish this, however, if you are <a name="line-1019"></a>willing to use an extension module to help you configure your keys. <a name="line-1020"></a>For instance, "XMonad.Util.EZConfig" and "XMonad.Util.CustomKeys" both <a name="line-1021"></a>provide useful functions for editing your key bindings; "XMonad.Util.EZConfig" even lets you use emacs-style keybinding descriptions like \"M-C-<F12>\". <a name="line-1022"></a> <a name="line-1023"></a> -}</span> <a name="line-1024"></a> <a name="line-1025"></a><span class='hs-comment'>{- $keyDel <a name="line-1026"></a>#Removing_key_bindings# <a name="line-1027"></a> <a name="line-1028"></a>Removing key bindings requires modifying the 'Data.Map.Map' which <a name="line-1029"></a>stores the key bindings. This can be done with 'Data.Map.difference' <a name="line-1030"></a>or with 'Data.Map.delete'. <a name="line-1031"></a> <a name="line-1032"></a>For example, suppose you want to get rid of @mod-q@ and @mod-shift-q@ <a name="line-1033"></a>(you just want to leave xmonad running forever). To do this you need <a name="line-1034"></a>to define @newKeys@ as a 'Data.Map.difference' between the default <a name="line-1035"></a>map and the map of the key bindings you want to remove. Like so: <a name="line-1036"></a> <a name="line-1037"></a>> newKeys x = M.difference (keys defaultConfig x) (M.fromList $ keysToRemove x) <a name="line-1038"></a>> <a name="line-1039"></a>> keysToRemove :: XConfig Layout -> [((KeyMask, KeySym),X ())] <a name="line-1040"></a>> keysToRemove x = <a name="line-1041"></a>> [ ((modm , xK_q ), return ()) <a name="line-1042"></a>> , ((modm .|. shiftMask, xK_q ), return ()) <a name="line-1043"></a>> ] <a name="line-1044"></a> <a name="line-1045"></a>As you can see, it doesn't matter what actions we associate with the <a name="line-1046"></a>keys listed in @keysToRemove@, so we just use @return ()@ (the <a name="line-1047"></a>\"null\" action). <a name="line-1048"></a> <a name="line-1049"></a>It is also possible to simply define a list of keys we want to unbind <a name="line-1050"></a>and then use 'Data.Map.delete' to remove them. In that case we would <a name="line-1051"></a>write something like: <a name="line-1052"></a> <a name="line-1053"></a>> newKeys x = foldr M.delete (keys defaultConfig x) (keysToRemove x) <a name="line-1054"></a>> <a name="line-1055"></a>> keysToRemove :: XConfig Layout -> [(KeyMask, KeySym)] <a name="line-1056"></a>> keysToRemove x = <a name="line-1057"></a>> [ (modm , xK_q ) <a name="line-1058"></a>> , (modm .|. shiftMask, xK_q ) <a name="line-1059"></a>> ] <a name="line-1060"></a> <a name="line-1061"></a>Another even simpler possibility is the use of some of the utilities <a name="line-1062"></a>provided by the xmonad-contrib library. Look, for instance, at <a name="line-1063"></a>'XMonad.Util.EZConfig.removeKeys'. <a name="line-1064"></a> <a name="line-1065"></a>-}</span> <a name="line-1066"></a> <a name="line-1067"></a><span class='hs-comment'>{- $keyAddDel <a name="line-1068"></a>#Adding_and_removing_key_bindings# <a name="line-1069"></a> <a name="line-1070"></a>Adding and removing key bindings requires simply combining the steps <a name="line-1071"></a>for removing and adding. Here is an example from <a name="line-1072"></a>"XMonad.Config.Arossato": <a name="line-1073"></a> <a name="line-1074"></a>> defKeys = keys defaultConfig <a name="line-1075"></a>> delKeys x = foldr M.delete (defKeys x) (toRemove x) <a name="line-1076"></a>> newKeys x = foldr (uncurry M.insert) (delKeys x) (toAdd x) <a name="line-1077"></a>> -- remove some of the default key bindings <a name="line-1078"></a>> toRemove XConfig{modMask = modm} = <a name="line-1079"></a>> [ (modm , xK_j ) <a name="line-1080"></a>> , (modm , xK_k ) <a name="line-1081"></a>> , (modm , xK_p ) <a name="line-1082"></a>> , (modm .|. shiftMask, xK_p ) <a name="line-1083"></a>> , (modm .|. shiftMask, xK_q ) <a name="line-1084"></a>> , (modm , xK_q ) <a name="line-1085"></a>> ] ++ <a name="line-1086"></a>> -- I want modm .|. shiftMask 1-9 to be free! <a name="line-1087"></a>> [(shiftMask .|. modm, k) | k <- [xK_1 .. xK_9]] <a name="line-1088"></a>> -- These are my personal key bindings <a name="line-1089"></a>> toAdd XConfig{modMask = modm} = <a name="line-1090"></a>> [ ((modm , xK_F12 ), xmonadPrompt defaultXPConfig ) <a name="line-1091"></a>> , ((modm , xK_F3 ), shellPrompt defaultXPConfig ) <a name="line-1092"></a>> ] ++ <a name="line-1093"></a>> -- Use modm .|. shiftMask .|. controlMask 1-9 instead <a name="line-1094"></a>> [( (m .|. modm, k), windows $ f i) <a name="line-1095"></a>> | (i, k) <- zip (workspaces x) [xK_1 .. xK_9] <a name="line-1096"></a>> , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask .|. controlMask)] <a name="line-1097"></a>> ] <a name="line-1098"></a> <a name="line-1099"></a>You can achieve the same result using the "XMonad.Util.CustomKeys" <a name="line-1100"></a>module; take a look at the 'XMonad.Util.CustomKeys.customKeys' <a name="line-1101"></a>function in particular. <a name="line-1102"></a> <a name="line-1103"></a>NOTE: modm is defined as the modMask you defined (or left as the default) in <a name="line-1104"></a>your config. <a name="line-1105"></a>-}</span> <a name="line-1106"></a> <a name="line-1107"></a><span class='hs-comment'>{- $mouse <a name="line-1108"></a>#Editing_mouse_bindings# <a name="line-1109"></a> <a name="line-1110"></a>Most of the previous discussion of key bindings applies to mouse <a name="line-1111"></a>bindings as well. For example, you could configure button4 to close <a name="line-1112"></a>the window you click on like so: <a name="line-1113"></a> <a name="line-1114"></a>> import qualified Data.Map as M <a name="line-1115"></a>> <a name="line-1116"></a>> myMouse x = [ (0, button4), (\w -> focus w >> kill) ] <a name="line-1117"></a>> <a name="line-1118"></a>> newMouse x = M.union (mouseBindings defaultConfig x) (M.fromList (myMouse x)) <a name="line-1119"></a>> <a name="line-1120"></a>> main = xmonad $ defaultConfig { ..., mouseBindings = newMouse, ... } <a name="line-1121"></a> <a name="line-1122"></a>Overriding or deleting mouse bindings works similarly. You can also <a name="line-1123"></a>configure mouse bindings much more easily using the <a name="line-1124"></a>'XMonad.Util.EZConfig.additionalMouseBindings' and <a name="line-1125"></a>'XMonad.Util.EZConfig.removeMouseBindings' functions from the <a name="line-1126"></a>"XMonad.Util.EZConfig" module. <a name="line-1127"></a> <a name="line-1128"></a>-}</span> <a name="line-1129"></a> <a name="line-1130"></a><span class='hs-comment'>{- $layoutHook <a name="line-1131"></a>#Editing_the_layout_hook# <a name="line-1132"></a> <a name="line-1133"></a>When you start an application that opens a new window, when you change <a name="line-1134"></a>the focused window, or move it to another workspace, or change that <a name="line-1135"></a>workspace's layout, xmonad will use the 'XMonad.Core.layoutHook' for <a name="line-1136"></a>reordering the visible windows on the visible workspace(s). <a name="line-1137"></a> <a name="line-1138"></a>Since different layouts may be attached to different workspaces, and <a name="line-1139"></a>you can change them, xmonad needs to know which one to use. In this <a name="line-1140"></a>sense the layoutHook may be thought as the list of layouts that <a name="line-1141"></a>xmonad will use for laying out windows on the screen(s). <a name="line-1142"></a> <a name="line-1143"></a>The problem is that the layout subsystem is implemented with an <a name="line-1144"></a>advanced feature of the Haskell programming language: type classes. <a name="line-1145"></a>This allows us to very easily write new layouts, combine or modify <a name="line-1146"></a>existing layouts, create layouts with internal state, etc. See <a name="line-1147"></a>"XMonad.Doc.Extending#The_LayoutClass" for more information. This <a name="line-1148"></a>means that we cannot simply have a list of layouts as we used to have <a name="line-1149"></a>before the 0.5 release: a list requires every member to belong to the <a name="line-1150"></a>same type! <a name="line-1151"></a> <a name="line-1152"></a>Instead the combination of layouts to be used by xmonad is created <a name="line-1153"></a>with a specific layout combinator: 'XMonad.Layout.|||'. <a name="line-1154"></a> <a name="line-1155"></a>Suppose we want a list with the 'XMonad.Layout.Full', <a name="line-1156"></a>'XMonad.Layout.Tabbed.tabbed' and <a name="line-1157"></a>'XMonad.Layout.Accordion.Accordion' layouts. First we import, in our <a name="line-1158"></a>@~\/.xmonad\/xmonad.hs@, all the needed modules: <a name="line-1159"></a> <a name="line-1160"></a>> import XMonad <a name="line-1161"></a>> <a name="line-1162"></a>> import XMonad.Layout.Tabbed <a name="line-1163"></a>> import XMonad.Layout.Accordion <a name="line-1164"></a> <a name="line-1165"></a>Then we create the combination of layouts we need: <a name="line-1166"></a> <a name="line-1167"></a>> mylayoutHook = Full ||| tabbed shrinkText defaultTConf ||| Accordion <a name="line-1168"></a> <a name="line-1169"></a> <a name="line-1170"></a>Now, all we need to do is change the 'XMonad.Core.layoutHook' <a name="line-1171"></a>field of the 'XMonad.Core.XConfig' record, like so: <a name="line-1172"></a> <a name="line-1173"></a>> main = xmonad $ defaultConfig { layoutHook = mylayoutHook } <a name="line-1174"></a> <a name="line-1175"></a>Thanks to the new combinator, we can apply a layout modifier to a <a name="line-1176"></a>whole combination of layouts, instead of applying it to each one. For <a name="line-1177"></a>example, suppose we want to use the <a name="line-1178"></a>'XMonad.Layout.NoBorders.noBorders' layout modifier, from the <a name="line-1179"></a>"XMonad.Layout.NoBorders" module (which must be imported): <a name="line-1180"></a> <a name="line-1181"></a>> mylayoutHook = noBorders (Full ||| tabbed shrinkText defaultTConf ||| Accordion) <a name="line-1182"></a> <a name="line-1183"></a>If we want only the tabbed layout without borders, then we may write: <a name="line-1184"></a> <a name="line-1185"></a>> mylayoutHook = Full ||| noBorders (tabbed shrinkText defaultTConf) ||| Accordion <a name="line-1186"></a> <a name="line-1187"></a>Our @~\/.xmonad\/xmonad.hs@ will now look like this: <a name="line-1188"></a> <a name="line-1189"></a>> import XMonad <a name="line-1190"></a>> <a name="line-1191"></a>> import XMonad.Layout.Tabbed <a name="line-1192"></a>> import XMonad.Layout.Accordion <a name="line-1193"></a>> import XMonad.Layout.NoBorders <a name="line-1194"></a>> <a name="line-1195"></a>> mylayoutHook = Full ||| noBorders (tabbed shrinkText defaultTConf) ||| Accordion <a name="line-1196"></a>> <a name="line-1197"></a>> main = xmonad $ defaultConfig { layoutHook = mylayoutHook } <a name="line-1198"></a> <a name="line-1199"></a>That's it! <a name="line-1200"></a> <a name="line-1201"></a>-}</span> <a name="line-1202"></a> <a name="line-1203"></a><span class='hs-comment'>{- $manageHook <a name="line-1204"></a>#Editing_the_manage_hook# <a name="line-1205"></a> <a name="line-1206"></a>The 'XMonad.Core.manageHook' is a very powerful tool for customizing <a name="line-1207"></a>the behavior of xmonad with regard to new windows. Whenever a new <a name="line-1208"></a>window is created, xmonad calls the 'XMonad.Core.manageHook', which <a name="line-1209"></a>can thus be used to perform certain actions on the new window, such as <a name="line-1210"></a>placing it in a specific workspace, ignoring it, or placing it in the <a name="line-1211"></a>float layer. <a name="line-1212"></a> <a name="line-1213"></a>The default 'XMonad.Core.manageHook' causes xmonad to float MPlayer <a name="line-1214"></a>and Gimp, and to ignore gnome-panel, desktop_window, kicker, and <a name="line-1215"></a>kdesktop. <a name="line-1216"></a> <a name="line-1217"></a>The "XMonad.ManageHook" module provides some simple combinators that <a name="line-1218"></a>can be used to alter the 'XMonad.Core.manageHook' by replacing or adding <a name="line-1219"></a>to the default actions. <a name="line-1220"></a> <a name="line-1221"></a>Let's start by analyzing the default 'XMonad.Config.manageHook', defined <a name="line-1222"></a>in "XMonad.Config": <a name="line-1223"></a> <a name="line-1224"></a> <a name="line-1225"></a>> manageHook :: ManageHook <a name="line-1226"></a>> manageHook = composeAll <a name="line-1227"></a>> [ className =? "MPlayer" --> doFloat <a name="line-1228"></a>> , className =? "Gimp" --> doFloat <a name="line-1229"></a>> , resource =? "desktop_window" --> doIgnore <a name="line-1230"></a>> , resource =? "kdesktop" --> doIgnore ] <a name="line-1231"></a> <a name="line-1232"></a>'XMonad.ManageHook.composeAll' can be used to compose a list of <a name="line-1233"></a>different 'XMonad.Config.ManageHook's. In this example we have a list <a name="line-1234"></a>of 'XMonad.Config.ManageHook's formed by the following commands: the <a name="line-1235"></a>Mplayer's and the Gimp's windows, whose 'XMonad.ManageHook.className' <a name="line-1236"></a>are, respectively \"Mplayer\" and \"Gimp\", are to be placed in the <a name="line-1237"></a>float layer with the 'XMonad.ManageHook.doFloat' function; the windows <a name="line-1238"></a>whose resource names are respectively \"desktop_window\" and <a name="line-1239"></a>\kdesktop\" are to be ignored with the 'XMonad.ManageHook.doIgnore' <a name="line-1240"></a>function. <a name="line-1241"></a> <a name="line-1242"></a>This is another example of 'XMonad.Config.manageHook', taken from <a name="line-1243"></a>"XMonad.Config.Arossato": <a name="line-1244"></a> <a name="line-1245"></a>> myManageHook = composeAll [ resource =? "realplay.bin" --> doFloat <a name="line-1246"></a>> , resource =? "win" --> doF (W.shift "doc") -- xpdf <a name="line-1247"></a>> , resource =? "firefox-bin" --> doF (W.shift "web") <a name="line-1248"></a>> ] <a name="line-1249"></a>> newManageHook = myManageHook <+> manageHook defaultConfig <a name="line-1250"></a> <a name="line-1251"></a> <a name="line-1252"></a>Again we use 'XMonad.ManageHook.composeAll' to compose a list of <a name="line-1253"></a>different 'XMonad.Config.ManageHook's. The first one will put <a name="line-1254"></a>RealPlayer on the float layer, the second one will put the xpdf <a name="line-1255"></a>windows in the workspace named \"doc\", with 'XMonad.ManageHook.doF' <a name="line-1256"></a>and 'XMonad.StackSet.shift' functions, and the third one will put all <a name="line-1257"></a>firefox windows on the workspace called "web". Then we use the <a name="line-1258"></a>'XMonad.ManageHook.<+>' combinator to compose @myManageHook@ with the <a name="line-1259"></a>default 'XMonad.Config.manageHook' to form @newManageHook@. <a name="line-1260"></a> <a name="line-1261"></a>Each 'XMonad.Config.ManageHook' has the form: <a name="line-1262"></a> <a name="line-1263"></a>> property =? match --> action <a name="line-1264"></a> <a name="line-1265"></a>Where @property@ can be: <a name="line-1266"></a> <a name="line-1267"></a>* 'XMonad.ManageHook.title': the window's title <a name="line-1268"></a> <a name="line-1269"></a>* 'XMonad.ManageHook.resource': the resource name <a name="line-1270"></a> <a name="line-1271"></a>* 'XMonad.ManageHook.className': the resource class name. <a name="line-1272"></a> <a name="line-1273"></a>* 'XMonad.ManageHook.stringProperty' @somestring@: the contents of the <a name="line-1274"></a> property @somestring@. <a name="line-1275"></a> <a name="line-1276"></a>(You can retrieve the needed information using the X utility named <a name="line-1277"></a>@xprop@; for example, to find the resource class name, you can type <a name="line-1278"></a> <a name="line-1279"></a>> xprop | grep WM_CLASS <a name="line-1280"></a> <a name="line-1281"></a>at a prompt, then click on the window whose resource class you want to <a name="line-1282"></a>know.) <a name="line-1283"></a> <a name="line-1284"></a>@match@ is the string that will match the property value (for instance <a name="line-1285"></a>the one you retrieved with @xprop@). <a name="line-1286"></a> <a name="line-1287"></a>An @action@ can be: <a name="line-1288"></a> <a name="line-1289"></a>* 'XMonad.ManageHook.doFloat': to place the window in the float layer; <a name="line-1290"></a> <a name="line-1291"></a>* 'XMonad.ManageHook.doIgnore': to ignore the window; <a name="line-1292"></a> <a name="line-1293"></a>* 'XMonad.ManageHook.doF': to execute a function with the window as <a name="line-1294"></a> argument. <a name="line-1295"></a> <a name="line-1296"></a>For example, suppose we want to add a 'XMonad.Config.manageHook' to <a name="line-1297"></a>float RealPlayer, which usually has a 'XMonad.ManageHook.resource' <a name="line-1298"></a>name of \"realplay.bin\". <a name="line-1299"></a> <a name="line-1300"></a>First we need to import "XMonad.ManageHook": <a name="line-1301"></a> <a name="line-1302"></a>> import XMonad.ManageHook <a name="line-1303"></a> <a name="line-1304"></a>Then we create our own 'XMonad.Config.manageHook': <a name="line-1305"></a> <a name="line-1306"></a>> myManageHook = resource =? "realplay.bin" --> doFloat <a name="line-1307"></a> <a name="line-1308"></a>We can now use the 'XMonad.ManageHook.<+>' combinator to add our <a name="line-1309"></a>'XMonad.Config.manageHook' to the default one: <a name="line-1310"></a> <a name="line-1311"></a>> newManageHook = myManageHook <+> manageHook defaultConfig <a name="line-1312"></a> <a name="line-1313"></a>(Of course, if we wanted to completely replace the default <a name="line-1314"></a>'XMonad.Config.manageHook', this step would not be necessary.) Now, <a name="line-1315"></a>all we need to do is change the 'XMonad.Core.manageHook' field of the <a name="line-1316"></a>'XMonad.Core.XConfig' record, like so: <a name="line-1317"></a> <a name="line-1318"></a>> main = xmonad defaultConfig { ..., manageHook = newManageHook, ... } <a name="line-1319"></a> <a name="line-1320"></a>And we are done. <a name="line-1321"></a> <a name="line-1322"></a>Obviously, we may wish to add more then one <a name="line-1323"></a>'XMonad.Config.manageHook'. In this case we can use a list of hooks, <a name="line-1324"></a>compose them all with 'XMonad.ManageHook.composeAll', and add the <a name="line-1325"></a>composed to the default one. <a name="line-1326"></a> <a name="line-1327"></a>For instance, if we want RealPlayer to float and thunderbird always <a name="line-1328"></a>opened in the workspace named "mail", we can do so like this: <a name="line-1329"></a> <a name="line-1330"></a>> myManageHook = composeAll [ resource =? "realplay.bin" --> doFloat <a name="line-1331"></a>> , resource =? "thunderbird-bin" --> doF (W.shift "mail") <a name="line-1332"></a>> ] <a name="line-1333"></a> <a name="line-1334"></a>Remember to import the module that defines the 'XMonad.StackSet.shift' <a name="line-1335"></a>function, "XMonad.StackSet", like this: <a name="line-1336"></a> <a name="line-1337"></a>> import qualified XMonad.StackSet as W <a name="line-1338"></a> <a name="line-1339"></a>And then we can add @myManageHook@ to the default one to create <a name="line-1340"></a>@newManageHook@ as we did in the previous example. <a name="line-1341"></a> <a name="line-1342"></a>One more thing to note about this system is that if <a name="line-1343"></a>a window matches multiple rules in a 'XMonad.Config.manageHook', /all/ <a name="line-1344"></a>of the corresponding actions will be run (in the order in which they <a name="line-1345"></a>are defined). This is a change from versions before 0.5, when only <a name="line-1346"></a>the first rule that matched was run. <a name="line-1347"></a> <a name="line-1348"></a>Finally, for additional rules and actions you can use in your <a name="line-1349"></a>manageHook, check out the contrib module "XMonad.Hooks.ManageHelpers". <a name="line-1350"></a> <a name="line-1351"></a>-}</span> <a name="line-1352"></a> <a name="line-1353"></a><span class='hs-comment'>{- $logHook <a name="line-1354"></a>#The_log_hook_and_external_status_bars# <a name="line-1355"></a> <a name="line-1356"></a>When the stack of the windows managed by xmonad changes for any <a name="line-1357"></a>reason, xmonad will call 'XMonad.Core.logHook', which can be used to <a name="line-1358"></a>output some information about the internal state of xmonad, such as the <a name="line-1359"></a>layout that is presently in use, the workspace we are in, the focused <a name="line-1360"></a>window's title, and so on. <a name="line-1361"></a> <a name="line-1362"></a>Extracting information about the internal xmonad state can be somewhat <a name="line-1363"></a>difficult if you are not familiar with the source code. Therefore, <a name="line-1364"></a>it's usually easiest to use a module that has been designed <a name="line-1365"></a>specifically for logging some of the most interesting information <a name="line-1366"></a>about the internal state of xmonad: "XMonad.Hooks.DynamicLog". This <a name="line-1367"></a>module can be used with an external status bar to print the produced <a name="line-1368"></a>logs in a convenient way; the most commonly used status bars are dzen <a name="line-1369"></a>and xmobar. <a name="line-1370"></a> <a name="line-1371"></a>By default the 'XMonad.Core.logHook' doesn't produce anything. To <a name="line-1372"></a>enable it you need first to import "XMonad.Hooks.DynamicLog": <a name="line-1373"></a> <a name="line-1374"></a>> import XMonad.Hooks.DynamicLog <a name="line-1375"></a> <a name="line-1376"></a>Then you just need to update the 'XMonad.Core.logHook' field of the <a name="line-1377"></a>'XMonad.Core.XConfig' record with one of the provided functions. For <a name="line-1378"></a>example: <a name="line-1379"></a> <a name="line-1380"></a>> main = xmonad defaultConfig { logHook = dynamicLog } <a name="line-1381"></a> <a name="line-1382"></a>More interesting configurations are also possible; see the <a name="line-1383"></a>"XMonad.Hooks.DynamicLog" module for more possibilities. <a name="line-1384"></a> <a name="line-1385"></a>You may now enjoy your extended xmonad experience. <a name="line-1386"></a> <a name="line-1387"></a>Have fun! <a name="line-1388"></a> <a name="line-1389"></a>-}</span> </pre></body> </html>