https://wiki.haskell.org/api.php?action=feedcontributions&user=Kapil&feedformat=atomHaskellWiki - User contributions [en]2024-03-29T00:16:48ZUser contributionsMediaWiki 1.35.5https://wiki.haskell.org/index.php?title=Xmonad/Config_archive&diff=53031Xmonad/Config archive2012-09-14T13:24:09Z<p>Kapil: Add script with networkmanager controls</p>
<hr />
<div>{{xmonad}}<br />
<br />
__TOC__<br />
<br />
==Quick Introductions to Haskell==<br />
For a brief overview of haskell syntax, see [http://cs.anu.edu.au/student/comp1100.2007.s2/haskell/tourofsyntax.html Tour of the Haskell Syntax]. For style suggestions and explanations of how to use layout aka whitespace, see [http://urchin.earth.li/~ian/style/haskell.html Ian's Guide to Good Haskell Style] and this wikibook regarding [http://en.wikibooks.org/wiki/Haskell/Indentation indentation and whitespace]. For more in-depth treatments of Haskell syntax and learning how to program in Haskell, see the sidebar <code>Learning</code> links on [http://haskell.org haskell.org].<br />
<br />
==XMonad Configuration Examples==<br />
For more screenshots see the [[Xmonad/Screenshots]] archive.<br />
<br />
'''''EwmhDesktops users upgrading to xmonad-0.9.*''''' '', please note layoutHook, handleEventHook, startupHook change.'' For more information about how to update your Ewmh configuration, and other changes that may require edits to <hask>xmonad.hs</hask>, see the [http://www.haskell.org/haskellwiki/Xmonad/Notable_changes_since_0.8 0.9 release changelog].<br />
<br />
=== Template xmonad config files ===<br />
;[[/Template xmonad.hs (0.9)]] -- (Or for darcs<nowiki>:</nowiki> [[/Template xmonad.hs (darcs)]])<br />
<br />
The template xmonad.hs file shows all the default xmonad settings; it is merely a slightly modified reference copy of the XMonad source module which sets up the configuration. Note that while this file is usable, it contains lots of uneeded extra settings; normally you would only include and customize the parts you want to change. If you don't want to use the minimal style as shown in the following tutorial, you can copy-and-paste from the template instead.<br />
<br />
For a plain text version of the template see the <code>man/xmonad.hs</code> file distributed with xmonad source, or you can<br />
[http://code.haskell.org/xmonad/man/xmonad.hs download the latest darcs template xmonad.hs] from<br />
code.haskell.org.<br />
<br />
=== Minimal xmonad config files ===<br />
The Arch Linux introduction to [https://wiki.archlinux.org/index.php/Xmonad configuring XMonad] is a good place to start.<br />
<br />
Also see the [[/John_Goerzen%27s_Configuration|John Goerzen tutorial]] for an example of customizing a minimal xmonad.hs like the following:<br />
<br />
<haskell><br />
import XMonad<br />
<br />
main = xmonad defaultConfig<br />
{ modMask = mod4Mask -- Use Super instead of Alt<br />
, terminal = "urxvt"<br />
-- more changes<br />
}<br />
</haskell><br />
<br />
=== Configs requiring the darcs (development) version of XMonad ===<br />
; [[/adamvo's xmonad.hs]] (darcs)<br />
: XMobars for multiple screens (xmobar>0.9.2), mediaKeys, SubLayouts, TopicSpace, support for replacing and temporarily running other window managers, extensive gridselect usage.<br />
[[Image:adamvo-single-screen.png|center|200px]] [[Image:adamvo-gridselect.png|center|200px]]<br />
<br />
;[[/And1's xmonad.hs]] (darcs)<br />
:mirrored layout, manageHook, dynamicLog with dzen, conky piped into dzen,<br />
:urgency hints, perWorkspace layouts, gimpLayout, PP for dzen and xmobar,<br />
:custom keys with application shortcuts and mpd controls, gridSelect;<br />
:more of my screenshots can be found in my [http://and1.donnergurgler.net/screenshots/ screenshots/] directory<br />
[[Image:and1_xmonad.png|center|200px]]<br />
<br />
;[[/Brent Yorgey's darcs xmonad.hs]] (darcs)<br />
:Tons of cruft accumulated over many years of using xmonad; probably everyone can find something in here that interests them! Features annotations showing which contrib modules are being used where, to make it easier to figure out how to use a given contrib module, or how to pull out little pieces of functionality for use in your own config.<br />
[[Image:byorgey-config.png|center|200px]]<br />
<br />
;;[[/hgabreu's xmonad.hs]] (darcs)<br />
: One screen, SubLayouts, FadeInactive (with custom toggle fade), case insensitive shell prompt, heavy manageHook and keybindings customization.<br />
<br />
;[[/loupgaroublonds xmonad.hs]] (darcs)<br />
: Gnome and kde compatible config with topicspaces and dynamic workspaces set up for context oriented workspaces. Uses xmonad-extras package for mpd.<br />
[[Image:loupgaroublond-config.png|center|200px]]<br />
<br />
;[[/Marcot's xmonad.hs]] (darcs)<br />
; With Gnome support and Multimedia Keyboard configuration<br />
[[Image:Captura_da_tela.png|center|200px|Marcot]]<br />
<br />
;[[/Nnoell's xmonad.hs]] (0.10)<br />
:Xmonad stand-alone setup with dzen clickable workspaces, conky piped into dzen, toggle tabbed layout, scratchpad and some other cool things. Additional configs on [https://dl.dropbox.com/u/43104750/nnoell_configs_v1.tar.xz here].<br />
[[Image:NNoeLLs Desktop 3.png|center|200px]]<br />
<br />
;[[/Regalia's xmonad.hs]] (darcs)<br />
:Moderately customized. Some useful bits acquired over some time.<br />
[[Image:Regalia xmonad2.png|center|400px]]<br />
<br />
;[[/Thayer Williams' xmonad.hs]] (0.9)<br />
:A simple, mouse-friendly xmonad config geared towards netbooks and other low-resolution devices. Dzen is used for statusbar rendering, with optional mouse integration provided by xdotool.<br />
[[Image:Thayer-xmonad-20110511.png|center|200px]]<br />
<br />
;[[/TTimo xmonad.hs]](0.10)<br />
:Basic config with xmobar, hopefully a good starting point for more complex setups<br />
<br />
=== Configs for the current XMonad release (0.9.*)===<br />
Many of these will also work with the darcs version of XMonad.<br />
<br />
;[http://www.linuxandlife.com/2011/11/how-to-configure-xmonad-arch-linux.html /Linux and Life's tutorial]<br />
:A tutorial to install and configure xmonad-0.9.2 with xmobar and trayer in Arch Linux. It also shows how to use the french keyboard layout and laptop function keys in xmonad.<br />
[[Image:My-Xmonad-desktop.png|center|300px]]<br />
<br />
[[Image:Xmonad-desktop-busy.png|center|300px]]<br />
<br />
;[[/31d1's xmonad.hs]] (0.9/gnome)<br />
<br />
;[[/Andrea Rossato's xmonad.hs]] (0.8 +)<br />
:Tabbed, Xmobar with DynamicLog, (Shell|Ssh|Man)Prompt.<br />
[[Image:Arossato-config.png|center|200px]]<br />
<br />
; [[/Andrea Spada xmonad.hs]] (0.8 +)<br />
: Tall, Resizable Mosaic and Combo, EvmhDesktops, additional keybindings - Work In Progress...<br />
<br />
; [[/andrewsw's xmonad.hs]] (0.8 +)<br />
; [[/andrewsw's .Xdefault]]<br />
: These screenshots show some compositing and nice transparent urxvt's with a circle layout and a magnified grid layout.<br />
<gallery>Image:Xmonad-circle-comp.jpg<br />
Image:Xmonad-mag-grid.jpg</gallery><br />
<br />
; [[/avendael's xmonad.hs]] (0.9)<br />
; [[/avendael's .conky_bar]]<br />
:A very simple xmonad configuration that has conky piped into dzen with icons.<br />
:Workspace names are also changed into icons just for fun ;)<br />
[[Image:avendael_xmonad.png|center|200px]]<br />
<br />
; [[/brad's xmonad.hs]] (0.8 +)<br />
: very basic, just some cosmetic and key-shortcut changes<br />
[[Image:brad.png|center|200px]]<br />
<br />
; [[/David Beckingsale's xmonad.hs]] (0.9)<br />
: Xmonad config using the zenburn colour scheme. Uses custom keybindings for frequent tasks. Status bar is conky powered dzen2<br />
<br />
;[[/David Roundy's xmonad.hs]] (0.8 +)<br />
:Combo config for small screen + xclock. This config also keeps mod=mod1, and therefore moves a number of key bindings to non-standard locations (my laptop has no spare modifier keys).<br />
[[Image:droundy-config.png|center|200px]]<br />
<br />
;[[/dmwit's xmonad.hs]] (0.9 + darcs from about March 2010. Works with 0.9)<br />
;[[/dmwit's .xmobarrc]]<br />
:A somewhat screen-count-agnostic config, as I use this same file on :machines with several different physical setups. Auxiliary apps: :trayer, xmobar, dzen, yeganesh; layouts: fullscreen and Grid, with<br />
:independent workspaces on each screen. Uses some unapplied patches to<br />
:xmobar.<br />
[[Image:dmwit-config.png|center|200px]]<br />
<br />
;[[/doitan's xmonad.hs]] (0.8 +)<br />
:libnotify UrgencyHook, many features from tips and tricks page integrated, many custom prompts including workspace and layout switching. [http://snipt.net/doitian dotfiles]<br />
<br />
;[[/Don's xmonad.hs]] (0.9)<br />
:colours, use custom terminal, dynamicLogDzen<br />
[[Image:Xmonad-screen-dons-code.png|center|200px]]<br />
<br />
;[[/enko's xmonad.hs]] (0.8 +)<br />
: I'm using xmobar and mostly tall layout (but in really it is just fullscreenlayout since there aren't any other windows). The config is accumulated stuff and could be cleaned of cruft, but since I don't know ATM what is cruft and what not, it is not an option, but it works for me™. I'm using urxvt as a terminal and the mailer you can see there is [http://www.gohome.org/wl/ wanderlust] for emacs. You can also see my [http://github.com/enko/dotfiles/tree/master screen setup] at the bottom.<br />
[[Image:2008-10-20-205748 1680x1050 scrot.png|center|200px]]<br />
<br />
; [[/eschulte xmonad.hs]] (0.9)<br />
: Basic config for running overtop of the XFCE (in this case Xubuntu) desktop, with the XFCE panel shown.<br />
[[Image:eschulte.png|center|200px]]<br />
<br />
;[[/Gwern's xmonad.hs]] (0.10)<br />
:Ratpoison-y keybindings; example usage of XSelection with searches.<br />
<br />
; [[/Herzen's xmonad.hs]] (0.9)<br />
: Integrates with the Gnome Panel. This config uses the Gnome Panel both<br />
: to display xmonad's status (using the Gnome Workspace Switcher applet,<br />
: based on John Yates' config) and to display the current window's title<br />
: (using awick's xmonad log applet and DBus module from hackage).<br />
<br />
;[[/ivy-foster-xmonad.hs|/Ivy Foster's xmonad.hs]] (0.9.2)<br />
: One screen; xmobar; customized ManageHooks; NamedScratchPads<br />
[[Image:ivy-foster-xmonad-screenshot.png|center|200px]]<br />
<br />
;[[/jelly(12gen)'s xmonad.hs]] (0.9)<br />
;[[/jelly(12gen)'s xmobarrc]]<br />
; Standard setup using ShellPrompt, Actions.Search, xmobar, urgencyhook, custsom keybindings and scratchpad. <br />
[[Image:Screenshot 090711.png|center|200px]]<br />
<br />
;[[/John Goerzen's Configuration|/John Goerzen's Configuration and Tutorial]] (0.8)<br />
: A step-by-step guide to customizing Xmonad, starting from where the tutorial leaves off, getting to a configuration with xmobar and simple but intentionally minimal customizations in xmonad.hs<br />
[[Image:john-goerzen-xmonad-screenshot.png|center|200px]]<br />
<br />
;[[john-yates-xmonad.hs|/John Yates' polished Gnome bar]] (0.8 +)<br />
: This is an attempt to provide an easy path into the world of tiling window managers for colleagues using recent Ubuntu and RedHat distributions. Emphasis is on visual integration with familar UI elements while conforming to widespread tiling WM idioms: (1) a single bar, (2) no window decoration, (3) current window's title display in the bar. Starting from a vanilla Ubuntu Gnome setup I eliminated the lower Gnome panel and its applets. On the remaining upper panel I included left to right: (1) a standard Gnome separator applet, (2) the Gnome Window Selector applet, (3) dzen2 built with Xft support displaying the current window's title, (4) the Gnome Workspace Switcher applet:<br />
[[Image:john-yates-gnome-bar.png|center|600px]]<br />
: The Window Selector icon tracks the displayed window title. Clicking on that icon activates the selector, displaying window titles grouped by workspace:<br />
[[Image:john-yates-gnome-window-selector.png|center|600px]]<br />
: Mod-p preserves Xmonad's default dmenu binding. Keeping with the emphasis on font consistency I created a version of dmenu that supports Xft fonts and a bar height option (currently available as a [[dmenu-4.0-xft.diff|patch]] against dmenu 4.0):<br />
[[Image:john-yates-gnome-dmenu.png|center|600px]]<br />
: At present my [[john-yates-xmonad.hs|xmonad.hs]] is utterly sparse, attempting only to simplify the process of accommodating additional themes.<br />
<br />
; [[/Josh Rickmar's xmonad.hs]] (0.8 +)<br />
; [[/Josh Rickmar's dzenscript]]<br />
: This config uses keybindings optimized for the [http://colemak.com Colemak keyboard layout], alternate swapUp/Down methods which won't cycle windows if moving the last to first or vice-versa, a nice dzen2 status bar, and dwm-like tagging with CopyWindow. Workspaces which contain copies of windows are displayed with a different XPM in dzen (dwm-style). Xinerama keybindings are also removed, simply because I don't use them.<br />
[[Image:Jrick-xmonad.png|center|200px]]<br />
<br />
; [[/Kapil gnomemenuadd.hs]] (0.10)<br />
:A hack to make the Gnome Menu popup just like the Gnome Run dialog pops up. This is a minimal addition to XMonad.Config.Gnome so that "dmenu" type programs are not _required_. This tries to solve [https://code.google.com/p/xmonad/issues/detail?id=451 Issue 451 in Xmonad].<br />
<br />
; [[/Kapil's networkmanagerprompt.hs]] (0.10)<br />
:Use XMonad.Prompt.Input to prompt the user to bring up and take down network connections using "nmcli". This xmonad.hs is a snippet that can be used to add this functionality to other configs. In principle, it should be possible to avoid "nmcli" altogether using the dbus interface to haskell.<br />
<br />
; [[/k6b (kyle's) xmonad.hs]] (0.9.2)<br />
; [[/k6b (kyle's) xmobarrc]] (0.11.1)<br />
:<br />
: Two xmobar's, startup script, dmenu, some custom keybindings, work in progress!<br />
: Dirty<br />
[[Image:k6b-xmonad.png|center|200px]]<br />
: Clean<br />
[[Image:k6b-xmonad-clean.png|center|200px]]<br />
<br />
;[[/lars' xmonad.hs]] (0.8 +)<br />
:Move/Resize windows using keyboard easily:<br />
:1. move window around using M-Arrows.<br />
:2. resize windows using C-Arrows.<br />
:3. Holding <Shift> to move/resize 2 pixels per step instead of 20 pixels.<br />
:Please find the lines below comment "-- moving floating window with key" to see details.<br />
<br />
;[http://blog.gravityfour.com/2012/01/easyxmotion-switch-between-any-window.html Loki's config using easyxmotion (0.10) ]<br />
This config uses [https://github.com/loki42/easyxmotion easyxmotion] to switch between any window in 2 keypresses. Inspired by the easy motion vim plugin. The [https://github.com/loki42/dotfiles/blob/master/_xmonad/xmonad.hs xmonad.hs] is very simple and also uses WindowGo and ewmh desktops. The letters appear when I click the menu key, next to right alt. Then type the letter to focus that window.<br />
[[Image:Easyxmotion.png|center|400px]]<br />
<br />
; [[/Mntnoe's xmonad.hs]] (0.9)<br />
: Heavily modified modular xmonad config. (I.e. use ~/.xmonad/lib/* .) Highlights: Pager with icons. Per application configuration. Minimize windows.<br />
[[Image:Mntnoe-xmonad-2010-04-25.png|center|200px]]<br />
<br />
;[[/lithis's xmonad.hs]] (0.9)<br />
;[[/lithis's xmobarrc]] (newer than xmobar-0.9)<br />
:The screenshot shows xmobar, two screens, a spiral layout, a tabbed layout, XFT fonts, and ShellPrompt with tab completion. The config also has pointer follows focus.<br />
[[Image:lithis-xmonad.png|center|200px]]<br />
<br />
;[[/lorincs xmonad.hs]] (0.9)<br />
: Config for using xcompmgr with kde4. [http://blog.cpst.hu/tiki-read_article.php?articleId=21 See blog for more details].<br />
<br />
;[[/nattfodd's xmonad.hs]] (0.8 +)<br />
:DynamicLog, smartBorders, French keyboard, defaultGap, urgencyHook in workspace toolbar and some prompts.<br />
[[Image:Nattfodd-xmonad-0.7.png|center|200px]]<br />
<br />
;[[/Octoploid's xmonad.hs]] (0.9)<br />
:Xmobar with customized DynamicLog, CycleWS with custom keys, colors, terminal, golden ratio<br />
[[Image:Octoploid_conf.png|center|200px]]<br />
<br />
;[[/oxymor00n's xmonad.hs]] (darcs ?)<br />
:[[/oxymor00n's xmobarrc]]<br />
:Tabbed layout, Floating Layout, xmobar, EZConfig for Emacs-like keybinding-definition, added some bindings for the mouse wheel (cycle focus and cycle workspaces), cycleWS-stuff that might be interesting for Xinerama-users,...<br />
[[Image:oxymor00n-xmonad.png|center|200px]]<br />
<br />
;[[/Robert Massaioli's xmonad.hs]]<br />
:This XMonad is based on Thomas ten Cate's xmonad.hs and it is designed for Dvorak. For more information please see my blog post: [http://massaioli.homelinux.com/wordpress/2010/04/15/extending-xmonad-for-dvorak/]<br />
[[Image:RobertMassaiolisXmonadDesktop.png|center|400px]]<br />
<br />
; [[/sereven xmonad.hs]] (0.9.2 - 0.10)<br />
: Reduced to minimum that sees daily use. Arrow + vi window navigation. Lots of left hand only keys, for full function with both hands on keyboard, or with one on mouse. While no longer use them old dzen grid icons are [http://code.haskell.org/~wwolff/_xmonad/icons/grid_icons.tar.bz2 here]. Latest xmonad.hs [http://github.com/wwolff/configs here].<br />
[[Image:2011.03-srvn 2560x960.png|center|400px]]<br />
<br />
; [[/sykopomp's xmonad.hs]] (0.9)<br />
; [[/sykopomp's xmonad.dv-vi.hs]]<br />
; This screenshot shows xfce-panel with pager + xmonad in a ResizableTall layout. Also using compositing and transparent urxvt's (thanks andrewsw) with bindings for changing transparency on focused window. Keybindings have been completely redone to be more similar to emacs-bindings (M-p and M-n for previous and next windows). The other config is an older config that uses the standard vi-like bindings, but translated by location to a dvorak layout.<br />
[[Image:xmonad-screen-xinerama-composite-xfce.jpg|center|200px]]<br />
<br />
; [[/TeXitoi's xmonad.hs]] (0.8 and 0.9)<br />
: bepo typematrix keyboard, desktopConfig, fadeInactive. Minimal configuration file with defaults not overwritten. Mist GTK theme, xcompmgr and Xfce4-panel are used.<br />
<br />
[[Image:Xmonad-xfce-panel.png|center|200px|TeXitoi]]<br />
<br />
; [[/Thomas ten Cate's xmonad.hs]] (0.8 +)<br />
: Designed for Ubuntu (Gnome), the Windows key, and a dvorak keyboard. Workspaces accessible through Alt+F1..F10 so they don't interfere with Alt+1..9 used by irssi/Firefox/etc.<br />
: Instant messaging (Skype and Pidgin) buddy lists are automatically placed on the side of the IM workspace, with chat windows being placed in the rest of this area. This uses some code modified from [http://hackage.haskell.org/packages/archive/xmonad-contrib/0.8/doc/html/XMonad-Layout-IM.html XMonad.Layout.IM].<br />
: Extensive comments at the top of the file explain the keybindings and usage.<br />
<br />
; [[/thoughtpolice's xmonad.hs]] (0.9)<br />
; [[/thoughtpolice's xmobarrc]] (0.9)<br />
; Emacs-esque keyboard bindings via EZConfig, dynamicLog with dzen, Submap google/hoogle/amazon/imdb/youtube/wikipedia searching, Shell & Ssh modules, slightly custom XPConfig and avoidStruts (ManageDocks.)<br />
<br />
;[https://github.com/vicfryzel/xmonad-config Vic Fryzel's xmonad configuration] (0.9)<br />
: Multiple named workspaces and layouts. Comes with themed colors, xmobar configuration, scripts for things like dmenu and screenshots, standard and custom key bindings, etc. Check out the [https://github.com/vicfryzel/xmonad-config/raw/master/screenshot.png screenshot].<br />
<br />
;[[/void's xmonad.hs]] (0.8 +)<br />
: dzen2 DynamicLog (in robert's style) and UrgencyHook, LayoutCombinators, IM workspace for Pidgin (on the right) with 2 layouts a dwmStyle decorated ResizableTall and a tabbed one, use of PerWorkspace and Named layouts, Scratchpad, custom theme, EZConfig for keybindings, NoBorders (and smarts too)<br />
<br />
;[[/vvv's xmonad.hs]] (0.9)<br />
:EZConfig, CycleWS, {Man,Shell,Ssh}Prompt, Submap, DynamicWorkspaces, NoBorders, and ion-like status bar (written in nonkosher Perl).<br />
[[Image:vvv-config.png|center|200px]]<br />
<br />
;[[/webframp's xmonad.hs]] (darcs)<br />
: Basic Mirror tiled and ResizableTall layout, EZConfig keybindings,<br />
: dynamicLogWithPP + dzen, CycleWS, Prompt, promptSearch, Scratchpad, updatePointer, perWorkspace, compositing.<br />
[[Image:Webframp-xmonad-ss-invaders.png|center|200px]]<br />
<br />
;[[/Wraithan's xmonad.hs]] (0.9)<br />
: Pretty standard setup using ShellPrompt, ResizableTile (with hinting), and xmobar for a little bit of the info I want.<br />
[[Image:Wraithan-Desktop-2009-12-15.png|center|200px]]<br />
<br />
==== Broken 0.9 configs ====<br />
;[[/gray_hemp's xmonad.hs]] (0.9)<br />
;[[/gray_hemp's .conky_cpu]]<br />
;[[/gray_hemp's .conky_battery]]<br />
;[[/gray_hemp's .conky_time]]<br />
;[[/gray_hemp's .xxkbrc]]<br />
:dzen plus conky config using dzen icons, resizable tall, xmonad shell prompt, urgency popup, status bar formatting, xxkb keyboard indicator.<br />
[[Image:gray_hemp.png|center|200px]]<br />
<br />
=== Old configs ===<br />
This section is for configurations which do not work with the the latest release version of xmonad.<br />
<br />
Note that the configuration file is 'Config.hs' for xmonad < 0.5, but 'xmonad.hs' for xmonad >= 0.5.<br />
<br />
Many config files marked as 0.5 probably work in 0.6 as well; give it a try and ask on the #xmonad IRC channel on freenode.org if you have problems.<br />
<br />
;[[/Template xmonad.hs (0.8)]]<br />
;[[/Template xmonad.hs (0.7)]]<br />
;[[/Template xmonad.hs (0.6)]]<br />
:Previous versions of the default configuration.<br />
<br />
;[[/andrewsw's xmonad.hs]] (0.6)<br />
<br />
;[[/arossato's Config.hs]] (0.4)<br />
<br />
;[[/Brent Yorgey's xmonad.hs]] (0.6)<br />
<br />
;[[/cce xmonad.hs]] (0.5)<br />
: alt+enter full screen, alt+hjkl to navigate, many remapped keys<br />
<br />
;[[/deifl's xmonad.hs]] (0.5)<br />
:DynamicLog, WindowBringer, CopyWindow, ResizableTile, Tabbed layout. not default terminal, changed colors and some instances of dzen.<br />
<gallery>Image:D_xmonad_clear.jpg|Clean<br />
Image:D_xmonad_full.jpg|Populated</gallery><br />
<br />
;[[/Don's Config.hs]] (0.4)<br />
<br />
;[[/entropies xmonad.hs]] (0.5)<br />
: windows as meta key, fullscreen & noborders on keypress for client. custom keybindings. magnifier.<br />
[[Image:entropie-config.png|center|200px]]<br />
<br />
;[[/Eric Mertens' xmonad.hs]] (0.5)<br />
:[[/Eric Mertens's Config.hs]] (0.4)<br />
:Customized DynamicLog, ShellPrompt, TilePrime, Dual-head and an effort to make the statusbar similar to DWM.<br />
[[Image:glguy-config.jpg|center|400px]]<br />
<br />
;[[/Erthad's xmonad.hs]] (darcs 25 Aug 2008/0.7)<br />
: mixed hotkeys config (standard+EZConfig), wmii-like keyboard behavior,<br />
: EWMH desktops, dzen integration (dzen configs see at http://fly.osdn.org.ua/~erthad/)<br />
<br />
;[[/Gwern's Config.hs (0.4)]] (old)<br />
<br />
[[/iderrick xmonad.hs]] (0.8)<br />
: Maximize, Dynamiclog with xmobar, Custom layout (with Combo) for latex writing (xpdf + editor + little terminal), French keyboard, Windows key for shortcuts<br />
<br />
[[Image:iderrick.png|center|200px]]<br />
;[[/lazor's xmonad.hs]] (0.8)<br />
: working xmonad.hs for KDE 4.2<br />
[[Image:screenshot-xmonad-lazor.jpg|center|200px]]<br />
<br />
; [[/Lee Aylward's xmonad.hs]] (0.5)<br />
: Resizable Tall, NoBorders, dzen DynamicLog, rhythmbox control shortcuts, windows key<br />
[[Image:leeaylward.png|center|400px]]<br />
<br />
; [[/Mr.Elendig's xmonad.hs]] (0.7)<br />
; Somewhat simple, but verbose config, with ResizableTall, xmobar and mpd controlls.<br />
[[Image:mre-ss1.png|center|200px]]<br />
<br />
;[[/nomeatas Config.hs]] (0.4)<br />
:modMask = mod4Mask; gnome-stuff<br />
<br />
;[[/nomeata’s xmonad.hs]] (xmonad 0.7)<br />
: CycleWS to avoid changing visible workspaces on other screens, EWMH, UpdatePointer, avoidStruts, IM for piding (on the right side), fullscreen via toggleLayouts, no boarders,<br />
<br />
;[[/Ray's xmonad.hs]] (0.5)<br />
:DynamicLog, custom manageHook, changed from default terminal, border colors, prompts, and layouts. Pseudo-Haskell dzen statusbar with Greek letters for workspace names.<br />
[[Image:Ray-config.png|center|200px]]<br />
<br />
;[[/Robert Manea's Config.hs and support scripts]] (0.4)<br />
0.4 screenshot: [[Image:rob-config.png|center|400px]]<br />
<br />
;[[/Robert Manea's xmonad.hs]] (0.8)<br />
:Customized DynamicLog and ShellPrompt, ManageDock, some efforts to make the colors of all components go together well<br />
0.5 screenshot: [[Image:Xmonad_shellprompt_newconf.png|center|400px]]<br />
<br />
; [[/Remi's xmonad.hs]] (0.7)<br />
; [[/Remi's .xmobarrc]] (0.8)<br />
; [[/Remi's .xinitrc]]<br />
: Lots of key bindings for destkop-navigation/moving, xmonad.hs-editing, music, next-N-windows-float-hack. xmobar integration and PerWorkspace Layouts. And a yet-to-be-published libmpd xmobar plugin.<br />
[[Image:Remi-xmonad-screenshot.png|center|200px]]<br />
<br />
; [[/rtalreja's xmonad.hs]] (0.8.1)<br />
; [[/rtalreja's .conkyrcdzen]]<br />
:dynamicLogWithPP with dzen, conky piped into dzen, urgency hints, compositing, shortcuts for mpd controls.<br />
[[Image:rtalreja-screenshot.png|center|200px]]<br />
<br />
; [[/skorpan's xmonad.hs]] (0.8)<br />
; [[/skorpan's xmobarrc]] (0.9)<br />
: Red/gray borders + NoBorders, EZConfig, xmobar 0.9 with workspaces, layout, title, battery, CPU usage, memory usage, date and time.<br />
[[Image:2009-01-25-183906 1280x800 scrot.png|center|200px]]<br />
<br />
; [[/sphynx's xmonad.hs]] (0.7)<br />
: Emacs-style keybindings, xmobar integration, XFT-fonts, ManageDocks, Tabbed layout, IM layout for Pidgin and Skype configured through PerWorkspace, Search extension for Wikipedia, translation and Google, usage of CopyWindow to 'make window always visible', Urgency hook, PerWorkspace usage, Scratchpad terminal, custom styles for prompt and borders.<br />
<br />
;[[/twifkak's Config.hs]] (0.4)<br />
;[[/twifkak's xmonad.hs]] (0.8)<br />
:modMask = mod4Mask; noBorders tabbed layout; keybindings for dzen, rotview, swapworkspaces, windowbringer, and windownavigation; urgencyhook.<br />
<br />
; [[/Wfarr's xmonad.hs]] (0.6)<br />
: ResizableTall Layout using EZConfig, cycleWS, CopyWindows, and DZen to get some cool stuff happening.<br />
[[Image:Wfarrscreen1.png|center|200px]]<br />
<br />
;[[/Xilon's xmonad.hs]] (0.5)<br />
:Simple and clean setup with dzen and a tray. Dzen with workspaces uses UrgencyHook for Urgent windows.<br />
[[Image:xilon-config.png|center|200px]]<br />
<br />
==Note on uploading==<br />
[http://haskell.org/haskellwiki/HaskellWiki:New_accounts Request a haskell wiki account] if needed.<br />
<br />
To upload your config file, create some text on this page of the form:<br />
<br />
<nowiki>; [[/you xmonad.hs]](0.9)</nowiki><br />
<nowiki>: description of your setup</nowiki><br />
<br />
and save the page. ''Note that the configs are in alphabetical order and specify what xmonad version is required.'' (It's helpful to also include the version info somewhere in your comments.) This will create a new page under /you into which you<br />
can paste your xmonad.hs text.<br />
<br />
Wrap the haskell in <nowiki><haskell></nowiki> and <nowiki></haskell></nowiki> tags (the tags should go on their own lines), to enable nice markup; add a nice category like <nowiki>[[Category:XMonad configuration]]</nowiki>, and upload.<br />
<br />
Images can be uploaded by clicking on the 'Upload file' link, and then<br />
referring to the uploaded image as, e.g.<br />
<br />
<nowiki>[[Image:you-config.png|center|200px]]</nowiki><br />
<br />
which will scale the image correctly for a thumbnail.<br />
<br />
===Modular configs===<br />
Now that xmonad supports importing local module definitions into xmonad.hs from <code>~/.xmonad/lib/Path/To/Foo.hs</code> with <hask>import Path.To.Foo</hask>, the download script below limits the usability of your uploaded config. Till it's made smarter, if you want your modular config to be easily downloadable, convert it into a single chunk of valid haskell between the first pair of <nowiki><haskell> and </haskell></nowiki> tags (each tag on its own line) i.e. comment the "module Foo where"s and their imports, merging them into a single import list, (qualifying as necessary).<br />
<br />
If this is too painful, please consider other solutions, such as including commented links to downloadable lib module files or a browseable vcs, or help revise the downloader script to be smart enough to deal with a sensible method of posting such configs here.<br />
<br />
A converter script might be useful as well.<br />
<br />
==Downloading all configs==<br />
<br />
Sometimes one wants to download all the xmonad.hs files linked from this page. Perhaps one simply wants to look at many versions, or perhaps one is interested in commonalities. Regardless, here's a small script (written by [http://www.haskell.org/pipermail/xmonad/2009-January/007106.html gwern] and modified by sereven) which uses [[Tagsoup]] to download the files into the current directory:<br />
<br />
<!-- can't use syntax highlighting because we're parsing for it in the script, which confuses MW --><br />
<pre><br />
import Control.Monad (liftM,liftM2, zipWithM_)<br />
import Data.List (isInfixOf, isPrefixOf)<br />
import Network.HTTP(getResponseBody, simpleHTTP, getRequest)<br />
import Text.HTML.TagSoup (parseTags, Tag(TagOpen))<br />
<br />
main :: IO ()<br />
main = do urls <- liftM extractURLs $ openURL "http://www.haskell.org/haskellwiki/Xmonad/Config_archive"<br />
-- urls are prefixed "/haskellwiki/", so in raws, drop 13:<br />
let raws = map (\x -> "http://www.haskell.org/haskellwiki/index.php?title=" ++ drop 13 x ++ "&action=raw") $ filter (isInfixOf "xmonad.hs") urls<br />
let hs = map (liftM2 fmap filterHaskell openURL) raws<br />
zipWithM_ (\x y -> writeFile x =<< y) (map ((++ ".hs") . show) [(1::Int)..]) hs<br />
<br />
filterHaskell :: String -> String -> String<br />
filterHaskell url = addLink . unlines . takeWhile (not . isPrefixOf "</haskell>") . drop 1 . dropWhile (not . isPrefixOf "<haskell>") . lines<br />
where addLink = (("-- " ++ (reverse . drop 11 . reverse) url ++ "\n") ++) -- add commented url less "&action=raw"<br />
<br />
<br />
openURL :: String -> IO String<br />
openURL u = getResponseBody =<< simpleHTTP (getRequest u)<br />
<br />
extractURLs :: String -> [String]<br />
extractURLs arg = [x | TagOpen "a" atts <- (parseTags arg), (_,x) <- atts, "/haskellwiki/Xmonad/Config_archive/" `isPrefixOf` x]<br />
</pre><br />
<br />
Make sure you have the tagsoup package installed from hackage or your package manager, then paste the script into a file, e.g. <tt>get-xmconfigs.hs</tt>, then, to download the configs into the current directory:<br />
% runhaskell get-xmconfigs<br />
<br />
Note that this script will ''only'' work on those configs which strictly followed the above uploading guidelines, since the script makes a number of simplifying assumptions. (Specifically: title includes the string "xmonad.hs", it was uploaded to a subpage of this page, the <tt><nowiki><haskell></nowiki></tt> tags are on their own lines, and the first pair encloses the xmonad.hs. See gwern's<br />
[http://www.haskell.org/pipermail/xmonad/2009-January/007106.html original email] for more details.)<br />
<br />
==Module Import Popularity==<br />
Here is a script to summarize the imports in a given directory of .hs files, such as the ones downloaded by the script in the previous section.<br />
<br />
<haskell><br />
#!/usr/bin/runghc<br />
<br />
import System.Directory(getDirectoryContents)<br />
import System.FilePath(splitExtension)<br />
import Control.Applicative((<$>))<br />
import Control.Monad(mapM)<br />
import Data.Char(isNumber, isSpace)<br />
import Data.List(foldl', sortBy, stripPrefix)<br />
import Data.Maybe(mapMaybe)<br />
import Data.Monoid(mconcat)<br />
import Data.Ord(comparing)<br />
<br />
import qualified Data.Map as M<br />
<br />
main = do<br />
fs <- filter ((\(fn,ext) -> ext == ".hs" && all isNumber fn) . splitExtension)<br />
<$> getDirectoryContents "."<br />
let getModName :: String -> [String]<br />
getModName = map (takeWhile (\x -> not $ isSpace x || x == '('))<br />
. mapMaybe (mconcat $ map stripPrefix ["import qualified ","import "])<br />
. lines<br />
xs <- mapM (fmap getModName . readFile) fs<br />
noborders on keypress for client. custom keybindings. magnifier.<br />
[[Image:entropie-config.png|center|200px]]<br />
<br />
;[[/Eric Mertens' xmonad.hs]] (0.5)<br />
:[[/Eric Mertens's Config.hs]] (0.4)<br />
:Customized DynamicLog, ShellPrompt, TilePrime, Dual-head and an effort to make the statusbar similar to DWM.<br />
[[Image:glguy-config.jpg|center|400px]]<br />
<br />
;[[/Erthad's xmonad.hs]] (darcs 25 Aug 2008/0.7)<br />
: mixed hotkeys config (standard+EZConfig), wmii-like keyboard behavior,<br />
: EWMH desktops, dzen integration (dzen configs see at http://fly.osdn.org.ua/~erthad/)<br />
<br />
;[[/Gwern's Config.hs (0.4)]] (old)<br />
<br />
[[/iderrick xmonad.hs]] (0.8)<br />
: Maximize, Dynamiclog with xmobar, Custom layout (with Combo) for latex writing (xpdf + editor + little terminal), French keyboard, Windows key for shortcuts<br />
<br />
[[Image:iderrick.png|center|200px]]<br />
;[[/lazor's xmonad.hs]] (0.8)<br />
: working xmonad.hs for KDE 4.2<br />
[[Image:screenshot-xmonad-lazor.jpg|center|200px]]<br />
<br />
; [[/Lee Aylward's xmonad.hs]] (0.5)<br />
: Resizable Tall, NoBorders, dzen DynamicLog, rhythmbox control shortcuts, windows key<br />
[[Image:leeaylward.png|center|400px]]<br />
<br />
; [[/Mr.Elendig's xmonad.hs]] (0.7)<br />
; Somewhat simple, but verbose config, with ResizableTall, xmobar and mpd controlls.<br />
[[Image:mre-ss1.png|center|200px]]<br />
<br />
;[[/nomeatas Config.hs]] (0.4)<br />
:modMask = mod4Mask; gnome-stuff<br />
<br />
;[[/nomeata’s xmonad.hs]] (xmonad 0.7)<br />
: CycleWS to avoid changing visible workspaces on other screens, EWMH, UpdatePointer, avoidStruts, IM for piding (on the right side), fullscreen via toggleLayouts, no boarders,<br />
<br />
;[[/Ray's xmonad.hs]] (0.5)<br />
:DynamicLog, custom manageHook, changed from default terminal, border colors, prompts, and layouts. Pseudo-Haskell dzen statusbar with Greek letters for workspace names.<br />
[[Image:Ray-config.png|center|200px]]<br />
<br />
;[[/Robert Manea's Config.hs and support scripts]] (0.4)<br />
0.4 screenshot: [[Image:rob-config.png|center|400px]]<br />
<br />
;[[/Robert Manea's xmonad.hs]] (0.8)<br />
:Customized DynamicLog and ShellPrompt, ManageDock, some efforts to make the colors of all components go together well<br />
0.5 screenshot: [[Image:Xmonad_shellprompt_newconf.png|center|400px]]<br />
<br />
; [[/Remi's xmonad.hs]] (0.7)<br />
; [[/Remi's .xmobarrc]] (0.8)<br />
; [[/Remi's .xinitrc]]<br />
: Lots of key bindings for destkop-navigation/moving, xmonad.hs-editing, music, next-N-windows-float-hack. xmobar integration and PerWorkspace Layouts. And a yet-to-be-published libmpd xmobar plugin.<br />
[[Image:Remi-xmonad-screenshot.png|center|200px]]<br />
<br />
; [[/rtalreja's xmonad.hs]] (0.8.1)<br />
; [[/rtalreja's .conkyrcdzen]]<br />
:dynamicLogWithPP with dzen, conky piped into dzen, urgency hints, compositing, shortcuts for mpd controls.<br />
[[Image:rtalreja-screenshot.png|center|200px]]<br />
<br />
; [[/skorpan's xmonad.hs]] (0.8)<br />
; [[/skorpan's xmobarrc]] (0.9)<br />
: Red/gray borders + NoBorders, EZConfig, xmobar 0.9 with workspaces, layout, title, battery, CPU usage, memory usage, date and time.<br />
[[Image:2009-01-25-183906 1280x800 scrot.png|center|200px]]<br />
<br />
; [[/sphynx's xmonad.hs]] (0.7)<br />
: Emacs-style keybindings, xmobar integration, XFT-fonts, ManageDocks, Tabbed layout, IM layout for Pidgin and Skype configured through PerWorkspace, Search extension for Wikipedia, translation and Google, usage of CopyWindow to 'make window always visible', Urgency hook, PerWorkspace usage, Scratchpad terminal, custom styles for prompt and borders.<br />
<br />
;[[/twifkak's Config.hs]] (0.4)<br />
;[[/twifkak's xmonad.hs]] (0.8)<br />
:modMask = mod4Mask; noBorders tabbed layout; keybindings for dzen, rotview, swapworkspaces, windowbringer, and windownavigation; urgencyhook.<br />
<br />
; [[/Wfarr's xmonad.hs]] (0.6)<br />
: ResizableTall Layout using EZConfig, cycleWS, CopyWindows, and DZen to get some cool stuff happening.<br />
[[Image:Wfarrscreen1.png|center|200px]]<br />
<br />
;[[/Xilon's xmonad.hs]] (0.5)<br />
:Simple and clean setup with dzen and a tray. Dzen with workspaces uses UrgencyHook for Urgent windows.<br />
[[Image:xilon-config.png|center|200px]]<br />
<br />
==Note on uploading==<br />
[http://haskell.org/haskellwiki/HaskellWiki:New_accounts Request a haskell wiki account] if needed.<br />
<br />
To upload your config file, create some text on this page of the form:<br />
<br />
putStr . unlines . map show . sortBy (comparing snd) . M.toList<br />
. foldl' (\m k -> M.insertWith (+) k 1 m) M.empty<br />
. concat $ xs<br />
</haskell><br />
<br />
Part of the output showing the most popular modules in the config archive is:<br />
<br />
<haskell><br />
("XMonad.Layout.NoBorders",40)<br />
("XMonad.Hooks.DynamicLog",43)<br />
("XMonad.Util.Run",44)<br />
("XMonad.Hooks.ManageDocks",45)<br />
("Data.Map",53)<br />
("XMonad.StackSet",53)<br />
("XMonad",63)<br />
</haskell><br />
<br />
[[Category:XMonad configuration]]</div>Kapilhttps://wiki.haskell.org/index.php?title=Xmonad/Config_archive/Kapil%27s_networkmanagerprompt.hs&diff=53029Xmonad/Config archive/Kapil's networkmanagerprompt.hs2012-09-14T13:20:37Z<p>Kapil: add script for network manager connection prompts</p>
<hr />
<div>A snippet to use "nmcli" to bring up and take down connections via a<br />
XPrompt interaction.<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Config<br />
import XMonad.Prompt<br />
import XMonad.Prompt.Input (inputPromptWithCompl, (?+))<br />
import XMonad.Util.Run (runProcessWithInput)<br />
<br />
import Data.Bits ((.|.))<br />
import qualified Data.Map as M<br />
<br />
main = xmonad $ defaultConfig {<br />
keys = addlKeys <+> keys defaultConfig<br />
}<br />
<br />
-- networking with network Manager<br />
<br />
addlKeys conf@(XConfig {modMask = modm}) = M.fromList $<br />
[ ((modm , xK_F3), nmPrompt "up")<br />
, ((modm .|. controlMask, xK_F3), nmPrompt "down") ]<br />
<br />
-- A set up to use XPrompt to find out which connections need to go up and down<br />
<br />
-- get the list of connections using nmcli<br />
getNmConnections :: X [String]<br />
getNmConnections = fmap lines $ runProcessWithInput "nmcli" [ "-t", "-f", "NAME", "con", "list" ] []<br />
<br />
-- a utility to run an nmcli command<br />
<br />
nmConAction a = spawn . ((++) "nmcli con ") . ((++) a)<br />
<br />
-- Prompt for nm up or down action<br />
<br />
nmPrompt :: String -> X ()<br />
nmPrompt a = do <br />
conns <- getNmConnections<br />
inputPromptWithCompl defaultXPConfig ("Connection to " ++ a)<br />
(mkComplFunFromList conns) ?+ (nmConAction (" " ++ a ++ " id "))<br />
</haskell></div>Kapilhttps://wiki.haskell.org/index.php?title=Xmonad/Config_archive/Kapil_gnomemenuadd.hs&diff=50192Xmonad/Config archive/Kapil gnomemenuadd.hs2012-08-26T04:41:56Z<p>Kapil: Add note about delay</p>
<hr />
<div>This gives a hacky solution to<br />
[https://code.google.com/p/xmonad/issues/detail?id=451 Issue 451 in xmonad]<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Config.Gnome<br />
import XMonad.Config.Desktop<br />
<br />
import Control.Concurrent (threadDelay)<br />
import qualified Data.Map as M<br />
<br />
main = xmonad $ gnomeConfig {<br />
,keys = addlKeys <+> keys desktopConfig<br />
}<br />
<br />
addlKeys conf@(XConfig {modMask = modm}) = M.fromList $<br />
[ ((modm, xK_F1), gnomeMenu) ]<br />
<br />
gnomeMenu :: X ()<br />
gnomeMenu = withDisplay $ \dpy -> do<br />
rw <- asks theRoot<br />
gnome_panel <- getAtom "_GNOME_PANEL_ACTION"<br />
panel_menu <- getAtom "_GNOME_PANEL_ACTION_MAIN_MENU"<br />
<br />
-- a "magic" delay that just makes this work. The problem<br />
-- is specified at<br />
-- https://code.google.com/p/xmonad/issue/detail?id=451<br />
-- Increase the delay if it doesn't work for you.<br />
io $ threadDelay 200000<br />
<br />
io $ allocaXEvent $ \e -> do<br />
setEventType e clientMessage<br />
setClientMessageEvent e rw gnome_panel 32 panel_menu 0<br />
sendEvent dpy rw False structureNotifyMask e<br />
sync dpy False<br />
</haskell></div>Kapilhttps://wiki.haskell.org/index.php?title=Xmonad/Config_archive&diff=50189Xmonad/Config archive2012-08-26T03:18:32Z<p>Kapil: /* Configs for the current XMonad release (0.9.*) */ Gnome Menu popup</p>
<hr />
<div>{{xmonad}}<br />
<br />
__TOC__<br />
<br />
==Quick Introductions to Haskell==<br />
For a brief overview of haskell syntax, see [http://cs.anu.edu.au/student/comp1100.2007.s2/haskell/tourofsyntax.html Tour of the Haskell Syntax]. For style suggestions and explanations of how to use layout aka whitespace, see [http://urchin.earth.li/~ian/style/haskell.html Ian's Guide to Good Haskell Style] and this wikibook regarding [http://en.wikibooks.org/wiki/Haskell/Indentation indentation and whitespace]. For more in-depth treatments of Haskell syntax and learning how to program in Haskell, see the sidebar <code>Learning</code> links on [http://haskell.org haskell.org].<br />
<br />
==XMonad Configuration Examples==<br />
For more screenshots see the [[Xmonad/Screenshots]] archive.<br />
<br />
'''''EwmhDesktops users upgrading to xmonad-0.9.*''''' '', please note layoutHook, handleEventHook, startupHook change.'' For more information about how to update your Ewmh configuration, and other changes that may require edits to <hask>xmonad.hs</hask>, see the [http://www.haskell.org/haskellwiki/Xmonad/Notable_changes_since_0.8 0.9 release changelog].<br />
<br />
=== Template xmonad config files ===<br />
;[[/Template xmonad.hs (0.9)]] -- (Or for darcs<nowiki>:</nowiki> [[/Template xmonad.hs (darcs)]])<br />
<br />
The template xmonad.hs file shows all the default xmonad settings; it is merely a slightly modified reference copy of the XMonad source module which sets up the configuration. Note that while this file is usable, it contains lots of uneeded extra settings; normally you would only include and customize the parts you want to change. If you don't want to use the minimal style as shown in the following tutorial, you can copy-and-paste from the template instead.<br />
<br />
For a plain text version of the template see the <code>man/xmonad.hs</code> file distributed with xmonad source, or you can<br />
[http://code.haskell.org/xmonad/man/xmonad.hs download the latest darcs template xmonad.hs] from<br />
code.haskell.org.<br />
<br />
=== Minimal xmonad config files ===<br />
The Arch Linux introduction to [https://wiki.archlinux.org/index.php/Xmonad configuring XMonad] is a good place to start.<br />
<br />
Also see the [[/John_Goerzen%27s_Configuration|John Goerzen tutorial]] for an example of customizing a minimal xmonad.hs like the following:<br />
<br />
<haskell><br />
import XMonad<br />
<br />
main = xmonad defaultConfig<br />
{ modMask = mod4Mask -- Use Super instead of Alt<br />
, terminal = "urxvt"<br />
-- more changes<br />
}<br />
</haskell><br />
<br />
=== Configs requiring the darcs (development) version of XMonad ===<br />
; [[/adamvo's xmonad.hs]] (darcs)<br />
: XMobars for multiple screens (xmobar>0.9.2), mediaKeys, SubLayouts, TopicSpace, support for replacing and temporarily running other window managers, extensive gridselect usage.<br />
[[Image:adamvo-single-screen.png|center|200px]] [[Image:adamvo-gridselect.png|center|200px]]<br />
<br />
;[[/And1's xmonad.hs]] (darcs)<br />
:mirrored layout, manageHook, dynamicLog with dzen, conky piped into dzen,<br />
:urgency hints, perWorkspace layouts, gimpLayout, PP for dzen and xmobar,<br />
:custom keys with application shortcuts and mpd controls, gridSelect;<br />
:more of my screenshots can be found in my [http://and1.donnergurgler.net/screenshots/ screenshots/] directory<br />
[[Image:and1_xmonad.png|center|200px]]<br />
<br />
;[[/Brent Yorgey's darcs xmonad.hs]] (darcs)<br />
:Tons of cruft accumulated over many years of using xmonad; probably everyone can find something in here that interests them! Features annotations showing which contrib modules are being used where, to make it easier to figure out how to use a given contrib module, or how to pull out little pieces of functionality for use in your own config.<br />
[[Image:byorgey-config.png|center|200px]]<br />
<br />
;;[[/hgabreu's xmonad.hs]] (darcs)<br />
: One screen, SubLayouts, FadeInactive (with custom toggle fade), case insensitive shell prompt, heavy manageHook and keybindings customization.<br />
<br />
;[[/loupgaroublonds xmonad.hs]] (darcs)<br />
: Gnome and kde compatible config with topicspaces and dynamic workspaces set up for context oriented workspaces. Uses xmonad-extras package for mpd.<br />
[[Image:loupgaroublond-config.png|center|200px]]<br />
<br />
;[[/Marcot's xmonad.hs]] (darcs)<br />
; With Gnome support and Multimedia Keyboard configuration<br />
[[Image:Captura_da_tela.png|center|200px|Marcot]]<br />
<br />
;[[/Nnoell's xmonad.hs]] (0.10)<br />
:Xmonad stand-alone setup with dzen clickable workspaces, conky piped into dzen, toggle tabbed layout, scratchpad and some other cool things. Additional configs on [https://dl.dropbox.com/u/43104750/nnoell_configs_v1.tar.xz here].<br />
[[Image:NNoeLLs Desktop 3.png|center|200px]]<br />
<br />
;[[/Regalia's xmonad.hs]] (darcs)<br />
:Moderately customized. Some useful bits acquired over some time.<br />
[[Image:Regalia xmonad2.png|center|400px]]<br />
<br />
;[[/Thayer Williams' xmonad.hs]] (0.9)<br />
:A simple, mouse-friendly xmonad config geared towards netbooks and other low-resolution devices. Dzen is used for statusbar rendering, with optional mouse integration provided by xdotool.<br />
[[Image:Thayer-xmonad-20110511.png|center|200px]]<br />
<br />
;[[/TTimo xmonad.hs]](0.10)<br />
:Basic config with xmobar, hopefully a good starting point for more complex setups<br />
<br />
=== Configs for the current XMonad release (0.9.*)===<br />
Many of these will also work with the darcs version of XMonad.<br />
<br />
;[http://www.linuxandlife.com/2011/11/how-to-configure-xmonad-arch-linux.html /Linux and Life's tutorial]<br />
:A tutorial to install and configure xmonad-0.9.2 with xmobar and trayer in Arch Linux. It also shows how to use the french keyboard layout and laptop function keys in xmonad.<br />
[[Image:My-Xmonad-desktop.png|center|300px]]<br />
<br />
[[Image:Xmonad-desktop-busy.png|center|300px]]<br />
<br />
;[[/31d1's xmonad.hs]] (0.9/gnome)<br />
<br />
;[[/Andrea Rossato's xmonad.hs]] (0.8 +)<br />
:Tabbed, Xmobar with DynamicLog, (Shell|Ssh|Man)Prompt.<br />
[[Image:Arossato-config.png|center|200px]]<br />
<br />
; [[/Andrea Spada xmonad.hs]] (0.8 +)<br />
: Tall, Resizable Mosaic and Combo, EvmhDesktops, additional keybindings - Work In Progress...<br />
<br />
; [[/andrewsw's xmonad.hs]] (0.8 +)<br />
; [[/andrewsw's .Xdefault]]<br />
: These screenshots show some compositing and nice transparent urxvt's with a circle layout and a magnified grid layout.<br />
<gallery>Image:Xmonad-circle-comp.jpg<br />
Image:Xmonad-mag-grid.jpg</gallery><br />
<br />
; [[/avendael's xmonad.hs]] (0.9)<br />
; [[/avendael's .conky_bar]]<br />
:A very simple xmonad configuration that has conky piped into dzen with icons.<br />
:Workspace names are also changed into icons just for fun ;)<br />
[[Image:avendael_xmonad.png|center|200px]]<br />
<br />
; [[/brad's xmonad.hs]] (0.8 +)<br />
: very basic, just some cosmetic and key-shortcut changes<br />
[[Image:brad.png|center|200px]]<br />
<br />
; [[/David Beckingsale's xmonad.hs]] (0.9)<br />
: Xmonad config using the zenburn colour scheme. Uses custom keybindings for frequent tasks. Status bar is conky powered dzen2<br />
<br />
;[[/David Roundy's xmonad.hs]] (0.8 +)<br />
:Combo config for small screen + xclock. This config also keeps mod=mod1, and therefore moves a number of key bindings to non-standard locations (my laptop has no spare modifier keys).<br />
[[Image:droundy-config.png|center|200px]]<br />
<br />
;[[/dmwit's xmonad.hs]] (0.9 + darcs from about March 2010. Works with 0.9)<br />
;[[/dmwit's .xmobarrc]]<br />
:A somewhat screen-count-agnostic config, as I use this same file on :machines with several different physical setups. Auxiliary apps: :trayer, xmobar, dzen, yeganesh; layouts: fullscreen and Grid, with<br />
:independent workspaces on each screen. Uses some unapplied patches to<br />
:xmobar.<br />
[[Image:dmwit-config.png|center|200px]]<br />
<br />
;[[/doitan's xmonad.hs]] (0.8 +)<br />
:libnotify UrgencyHook, many features from tips and tricks page integrated, many custom prompts including workspace and layout switching. [http://snipt.net/doitian dotfiles]<br />
<br />
;[[/Don's xmonad.hs]] (0.9)<br />
:colours, use custom terminal, dynamicLogDzen<br />
[[Image:Xmonad-screen-dons-code.png|center|200px]]<br />
<br />
;[[/enko's xmonad.hs]] (0.8 +)<br />
: I'm using xmobar and mostly tall layout (but in really it is just fullscreenlayout since there aren't any other windows). The config is accumulated stuff and could be cleaned of cruft, but since I don't know ATM what is cruft and what not, it is not an option, but it works for me™. I'm using urxvt as a terminal and the mailer you can see there is [http://www.gohome.org/wl/ wanderlust] for emacs. You can also see my [http://github.com/enko/dotfiles/tree/master screen setup] at the bottom.<br />
[[Image:2008-10-20-205748 1680x1050 scrot.png|center|200px]]<br />
<br />
; [[/eschulte xmonad.hs]] (0.9)<br />
: Basic config for running overtop of the XFCE (in this case Xubuntu) desktop, with the XFCE panel shown.<br />
[[Image:eschulte.png|center|200px]]<br />
<br />
;[[/Gwern's xmonad.hs]] (0.10)<br />
:Ratpoison-y keybindings; example usage of XSelection with searches.<br />
<br />
; [[/Herzen's xmonad.hs]] (0.9)<br />
: Integrates with the Gnome Panel. This config uses the Gnome Panel both<br />
: to display xmonad's status (using the Gnome Workspace Switcher applet,<br />
: based on John Yates' config) and to display the current window's title<br />
: (using awick's xmonad log applet and DBus module from hackage).<br />
<br />
;[[/ivy-foster-xmonad.hs|/Ivy Foster's xmonad.hs]] (0.9.2)<br />
: One screen; xmobar; customized ManageHooks; NamedScratchPads<br />
[[Image:ivy-foster-xmonad-screenshot.png|center|200px]]<br />
<br />
;[[/jelly(12gen)'s xmonad.hs]] (0.9)<br />
;[[/jelly(12gen)'s xmobarrc]]<br />
; Standard setup using ShellPrompt, Actions.Search, xmobar, urgencyhook, custsom keybindings and scratchpad. <br />
[[Image:Screenshot 090711.png|center|200px]]<br />
<br />
;[[/John Goerzen's Configuration|/John Goerzen's Configuration and Tutorial]] (0.8)<br />
: A step-by-step guide to customizing Xmonad, starting from where the tutorial leaves off, getting to a configuration with xmobar and simple but intentionally minimal customizations in xmonad.hs<br />
[[Image:john-goerzen-xmonad-screenshot.png|center|200px]]<br />
<br />
;[[john-yates-xmonad.hs|/John Yates' polished Gnome bar]] (0.8 +)<br />
: This is an attempt to provide an easy path into the world of tiling window managers for colleagues using recent Ubuntu and RedHat distributions. Emphasis is on visual integration with familar UI elements while conforming to widespread tiling WM idioms: (1) a single bar, (2) no window decoration, (3) current window's title display in the bar. Starting from a vanilla Ubuntu Gnome setup I eliminated the lower Gnome panel and its applets. On the remaining upper panel I included left to right: (1) a standard Gnome separator applet, (2) the Gnome Window Selector applet, (3) dzen2 built with Xft support displaying the current window's title, (4) the Gnome Workspace Switcher applet:<br />
[[Image:john-yates-gnome-bar.png|center|600px]]<br />
: The Window Selector icon tracks the displayed window title. Clicking on that icon activates the selector, displaying window titles grouped by workspace:<br />
[[Image:john-yates-gnome-window-selector.png|center|600px]]<br />
: Mod-p preserves Xmonad's default dmenu binding. Keeping with the emphasis on font consistency I created a version of dmenu that supports Xft fonts and a bar height option (currently available as a [[dmenu-4.0-xft.diff|patch]] against dmenu 4.0):<br />
[[Image:john-yates-gnome-dmenu.png|center|600px]]<br />
: At present my [[john-yates-xmonad.hs|xmonad.hs]] is utterly sparse, attempting only to simplify the process of accommodating additional themes.<br />
<br />
; [[/Josh Rickmar's xmonad.hs]] (0.8 +)<br />
; [[/Josh Rickmar's dzenscript]]<br />
: This config uses keybindings optimized for the [http://colemak.com Colemak keyboard layout], alternate swapUp/Down methods which won't cycle windows if moving the last to first or vice-versa, a nice dzen2 status bar, and dwm-like tagging with CopyWindow. Workspaces which contain copies of windows are displayed with a different XPM in dzen (dwm-style). Xinerama keybindings are also removed, simply because I don't use them.<br />
[[Image:Jrick-xmonad.png|center|200px]]<br />
<br />
; [[/Kapil's gnomemenuadd.hs]] (0.10)<br />
:<br />
:A hack to make the Gnome Menu popup just like the Gnome Run dialog<br />
:pops up. This is a minimal addition to XMonad.Config.Gnome so that<br />
:"dmenu" type programs are not _required_. This tries to solve<br />
:[https://code.google.com/p/xmonad/issues/detail?id=451 Issue 451 in Xmonad].<br />
<br />
; [[/k6b (kyle's) xmonad.hs]] (0.9.2)<br />
; [[/k6b (kyle's) xmobarrc]] (0.11.1)<br />
:<br />
: Two xmobar's, startup script, dmenu, some custom keybindings, work in progress!<br />
: Dirty<br />
[[Image:k6b-xmonad.png|center|200px]]<br />
: Clean<br />
[[Image:k6b-xmonad-clean.png|center|200px]]<br />
<br />
;[[/lars' xmonad.hs]] (0.8 +)<br />
:Move/Resize windows using keyboard easily:<br />
:1. move window around using M-Arrows.<br />
:2. resize windows using C-Arrows.<br />
:3. Holding <Shift> to move/resize 2 pixels per step instead of 20 pixels.<br />
:Please find the lines below comment "-- moving floating window with key" to see details.<br />
<br />
;[http://blog.gravityfour.com/2012/01/easyxmotion-switch-between-any-window.html Loki's config using easyxmotion (0.10) ]<br />
This config uses [https://github.com/loki42/easyxmotion easyxmotion] to switch between any window in 2 keypresses. Inspired by the easy motion vim plugin. The [https://github.com/loki42/dotfiles/blob/master/_xmonad/xmonad.hs xmonad.hs] is very simple and also uses WindowGo and ewmh desktops. The letters appear when I click the menu key, next to right alt. Then type the letter to focus that window.<br />
[[Image:Easyxmotion.png|center|400px]]<br />
<br />
; [[/Mntnoe's xmonad.hs]] (0.9)<br />
: Heavily modified modular xmonad config. (I.e. use ~/.xmonad/lib/* .) Highlights: Pager with icons. Per application configuration. Minimize windows.<br />
[[Image:Mntnoe-xmonad-2010-04-25.png|center|200px]]<br />
<br />
;[[/lithis's xmonad.hs]] (0.9)<br />
;[[/lithis's xmobarrc]] (newer than xmobar-0.9)<br />
:The screenshot shows xmobar, two screens, a spiral layout, a tabbed layout, XFT fonts, and ShellPrompt with tab completion. The config also has pointer follows focus.<br />
[[Image:lithis-xmonad.png|center|200px]]<br />
<br />
;[[/lorincs xmonad.hs]] (0.9)<br />
: Config for using xcompmgr with kde4. [http://blog.cpst.hu/tiki-read_article.php?articleId=21 See blog for more details].<br />
<br />
;[[/nattfodd's xmonad.hs]] (0.8 +)<br />
:DynamicLog, smartBorders, French keyboard, defaultGap, urgencyHook in workspace toolbar and some prompts.<br />
[[Image:Nattfodd-xmonad-0.7.png|center|200px]]<br />
<br />
;[[/Octoploid's xmonad.hs]] (0.9)<br />
:Xmobar with customized DynamicLog, CycleWS with custom keys, colors, terminal, golden ratio<br />
[[Image:Octoploid_conf.png|center|200px]]<br />
<br />
;[[/oxymor00n's xmonad.hs]] (darcs ?)<br />
:[[/oxymor00n's xmobarrc]]<br />
:Tabbed layout, Floating Layout, xmobar, EZConfig for Emacs-like keybinding-definition, added some bindings for the mouse wheel (cycle focus and cycle workspaces), cycleWS-stuff that might be interesting for Xinerama-users,...<br />
[[Image:oxymor00n-xmonad.png|center|200px]]<br />
<br />
;[[/Robert Massaioli's xmonad.hs]]<br />
:This XMonad is based on Thomas ten Cate's xmonad.hs and it is designed for Dvorak. For more information please see my blog post: [http://massaioli.homelinux.com/wordpress/2010/04/15/extending-xmonad-for-dvorak/]<br />
[[Image:RobertMassaiolisXmonadDesktop.png|center|400px]]<br />
<br />
; [[/sereven xmonad.hs]] (0.9.2 - 0.10)<br />
: Reduced to minimum that sees daily use. Arrow + vi window navigation. Lots of left hand only keys, for full function with both hands on keyboard, or with one on mouse. While no longer use them old dzen grid icons are [http://code.haskell.org/~wwolff/_xmonad/icons/grid_icons.tar.bz2 here]. Latest xmonad.hs [http://github.com/wwolff/configs here].<br />
[[Image:2011.03-srvn 2560x960.png|center|400px]]<br />
<br />
; [[/sykopomp's xmonad.hs]] (0.9)<br />
; [[/sykopomp's xmonad.dv-vi.hs]]<br />
; This screenshot shows xfce-panel with pager + xmonad in a ResizableTall layout. Also using compositing and transparent urxvt's (thanks andrewsw) with bindings for changing transparency on focused window. Keybindings have been completely redone to be more similar to emacs-bindings (M-p and M-n for previous and next windows). The other config is an older config that uses the standard vi-like bindings, but translated by location to a dvorak layout.<br />
[[Image:xmonad-screen-xinerama-composite-xfce.jpg|center|200px]]<br />
<br />
; [[/TeXitoi's xmonad.hs]] (0.8 and 0.9)<br />
: bepo typematrix keyboard, desktopConfig, fadeInactive. Minimal configuration file with defaults not overwritten. Mist GTK theme, xcompmgr and Xfce4-panel are used.<br />
<br />
[[Image:Xmonad-xfce-panel.png|center|200px|TeXitoi]]<br />
<br />
; [[/Thomas ten Cate's xmonad.hs]] (0.8 +)<br />
: Designed for Ubuntu (Gnome), the Windows key, and a dvorak keyboard. Workspaces accessible through Alt+F1..F10 so they don't interfere with Alt+1..9 used by irssi/Firefox/etc.<br />
: Instant messaging (Skype and Pidgin) buddy lists are automatically placed on the side of the IM workspace, with chat windows being placed in the rest of this area. This uses some code modified from [http://hackage.haskell.org/packages/archive/xmonad-contrib/0.8/doc/html/XMonad-Layout-IM.html XMonad.Layout.IM].<br />
: Extensive comments at the top of the file explain the keybindings and usage.<br />
<br />
; [[/thoughtpolice's xmonad.hs]] (0.9)<br />
; [[/thoughtpolice's xmobarrc]] (0.9)<br />
; Emacs-esque keyboard bindings via EZConfig, dynamicLog with dzen, Submap google/hoogle/amazon/imdb/youtube/wikipedia searching, Shell & Ssh modules, slightly custom XPConfig and avoidStruts (ManageDocks.)<br />
<br />
;[https://github.com/vicfryzel/xmonad-config Vic Fryzel's xmonad configuration] (0.9)<br />
: Multiple named workspaces and layouts. Comes with themed colors, xmobar configuration, scripts for things like dmenu and screenshots, standard and custom key bindings, etc. Check out the [https://github.com/vicfryzel/xmonad-config/raw/master/screenshot.png screenshot].<br />
<br />
;[[/void's xmonad.hs]] (0.8 +)<br />
: dzen2 DynamicLog (in robert's style) and UrgencyHook, LayoutCombinators, IM workspace for Pidgin (on the right) with 2 layouts a dwmStyle decorated ResizableTall and a tabbed one, use of PerWorkspace and Named layouts, Scratchpad, custom theme, EZConfig for keybindings, NoBorders (and smarts too)<br />
<br />
;[[/vvv's xmonad.hs]] (0.9)<br />
:EZConfig, CycleWS, {Man,Shell,Ssh}Prompt, Submap, DynamicWorkspaces, NoBorders, and ion-like status bar (written in nonkosher Perl).<br />
[[Image:vvv-config.png|center|200px]]<br />
<br />
;[[/webframp's xmonad.hs]] (darcs)<br />
: Basic Mirror tiled and ResizableTall layout, EZConfig keybindings,<br />
: dynamicLogWithPP + dzen, CycleWS, Prompt, promptSearch, Scratchpad, updatePointer, perWorkspace, compositing.<br />
[[Image:Webframp-xmonad-ss-invaders.png|center|200px]]<br />
<br />
;[[/Wraithan's xmonad.hs]] (0.9)<br />
: Pretty standard setup using ShellPrompt, ResizableTile (with hinting), and xmobar for a little bit of the info I want.<br />
[[Image:Wraithan-Desktop-2009-12-15.png|center|200px]]<br />
<br />
==== Broken 0.9 configs ====<br />
;[[/gray_hemp's xmonad.hs]] (0.9)<br />
;[[/gray_hemp's .conky_cpu]]<br />
;[[/gray_hemp's .conky_battery]]<br />
;[[/gray_hemp's .conky_time]]<br />
;[[/gray_hemp's .xxkbrc]]<br />
:dzen plus conky config using dzen icons, resizable tall, xmonad shell prompt, urgency popup, status bar formatting, xxkb keyboard indicator.<br />
[[Image:gray_hemp.png|center|200px]]<br />
<br />
=== Old configs ===<br />
This section is for configurations which do not work with the the latest release version of xmonad.<br />
<br />
Note that the configuration file is 'Config.hs' for xmonad < 0.5, but 'xmonad.hs' for xmonad >= 0.5.<br />
<br />
Many config files marked as 0.5 probably work in 0.6 as well; give it a try and ask on the #xmonad IRC channel on freenode.org if you have problems.<br />
<br />
;[[/Template xmonad.hs (0.8)]]<br />
;[[/Template xmonad.hs (0.7)]]<br />
;[[/Template xmonad.hs (0.6)]]<br />
:Previous versions of the default configuration.<br />
<br />
;[[/andrewsw's xmonad.hs]] (0.6)<br />
<br />
;[[/arossato's Config.hs]] (0.4)<br />
<br />
;[[/Brent Yorgey's xmonad.hs]] (0.6)<br />
<br />
;[[/cce xmonad.hs]] (0.5)<br />
: alt+enter full screen, alt+hjkl to navigate, many remapped keys<br />
<br />
;[[/deifl's xmonad.hs]] (0.5)<br />
:DynamicLog, WindowBringer, CopyWindow, ResizableTile, Tabbed layout. not default terminal, changed colors and some instances of dzen.<br />
<gallery>Image:D_xmonad_clear.jpg|Clean<br />
Image:D_xmonad_full.jpg|Populated</gallery><br />
<br />
;[[/Don's Config.hs]] (0.4)<br />
<br />
;[[/entropies xmonad.hs]] (0.5)<br />
: windows as meta key, fullscreen & noborders on keypress for client. custom keybindings. magnifier.<br />
[[Image:entropie-config.png|center|200px]]<br />
<br />
;[[/Eric Mertens' xmonad.hs]] (0.5)<br />
:[[/Eric Mertens's Config.hs]] (0.4)<br />
:Customized DynamicLog, ShellPrompt, TilePrime, Dual-head and an effort to make the statusbar similar to DWM.<br />
[[Image:glguy-config.jpg|center|400px]]<br />
<br />
;[[/Erthad's xmonad.hs]] (darcs 25 Aug 2008/0.7)<br />
: mixed hotkeys config (standard+EZConfig), wmii-like keyboard behavior,<br />
: EWMH desktops, dzen integration (dzen configs see at http://fly.osdn.org.ua/~erthad/)<br />
<br />
;[[/Gwern's Config.hs (0.4)]] (old)<br />
<br />
[[/iderrick xmonad.hs]] (0.8)<br />
: Maximize, Dynamiclog with xmobar, Custom layout (with Combo) for latex writing (xpdf + editor + little terminal), French keyboard, Windows key for shortcuts<br />
<br />
[[Image:iderrick.png|center|200px]]<br />
;[[/lazor's xmonad.hs]] (0.8)<br />
: working xmonad.hs for KDE 4.2<br />
[[Image:screenshot-xmonad-lazor.jpg|center|200px]]<br />
<br />
; [[/Lee Aylward's xmonad.hs]] (0.5)<br />
: Resizable Tall, NoBorders, dzen DynamicLog, rhythmbox control shortcuts, windows key<br />
[[Image:leeaylward.png|center|400px]]<br />
<br />
; [[/Mr.Elendig's xmonad.hs]] (0.7)<br />
; Somewhat simple, but verbose config, with ResizableTall, xmobar and mpd controlls.<br />
[[Image:mre-ss1.png|center|200px]]<br />
<br />
;[[/nomeatas Config.hs]] (0.4)<br />
:modMask = mod4Mask; gnome-stuff<br />
<br />
;[[/nomeata’s xmonad.hs]] (xmonad 0.7)<br />
: CycleWS to avoid changing visible workspaces on other screens, EWMH, UpdatePointer, avoidStruts, IM for piding (on the right side), fullscreen via toggleLayouts, no boarders,<br />
<br />
;[[/Ray's xmonad.hs]] (0.5)<br />
:DynamicLog, custom manageHook, changed from default terminal, border colors, prompts, and layouts. Pseudo-Haskell dzen statusbar with Greek letters for workspace names.<br />
[[Image:Ray-config.png|center|200px]]<br />
<br />
;[[/Robert Manea's Config.hs and support scripts]] (0.4)<br />
0.4 screenshot: [[Image:rob-config.png|center|400px]]<br />
<br />
;[[/Robert Manea's xmonad.hs]] (0.8)<br />
:Customized DynamicLog and ShellPrompt, ManageDock, some efforts to make the colors of all components go together well<br />
0.5 screenshot: [[Image:Xmonad_shellprompt_newconf.png|center|400px]]<br />
<br />
; [[/Remi's xmonad.hs]] (0.7)<br />
; [[/Remi's .xmobarrc]] (0.8)<br />
; [[/Remi's .xinitrc]]<br />
: Lots of key bindings for destkop-navigation/moving, xmonad.hs-editing, music, next-N-windows-float-hack. xmobar integration and PerWorkspace Layouts. And a yet-to-be-published libmpd xmobar plugin.<br />
[[Image:Remi-xmonad-screenshot.png|center|200px]]<br />
<br />
; [[/rtalreja's xmonad.hs]] (0.8.1)<br />
; [[/rtalreja's .conkyrcdzen]]<br />
:dynamicLogWithPP with dzen, conky piped into dzen, urgency hints, compositing, shortcuts for mpd controls.<br />
[[Image:rtalreja-screenshot.png|center|200px]]<br />
<br />
; [[/skorpan's xmonad.hs]] (0.8)<br />
; [[/skorpan's xmobarrc]] (0.9)<br />
: Red/gray borders + NoBorders, EZConfig, xmobar 0.9 with workspaces, layout, title, battery, CPU usage, memory usage, date and time.<br />
[[Image:2009-01-25-183906 1280x800 scrot.png|center|200px]]<br />
<br />
; [[/sphynx's xmonad.hs]] (0.7)<br />
: Emacs-style keybindings, xmobar integration, XFT-fonts, ManageDocks, Tabbed layout, IM layout for Pidgin and Skype configured through PerWorkspace, Search extension for Wikipedia, translation and Google, usage of CopyWindow to 'make window always visible', Urgency hook, PerWorkspace usage, Scratchpad terminal, custom styles for prompt and borders.<br />
<br />
;[[/twifkak's Config.hs]] (0.4)<br />
;[[/twifkak's xmonad.hs]] (0.8)<br />
:modMask = mod4Mask; noBorders tabbed layout; keybindings for dzen, rotview, swapworkspaces, windowbringer, and windownavigation; urgencyhook.<br />
<br />
; [[/Wfarr's xmonad.hs]] (0.6)<br />
: ResizableTall Layout using EZConfig, cycleWS, CopyWindows, and DZen to get some cool stuff happening.<br />
[[Image:Wfarrscreen1.png|center|200px]]<br />
<br />
;[[/Xilon's xmonad.hs]] (0.5)<br />
:Simple and clean setup with dzen and a tray. Dzen with workspaces uses UrgencyHook for Urgent windows.<br />
[[Image:xilon-config.png|center|200px]]<br />
<br />
==Note on uploading==<br />
[http://haskell.org/haskellwiki/HaskellWiki:New_accounts Request a haskell wiki account] if needed.<br />
<br />
To upload your config file, create some text on this page of the form:<br />
<br />
<nowiki>; [[/you xmonad.hs]](0.9)</nowiki><br />
<nowiki>: description of your setup</nowiki><br />
<br />
and save the page. ''Note that the configs are in alphabetical order and specify what xmonad version is required.'' (It's helpful to also include the version info somewhere in your comments.) This will create a new page under /you into which you<br />
can paste your xmonad.hs text.<br />
<br />
Wrap the haskell in <nowiki><haskell></nowiki> and <nowiki></haskell></nowiki> tags (the tags should go on their own lines), to enable nice markup; add a nice category like <nowiki>[[Category:XMonad configuration]]</nowiki>, and upload.<br />
<br />
Images can be uploaded by clicking on the 'Upload file' link, and then<br />
referring to the uploaded image as, e.g.<br />
<br />
<nowiki>[[Image:you-config.png|center|200px]]</nowiki><br />
<br />
which will scale the image correctly for a thumbnail.<br />
<br />
===Modular configs===<br />
Now that xmonad supports importing local module definitions into xmonad.hs from <code>~/.xmonad/lib/Path/To/Foo.hs</code> with <hask>import Path.To.Foo</hask>, the download script below limits the usability of your uploaded config. Till it's made smarter, if you want your modular config to be easily downloadable, convert it into a single chunk of valid haskell between the first pair of <nowiki><haskell> and </haskell></nowiki> tags (each tag on its own line) i.e. comment the "module Foo where"s and their imports, merging them into a single import list, (qualifying as necessary).<br />
<br />
If this is too painful, please consider other solutions, such as including commented links to downloadable lib module files or a browseable vcs, or help revise the downloader script to be smart enough to deal with a sensible method of posting such configs here.<br />
<br />
A converter script might be useful as well.<br />
<br />
==Downloading all configs==<br />
<br />
Sometimes one wants to download all the xmonad.hs files linked from this page. Perhaps one simply wants to look at many versions, or perhaps one is interested in commonalities. Regardless, here's a small script (written by [http://www.haskell.org/pipermail/xmonad/2009-January/007106.html gwern] and modified by sereven) which uses [[Tagsoup]] to download the files into the current directory:<br />
<br />
<!-- can't use syntax highlighting because we're parsing for it in the script, which confuses MW --><br />
<pre><br />
import Control.Monad (liftM,liftM2, zipWithM_)<br />
import Data.List (isInfixOf, isPrefixOf)<br />
import Network.HTTP(getResponseBody, simpleHTTP, getRequest)<br />
import Text.HTML.TagSoup (parseTags, Tag(TagOpen))<br />
<br />
main :: IO ()<br />
main = do urls <- liftM extractURLs $ openURL "http://www.haskell.org/haskellwiki/Xmonad/Config_archive"<br />
-- urls are prefixed "/haskellwiki/", so in raws, drop 13:<br />
let raws = map (\x -> "http://www.haskell.org/haskellwiki/index.php?title=" ++ drop 13 x ++ "&action=raw") $ filter (isInfixOf "xmonad.hs") urls<br />
let hs = map (liftM2 fmap filterHaskell openURL) raws<br />
zipWithM_ (\x y -> writeFile x =<< y) (map ((++ ".hs") . show) [(1::Int)..]) hs<br />
<br />
filterHaskell :: String -> String -> String<br />
filterHaskell url = addLink . unlines . takeWhile (not . isPrefixOf "</haskell>") . drop 1 . dropWhile (not . isPrefixOf "<haskell>") . lines<br />
where addLink = (("-- " ++ (reverse . drop 11 . reverse) url ++ "\n") ++) -- add commented url less "&action=raw"<br />
<br />
<br />
openURL :: String -> IO String<br />
openURL u = getResponseBody =<< simpleHTTP (getRequest u)<br />
<br />
extractURLs :: String -> [String]<br />
extractURLs arg = [x | TagOpen "a" atts <- (parseTags arg), (_,x) <- atts, "/haskellwiki/Xmonad/Config_archive/" `isPrefixOf` x]<br />
</pre><br />
<br />
Make sure you have the tagsoup package installed from hackage or your package manager, then paste the script into a file, e.g. <tt>get-xmconfigs.hs</tt>, then, to download the configs into the current directory:<br />
% runhaskell get-xmconfigs<br />
<br />
Note that this script will ''only'' work on those configs which strictly followed the above uploading guidelines, since the script makes a number of simplifying assumptions. (Specifically: title includes the string "xmonad.hs", it was uploaded to a subpage of this page, the <tt><nowiki><haskell></nowiki></tt> tags are on their own lines, and the first pair encloses the xmonad.hs. See gwern's<br />
[http://www.haskell.org/pipermail/xmonad/2009-January/007106.html original email] for more details.)<br />
<br />
==Module Import Popularity==<br />
Here is a script to summarize the imports in a given directory of .hs files, such as the ones downloaded by the script in the previous section.<br />
<br />
<haskell><br />
#!/usr/bin/runghc<br />
<br />
import System.Directory(getDirectoryContents)<br />
import System.FilePath(splitExtension)<br />
import Control.Applicative((<$>))<br />
import Control.Monad(mapM)<br />
import Data.Char(isNumber, isSpace)<br />
import Data.List(foldl', sortBy, stripPrefix)<br />
import Data.Maybe(mapMaybe)<br />
import Data.Monoid(mconcat)<br />
import Data.Ord(comparing)<br />
<br />
import qualified Data.Map as M<br />
<br />
main = do<br />
fs <- filter ((\(fn,ext) -> ext == ".hs" && all isNumber fn) . splitExtension)<br />
<$> getDirectoryContents "."<br />
let getModName :: String -> [String]<br />
getModName = map (takeWhile (\x -> not $ isSpace x || x == '('))<br />
. mapMaybe (mconcat $ map stripPrefix ["import qualified ","import "])<br />
. lines<br />
xs <- mapM (fmap getModName . readFile) fs<br />
noborders on keypress for client. custom keybindings. magnifier.<br />
[[Image:entropie-config.png|center|200px]]<br />
<br />
;[[/Eric Mertens' xmonad.hs]] (0.5)<br />
:[[/Eric Mertens's Config.hs]] (0.4)<br />
:Customized DynamicLog, ShellPrompt, TilePrime, Dual-head and an effort to make the statusbar similar to DWM.<br />
[[Image:glguy-config.jpg|center|400px]]<br />
<br />
;[[/Erthad's xmonad.hs]] (darcs 25 Aug 2008/0.7)<br />
: mixed hotkeys config (standard+EZConfig), wmii-like keyboard behavior,<br />
: EWMH desktops, dzen integration (dzen configs see at http://fly.osdn.org.ua/~erthad/)<br />
<br />
;[[/Gwern's Config.hs (0.4)]] (old)<br />
<br />
[[/iderrick xmonad.hs]] (0.8)<br />
: Maximize, Dynamiclog with xmobar, Custom layout (with Combo) for latex writing (xpdf + editor + little terminal), French keyboard, Windows key for shortcuts<br />
<br />
[[Image:iderrick.png|center|200px]]<br />
;[[/lazor's xmonad.hs]] (0.8)<br />
: working xmonad.hs for KDE 4.2<br />
[[Image:screenshot-xmonad-lazor.jpg|center|200px]]<br />
<br />
; [[/Lee Aylward's xmonad.hs]] (0.5)<br />
: Resizable Tall, NoBorders, dzen DynamicLog, rhythmbox control shortcuts, windows key<br />
[[Image:leeaylward.png|center|400px]]<br />
<br />
; [[/Mr.Elendig's xmonad.hs]] (0.7)<br />
; Somewhat simple, but verbose config, with ResizableTall, xmobar and mpd controlls.<br />
[[Image:mre-ss1.png|center|200px]]<br />
<br />
;[[/nomeatas Config.hs]] (0.4)<br />
:modMask = mod4Mask; gnome-stuff<br />
<br />
;[[/nomeata’s xmonad.hs]] (xmonad 0.7)<br />
: CycleWS to avoid changing visible workspaces on other screens, EWMH, UpdatePointer, avoidStruts, IM for piding (on the right side), fullscreen via toggleLayouts, no boarders,<br />
<br />
;[[/Ray's xmonad.hs]] (0.5)<br />
:DynamicLog, custom manageHook, changed from default terminal, border colors, prompts, and layouts. Pseudo-Haskell dzen statusbar with Greek letters for workspace names.<br />
[[Image:Ray-config.png|center|200px]]<br />
<br />
;[[/Robert Manea's Config.hs and support scripts]] (0.4)<br />
0.4 screenshot: [[Image:rob-config.png|center|400px]]<br />
<br />
;[[/Robert Manea's xmonad.hs]] (0.8)<br />
:Customized DynamicLog and ShellPrompt, ManageDock, some efforts to make the colors of all components go together well<br />
0.5 screenshot: [[Image:Xmonad_shellprompt_newconf.png|center|400px]]<br />
<br />
; [[/Remi's xmonad.hs]] (0.7)<br />
; [[/Remi's .xmobarrc]] (0.8)<br />
; [[/Remi's .xinitrc]]<br />
: Lots of key bindings for destkop-navigation/moving, xmonad.hs-editing, music, next-N-windows-float-hack. xmobar integration and PerWorkspace Layouts. And a yet-to-be-published libmpd xmobar plugin.<br />
[[Image:Remi-xmonad-screenshot.png|center|200px]]<br />
<br />
; [[/rtalreja's xmonad.hs]] (0.8.1)<br />
; [[/rtalreja's .conkyrcdzen]]<br />
:dynamicLogWithPP with dzen, conky piped into dzen, urgency hints, compositing, shortcuts for mpd controls.<br />
[[Image:rtalreja-screenshot.png|center|200px]]<br />
<br />
; [[/skorpan's xmonad.hs]] (0.8)<br />
; [[/skorpan's xmobarrc]] (0.9)<br />
: Red/gray borders + NoBorders, EZConfig, xmobar 0.9 with workspaces, layout, title, battery, CPU usage, memory usage, date and time.<br />
[[Image:2009-01-25-183906 1280x800 scrot.png|center|200px]]<br />
<br />
; [[/sphynx's xmonad.hs]] (0.7)<br />
: Emacs-style keybindings, xmobar integration, XFT-fonts, ManageDocks, Tabbed layout, IM layout for Pidgin and Skype configured through PerWorkspace, Search extension for Wikipedia, translation and Google, usage of CopyWindow to 'make window always visible', Urgency hook, PerWorkspace usage, Scratchpad terminal, custom styles for prompt and borders.<br />
<br />
;[[/twifkak's Config.hs]] (0.4)<br />
;[[/twifkak's xmonad.hs]] (0.8)<br />
:modMask = mod4Mask; noBorders tabbed layout; keybindings for dzen, rotview, swapworkspaces, windowbringer, and windownavigation; urgencyhook.<br />
<br />
; [[/Wfarr's xmonad.hs]] (0.6)<br />
: ResizableTall Layout using EZConfig, cycleWS, CopyWindows, and DZen to get some cool stuff happening.<br />
[[Image:Wfarrscreen1.png|center|200px]]<br />
<br />
;[[/Xilon's xmonad.hs]] (0.5)<br />
:Simple and clean setup with dzen and a tray. Dzen with workspaces uses UrgencyHook for Urgent windows.<br />
[[Image:xilon-config.png|center|200px]]<br />
<br />
==Note on uploading==<br />
[http://haskell.org/haskellwiki/HaskellWiki:New_accounts Request a haskell wiki account] if needed.<br />
<br />
To upload your config file, create some text on this page of the form:<br />
<br />
putStr . unlines . map show . sortBy (comparing snd) . M.toList<br />
. foldl' (\m k -> M.insertWith (+) k 1 m) M.empty<br />
. concat $ xs<br />
</haskell><br />
<br />
Part of the output showing the most popular modules in the config archive is:<br />
<br />
<haskell><br />
("XMonad.Layout.NoBorders",40)<br />
("XMonad.Hooks.DynamicLog",43)<br />
("XMonad.Util.Run",44)<br />
("XMonad.Hooks.ManageDocks",45)<br />
("Data.Map",53)<br />
("XMonad.StackSet",53)<br />
("XMonad",63)<br />
</haskell><br />
<br />
[[Category:XMonad configuration]]</div>Kapilhttps://wiki.haskell.org/index.php?title=Xmonad/Config_archive/Kapil_gnomemenuadd.hs&diff=50188Xmonad/Config archive/Kapil gnomemenuadd.hs2012-08-26T03:11:40Z<p>Kapil: simple modification to XMonad.Config.Gnome to popup Gnome Menu</p>
<hr />
<div>This gives a hacky solution to<br />
[https://code.google.com/p/xmonad/issues/detail?id=451 Issue 451 in xmonad]<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Config.Gnome<br />
import XMonad.Config.Desktop<br />
<br />
import Control.Concurrent (threadDelay)<br />
import qualified Data.Map as M<br />
<br />
main = xmonad $ gnomeConfig {<br />
,keys = addlKeys <+> keys desktopConfig<br />
}<br />
<br />
addlKeys conf@(XConfig {modMask = modm}) = M.fromList $<br />
[ ((modm, xK_F1), gnomeMenu) ]<br />
<br />
gnomeMenu :: X ()<br />
gnomeMenu = withDisplay $ \dpy -> do<br />
rw <- asks theRoot<br />
gnome_panel <- getAtom "_GNOME_PANEL_ACTION"<br />
panel_menu <- getAtom "_GNOME_PANEL_ACTION_MAIN_MENU"<br />
<br />
-- a "magic" delay that just makes this work. The problem<br />
-- is specified at<br />
-- https://code.google.com/p/xmonad/issue/detail?id=451<br />
io $ threadDelay 105000<br />
<br />
io $ allocaXEvent $ \e -> do<br />
setEventType e clientMessage<br />
setClientMessageEvent e rw gnome_panel 32 panel_menu 0<br />
sendEvent dpy rw False structureNotifyMask e<br />
sync dpy False<br />
</haskell></div>Kapilhttps://wiki.haskell.org/index.php?title=Talk:Euler_problems/11_to_20&diff=33403Talk:Euler problems/11 to 202010-01-31T14:14:35Z<p>Kapil: Improvement to solution to Collatz problem in ProjectEuler</p>
<hr />
<div>It seems to me that the solution posted to the Collatz problem is not<br />
the most efficient. In order to find integer that gives the longest chain<br />
it is not necessary to _find_ that longest chain. So one needs to use<br />
a Boolean function that merely checks whether the chain for n is<br />
longer than that for m where m is the winner so far.<br />
<br />
This does not need to repeatedly calculate the chain for m if we <br />
the tuple (m,c,m') where c is the length of the chain from m to m'<br />
which we have calculated so far.<br />
<br />
As far as I know the longest chain is significantly longer than all<br />
the other chains considered so this should save us a lot of time by<br />
avoiding computing that chain.</div>Kapilhttps://wiki.haskell.org/index.php?title=Talk:Pointfree&diff=26459Talk:Pointfree2009-02-14T02:06:04Z<p>Kapil: pointed out the notion of pointless toposes</p>
<hr />
<div>There is a notion of "pointless" toposes. It seems to me that "pointfree" is related to this idea. Some explanation follows.<br />
<br />
A topos is thought of as a model for set theory. Hence it is natural to calculate with "elements". A topos is also a model for sheaves on a space. In that case it is natural to calculate with "stalks". In either case, we associate (functorially) to each object of our category a set "made up of elements" and then do the calculation with these elements. There are "pointless" toposes (for example the Deligne-Barr topos) so one should learn to carry out topos theoretic calculations with the crutch of "elements" or "points".<br />
<br />
[[User:Kapil|kapil]] 02:06, 14 February 2009 (UTC)</div>Kapilhttps://wiki.haskell.org/index.php?title=Talk:Prime_numbers&diff=26276Talk:Prime numbers2009-02-04T06:45:32Z<p>Kapil: added signature</p>
<hr />
<div>Here's an interesting question: will the program go faster if we replace all those <hask>(n >)</hask> expressions with <hask>(\x -> floor (sqrt n) > x)</hask>?<br />
<br />
On one hand, a composite integer cannot possess a factor greater than its square root.<br />
<br />
On the other hand, since the list we're looking through contains all possible prime numbers, we are guaranteed to find a factor or an exact match eventually, so do we need the <hask>takeWhile</hask> at all?<br />
<br />
Throwing this over to somebody with a bigger brain than me...<br />
<br />
[[User:MathematicalOrchid|MathematicalOrchid]] 16:41, 5 February 2007 (UTC)<br />
<br />
a composite can indeed have factors greater than its square root, and indeed most do. what you mean is that a composite will definitely have at least one factor smaller-equal than its square root.<br />
<br />
why not use <hask>(\x -> n > x*x)</hask> --[[User:JohannesAhlmann|Johannes Ahlmann]] 21:18, 5 February 2007 (UTC)<br />
<br />
LOL! That is ''indeed'' what I meant.<br />
<br />
It turns out my comment above is correct - the <hask>takeWhile</hask> filtering in <hask>factors</hask> is in fact unecessary. The function works just fine without it. (Notice I have made some edits to correct the multiple bugs in the <hask>primes</hask> function. Oops!)<br />
<br />
Now the only use of <hask>takeWhile</hask> is in the <hask>is_prime</hask> function, which could be changed to 'give up' the search a lot faster and hence confirm large primes with much less CPU time and RAM usage. Maybe I'll wrap my brain around that later.<br />
<br />
[[User:MathematicalOrchid|MathematicalOrchid]] 10:17, 6 February 2007 (UTC)<br />
<br />
The section [[Prime_numbers#Simple_Prime_Sieve_II|Simple Prime Sieve II]] is not a sieve in the same sense that the first one is. It really implements a primality test as a filter.<br />
<br />
A more "sieve-like" version of the simple sieve which exploits the fact that we need not check for primes larger than the square root would be<br />
<br />
<hask><br />
primes :: [Integer]<br />
primes = sieve [2..]<br />
where sieve (p:xs) = p : sieve [x | x<-xs, (x< p*p) || (x `mod` p /= 0)]<br />
</hask><br />
<br />
However, this runs even slower than the original!<br />
<br />
[[User:Kapil|Kapil Hari Paranjape]] 06:51, 4 February 2009 (UTC)</div>Kapilhttps://wiki.haskell.org/index.php?title=Talk:Prime_numbers&diff=26274Talk:Prime numbers2009-02-04T06:39:07Z<p>Kapil: comment on difference between prime filtering and sieve-ing</p>
<hr />
<div>Here's an interesting question: will the program go faster if we replace all those <hask>(n >)</hask> expressions with <hask>(\x -> floor (sqrt n) > x)</hask>?<br />
<br />
On one hand, a composite integer cannot possess a factor greater than its square root.<br />
<br />
On the other hand, since the list we're looking through contains all possible prime numbers, we are guaranteed to find a factor or an exact match eventually, so do we need the <hask>takeWhile</hask> at all?<br />
<br />
Throwing this over to somebody with a bigger brain than me...<br />
<br />
[[User:MathematicalOrchid|MathematicalOrchid]] 16:41, 5 February 2007 (UTC)<br />
<br />
a composite can indeed have factors greater than its square root, and indeed most do. what you mean is that a composite will definitely have at least one factor smaller-equal than its square root.<br />
<br />
why not use <hask>(\x -> n > x*x)</hask> --[[User:JohannesAhlmann|Johannes Ahlmann]] 21:18, 5 February 2007 (UTC)<br />
<br />
LOL! That is ''indeed'' what I meant.<br />
<br />
It turns out my comment above is correct - the <hask>takeWhile</hask> filtering in <hask>factors</hask> is in fact unecessary. The function works just fine without it. (Notice I have made some edits to correct the multiple bugs in the <hask>primes</hask> function. Oops!)<br />
<br />
Now the only use of <hask>takeWhile</hask> is in the <hask>is_prime</hask> function, which could be changed to 'give up' the search a lot faster and hence confirm large primes with much less CPU time and RAM usage. Maybe I'll wrap my brain around that later.<br />
<br />
[[User:MathematicalOrchid|MathematicalOrchid]] 10:17, 6 February 2007 (UTC)<br />
<br />
The section [[Prime_numbers#Simple_Prime_Sieve_II|Simple Prime Sieve II]] is not a sieve in the same sense that the first one is. It really implements a primality test as a filter.<br />
<br />
A more "sieve-like" version of the simple sieve which exploits the fact that we need not check for primes larger than the square root would be<br />
<br />
<hask><br />
primes :: [Integer]<br />
primes = sieve [2..]<br />
where sieve (p:xs) = p : sieve [x | x<-xs, (x< p*p) || (x `mod` p /= 0)]<br />
</hask><br />
<br />
However, this runs even slower than the original!</div>Kapilhttps://wiki.haskell.org/index.php?title=User:Kapil&diff=26123User:Kapil2009-01-26T03:47:50Z<p>Kapil: put in a note about the haskell course</p>
<hr />
<div>I have just started a course on Functors, Monads and Programming at<br />
the Institute of Mathematical Sciences, Chennai. Suggestions from<br />
people on this wiki are always welcome. The home page for the course<br />
is at http://www.imsc.res.in/IMScWiki/Haskell_Course. Unfortunately,<br />
this is not edit-able from outside the IMSc LAN. I will, however try<br />
to incorporate any suggestions sent by e-mail.</div>Kapilhttps://wiki.haskell.org/index.php?title=Functional_programming&diff=25823Functional programming2009-01-14T06:24:00Z<p>Kapil: some typos</p>
<hr />
<div>'''Functional programming''' is a style of programming which unlike '''imperative programming''' models computations as the evaluation of expressions. This article is meant to describe it briefly, however the best way to understand functional programming is to learn the basics of one of the functional programming languages ([[Haskell in 5 steps|learn Haskell]]).<br />
<br />
You can find an old version of this page [[Functional programming/Old version|here]].<br />
<br />
==What is functional programming?==<br />
'''Functional programming''' means that programs are executed by evaluating '''expressions'''. This contrasts with '''imperative programming''' where programs are composed of '''statements''' which change global '''state''' when executed. Functional programming, on the other hand, avoids using state and mutable data.<br />
<br />
Functional programming requires that functions are '''first-class''', which means that they are treated like any other values and can be passed as arguments to other functions or be returned as a result of a function. Being first-class also means that it is possible to define and manipulate functions '''nested''' in code blocks. Special attention needs to be given to nested functions, called '''[[closure]]s''', that reference local variables from their scope. If such a function '''escapes''' their block after being returned from it, the '''local variables''' must be '''retained''' in memory, as they might be needed later when the function is called. Usually it is not possible to determine the moment of release statically which means that an automatic [[memory management]] technique has to be used.<br />
<br />
==Functional vs imperative languages==<br />
<br />
Many programming languages support programming in both functional and imperative styles, however each language has '''syntax''' and facilities that are optimised only for one of these styles. Often, code written in one particular style and not the other is executed efficiently by the implementations. In addition to that, coding conventions and libraries often force the programmer to use one of the styles. Therefore, programming languages are categorized into functional and imperative ones.<br />
<br />
Following table shows which languages support functional programming (by supporting closures) and for which the functional style is the dominant one.<br />
{| class="wikitable"<br />
|-<br />
! Language<br />
! Closures<br />
! Functional<br />
|-<br />
! C/C++<br />
| No || No<br />
|-<br />
! Pascal<br />
| No || No<br />
|-<br />
! Java<br />
| Yes || No<br />
|-<br />
! Modula-3<br />
| Yes || No<br />
|-<br />
! Python<br />
| Yes || No<br />
|-<br />
! Ruby<br />
| Yes || No<br />
|-<br />
! D (2.0)<br />
| Yes || No<br />
|-<br />
! Ocaml<br />
| Yes || Yes<br />
|-<br />
! Haskell<br />
| Yes || Yes<br />
|}<br />
<br />
==Features of functional languages==<br />
===Higher-order functions===<br />
[[Higher order function|Higher-order function]]s ('''HOFs''') are functions that take other functions as their arguments. Basic example of a HOF is <hask>map</hask> which takes a function and a list as its arguments, applies the function to all elements of the list and returns a list of its results. For instance, we can write a function that subtracts 2 from all elements of a list without using loops or recursion:<br />
<haskell><br />
subtractTwoFromList l = map (\x -> x - 2) l<br />
</haskell><br />
We can generalize this function to subtract any given number:<br />
<haskell><br />
subtractFromList l y = map (\x -> x - y) l<br />
</haskell><br />
The function given to <hask>map</hask> then becomes a [[closure]] because <hask>\x -> x - y</hask> references a local variable <hask>y</hask> from the outside of its body.<br />
<br />
Higher-order functions are very useful for refactoring the code and reduce the amount of repetition. For example, typically most of the ''for'' loops can be expressed using maps or [[fold]]s. Custom iteration schemes, such as parallel loops, can be easily expressed using HOFs.<br />
<br />
Higher-order functions are often used to implement '''[[Embedded domain specific language|domain-specific languages]]''' embedded in Haskell as '''combinator libraries'''.<br />
<br />
Higher-order functions can be usually simulated in object-oriented languages by functions that take ''function-objects'', also called ''functors'' (note that [[functor]] in Haskell is an entirely different concept). Variables from the scope of the call can be bound inside the function-object which acts as if it were a closure. This way of simulating HOFs is, however, very verbose and requires declaring a new class each time we want to use a HOF.<br />
<br />
===Purity===<br />
Some functional languages allow expressions to yield actions in addition to return values. These actions are called '''side effects''' to stress out that the return value is the most important outcome of a function (as opposed to imperative programming). Languages that prohibit side effects are called '''pure'''. Even though some functional languages are impure they often contain a '''pure subset''' that is a also useful as a programming language. It is usually beneficial to write a significant part of a functional program in a purely functional fashion and keep the code involving state and I/O to the minimum as it is more prone to errors.<br />
<br />
====Immutable data====<br />
Purely functional programms operate only on '''immutable''' data. This is possible because on each modification a new version of a data structure is created and the old one is preserved. Therefore, data structures are '''persistent''' as it is possible to refer also to old versions of them. If there are no more references to the old version the unreferred data can be collected by automatic [[memory management]], such as a garbage collector. Often, bigger data structures '''share''' their parts between versions and do not consume as much memory as all versions separately.<br />
<br />
====Referential transparency====<br />
Pure computations yield the same value each time they are invoked. This property is called '''[[referential transparency]]''' and makes possible to conduct '''equational reasoning''' on the code. For instance if <hask>y = f x</hask> and <hask>g = h y y</hask> then we should be able to replace the definition of <hask>g</hask> with <hask>g = h (f x) (f x)</hask> and get the same result, only the efficiency might change.<br />
<br />
====Lazy evaluation====<br />
Since pure computations are referentially transparent they can be performed at any time and still yield the same result. This makes it possible to defer the computation of values until they are needed, that is to compute them ''lazily''. '''[[Lazy evaluation]]''' avoids unnecessary computations and allows, for instance, to create '''lazy data structures''' that are built on the fly.<br />
<br />
====Purity and effects====<br />
Even though purely functional programming is very beneficial, the programmer might want to use features that are not available in pure programs, like efficient mutable arrays or convenient I/O. There are two approaches to this problem.<br />
=====Side effects in the language=====<br />
Some functional languages extend their purely functional core with side effects. The programmer must make sure himself that he doesn't use impure functions in places where only pure functions are expected.<br />
<br />
=====Side effects through monads=====<br />
Another way of introducing side effects to a pure language is to simulate them using [[monad]]s. While the language remains pure and referentially transparent, monads can provide implicit state by threading it inside them. The compiler does not even have to 'know' about the imperative features because the language itself remains pure, however usually the implementations do 'know' about them due to the efficiency reasons, for instance to provide <math>O(1)</math> mutable arrays.<br />
<br />
Allowing side effects only through monads and keeping the language pure makes it possible to have lazy evaluation that does not conflict with the effects of impure code. Even though the expressions are evaluated lazily, some parts of them are '''forced''' by monads to be evaluated in a specific order and the effects are properly '''sequenced'''.<br />
<br />
===Recursion===<br />
'''Recursion''' is heavily used in functional programming as it is the canonical and often the only way to '''iterate'''. Loops are naturally expressed using '''tail recursion'''.<br />
<br />
==Benefits of functional programming==<br />
Functional programming is known to provide better support for '''structured programming''' than imperative programming. To make a program structured it is necessary to develop '''abstractions''' and split it into '''components''' which interface each other with those abstractions. Functional languages aid this by making it easy to create clean and simple abstractions. It is easy, for instance, to '''abstract out''' a recurring piece of code by creating a higher-order function which will make the resulting code more '''declarative''' and comprehensible.<br />
<br />
Functional programs are often shorter and easier to understand than their imperative counterparts. Since various studies have shown that the average programmer's productivity in terms of lines of code is more or less the same for any programming language, this translates also to higher productivity.</div>Kapil