xmobar 0.8 → 0.9
raw patch · 26 files changed
+1875/−1513 lines, 26 filesdep +X11-xftdep +directorydep +utf8-stringsetup-changed
Dependencies added: X11-xft, directory, utf8-string
Files
- ChangeLog +1018/−0
- Commands.hs +9/−5
- Config.hs +22/−15
- Main.hs +27/−25
- Parsers.hs +59/−71
- Plugins.hs +8/−4
- Plugins/Date.hs +5/−4
- Plugins/Monitors.hs +34/−18
- Plugins/Monitors/Batt.hs +18/−23
- Plugins/Monitors/CoreCommon.hs +52/−0
- Plugins/Monitors/CoreTemp.hs +41/−0
- Plugins/Monitors/CpuFreq.hs +40/−0
- Plugins/Monitors/Thermal.hs +42/−0
- Plugins/Monitors/Weather.hs +17/−13
- Plugins/PipeReader.hs +3/−3
- Plugins/StdinReader.hs +1/−1
- README +154/−77
- README.html +0/−1012
- Runnable.hs +6/−6
- Runnable.hs-boot +0/−3
- Setup.lhs +1/−1
- XUtil.hsc +224/−0
- Xmobar.hs +71/−138
- xmobar.cabal +22/−5
- xmobar.config-sample +1/−1
- xmobar.css +0/−88
+ ChangeLog view
@@ -0,0 +1,1018 @@+Thu May 1 10:26:29 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ tagged 0.9 release++Tue Apr 29 14:59:53 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * style, pointfree and trailing spaces++Tue Apr 29 14:36:03 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Parsers: code and comment cleanup++Tue Apr 29 14:27:29 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cabal update++Tue Apr 29 12:33:12 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: updated to latest changes++Tue Apr 29 12:32:42 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * email address, copyright date and more++Tue Apr 29 12:32:15 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * bump cabal version to 0.9++Tue Apr 29 12:29:44 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Weather: close handles when successfully retrieving the data++Tue Apr 29 12:28:48 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * style++Tue Apr 29 11:43:41 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Parser: '<' and '>' are not reserved characters anymore and can be used in the template+ + Consider this the first 0.9 release candidate.+ ++Sat Apr 19 11:00:32 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * config-sample: use Top for positioning+ With Static xmobar does not set _NET_WM_STRUT_PARTIAL, which causes+ troubles to novice xmonad users. ++Fri Apr 18 20:53:36 CEST 2008 Spencer Janssen <sjanssen@cse.unl.edu>+ * Remove -threaded from ghc-options.+ GHC's -threaded scheduler seems to wake up more frequently even when all+ threads are idle. These frequent wakeups are detrimental to laptop battery+ life.++Sun Mar 30 22:37:22 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * move "use_xft" to "with_xft"++Sun Mar 30 22:01:15 CEST 2008 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>+ * XUtil: fix UTF-8 check.++Sun Mar 30 11:15:37 CEST 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Fix _NET_WM_STRUT_PARTIAL implementation++Sat Mar 29 11:38:34 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Set _NET_WM_STRUT_PARTIAL instead of _NET_WM_STRUT and change mkUnmanageWindow to newWindow++Tue Mar 18 11:18:58 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Automate version generation++Mon Mar 17 13:23:27 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: typos++Sun Mar 16 17:46:42 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: updated to latest changes++Sun Mar 16 17:01:15 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Add BatteryP a monitor for batteries+ + With this monitor is possible to set specific location where to+ retrieve battery information.+ + For example:+ Run BatteryP ["BAT0","BAT1","BAT2"] [] 10+ + this will read the following files:+ /proc/acpi/battery/BAT0/info and /proc/acpi/battery/BAT0/state+ /proc/acpi/battery/BAT1/info and /proc/acpi/battery/BAT1/state+ /proc/acpi/battery/BAT1/info and /proc/acpi/battery/BAT2/state++Sun Mar 16 13:28:05 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Config: use more xmonad friendly defaults++Sun Mar 16 13:11:00 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * add XFT support and make UTF-8 support configurable+ This patch includes many changes:+ - moved font and printing functions to XUtil.hs and created an+ abstraction layer to font management;+ - ported the core, StdinReader and PipeReader to the new font+ management system.+ + To enable UTF-8 support configure with the "with_utf8" flag (requires+ utf8-string):+ runhaskell Setup.lhs configure --flags="with_utf8"+ + To enable XFT (which will turn on UTF-8 support too) configure with the+ "with_utf8" flag (requires utf8-string and X11-xft):+ runhaskell Setup.lhs configure --flags="use_xft"++Wed Feb 27 20:00:51 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Date: haddock fixes++Wed Feb 27 14:38:29 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * remove xmobar.css from repository++Tue Feb 26 16:19:18 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Add reference to curl dependency of the Weather plugin in the README+ and remove README.html from the repository++Tue Feb 19 02:19:09 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Xmobar: vertical align after wc string++Sat Feb 16 17:06:50 CET 2008 Juraj Hercek <juhe_haskell@hck.sk>+ * Adjusted filter used for digging out information from /sys directory+ - As of 2.4.24 kernel you might experience same frequency for all cores,+ because cpufreq directory is a link for cores 1 and higher++Sat Feb 16 09:14:58 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cabal: remove unneeded -liconv linker flag++Sat Feb 16 09:04:21 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * PipeReader: add utf8 support++Sat Feb 16 09:03:06 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * StdinReader: add utf8 support++Sat Feb 16 09:01:51 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * add utf8 support to the core system++Sat Feb 16 09:01:04 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cabal: add HsLocale and dependency on utf8-string++Sat Feb 16 09:00:26 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Add HsLocale to support utf8++Sat Feb 16 08:58:42 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * trailing spaces++Wed Jan 9 10:43:54 CET 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Set strut value for BottomW and TopW too++Sun Dec 23 00:14:19 CET 2007 Juraj Hercek <juhe_haskell@hck.sk>+ * Added documentation.+ - added Thermal, CoreTemp, CpuFreq documentation to README file+ - added haddock documentation++Sun Dec 23 00:10:39 CET 2007 Juraj Hercek <juhe_haskell@hck.sk>+ * Adjusted thermal monitor.+ - Thermal monitor can handle more thermal zones now++Sun Dec 16 01:13:26 CET 2007 Spencer Janssen <sjanssen@cse.unl.edu>+ * Remove -O2 -fasm from ghc-options, allow Cabal to determine the best flags++Tue Dec 4 15:54:49 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cabal: directory needed only with small_base++Fri Nov 30 21:54:30 CET 2007 Juraj Hercek <juhe_haskell@hck.sk>+ * Added thermal, cpufreq and coretemp monitors.+ Prerequisities:+ thermal+ - thermal module should be loaded/compiled in kernel+ - available in (at least) intel centrino processors+ cpufreq+ - acpi_cpufreq module should be loaded/compiled in kernel+ - available in modern processors+ coretemp+ - coretemp module should be loaded/compiled in kernel+ - available (at least) in core 2 duo processors++Sun Nov 18 13:07:23 CET 2007 Alexander Solovyov <piranha@piranha.org.ua>+ * Typo fixes++Thu Nov 15 14:49:05 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Now that a cold winter is approaching I added a new feature to Weather: the capacity of reading negative temperature.+ This feature is generally not needed in Summertime. ++Wed Nov 14 08:47:08 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: typo++Sun Nov 11 17:31:12 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ tagged 0_8_release++Sun Nov 11 10:59:56 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cabal: updated cabal file to work with 1.2 and both ghc-6.6 and 6.8++Sun Nov 11 10:59:19 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: added reference to a source tree that works with Cabal-1.1.x++Thu Nov 8 00:10:28 CET 2007 Spencer Janssen <sjanssen@cse.unl.edu>+ * StdinReader: exit when stdin has been closed++Mon Nov 5 11:23:54 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Plugins/Monitors/Common.hs: fix a bug in stringParser++Sun Nov 4 18:58:56 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README:updated to latest changes++Sun Nov 4 18:45:51 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * A new implementation of the position configuration option+ WARNING: this patch breaks previous configuration files.+ A new implementation of the position configuration option:+ - Top and Bottom have non arguments+ - TopW and BottomW have now 2 arguments: Align (L, C or R) and Int+ - setting a width % greater than 100 means a 100% width++Sun Nov 4 16:32:44 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * helloworld.config updated to recent changes++Sun Nov 4 16:26:26 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Preserve backward compatibility+ WARNING: this patch changes the configuration file+ This patch reintroduces backward compatibility with recent changes in+ the configuration option. Now Top and Bottom do not take any argument.+ To set the width and alignment used TopW (Align Int) and BottomW+ (Align Int) instead, where Align is either C, L or R.++Sun Nov 4 12:21:06 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * helloworld.config: updated to latest configuration changes++Sun Nov 4 12:17:31 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added an argument to Top and Bottom type contructors++Sun Nov 4 12:16:55 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added an argument to Top and Bottom type contructors++Sun Nov 4 12:12:21 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added possibility to set the main window's width+ WARNING: this patch breaks previous configuration files!+ + Changed the position configuration option: now Top and Bottom require+ one argument, the width of the main window. 4 possibilities are given:+ - A means all the screen width+ - C Int means centered, with the Int percentage of screen width+ - L Int means left aligned, with the Int percentage of screen width+ - R Int means right aligned, with the Int percentage of screen width+ + Examples:+ position = Top A+ or+ position = Bottom (C 50)++Sun Nov 4 12:12:00 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Window is mapped after properties have been set++Sun Nov 4 12:11:11 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Fixed a compilation issue on non 32bit machines++Sat Nov 3 14:03:06 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Removed X11-extras-0.4 and bump X11 to 1.3.0++Thu Nov 1 10:11:09 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: added reference to a screenshot++Wed Oct 31 12:37:14 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: added link to xmonad home page++Wed Oct 31 12:28:10 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README updated darcs repository link++Wed Oct 31 12:25:07 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README added position examples++Wed Oct 31 11:58:34 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * css: fixed a validation error++Wed Oct 31 11:49:33 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README add link to Ion++Wed Oct 31 11:42:47 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added README.html and xmobar.css++Wed Oct 31 11:39:00 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README now uses pandoc: this way we can also generate a nice home page++Wed Oct 31 11:38:31 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Bump version to 0.8 and updated homepage++Mon Oct 29 08:38:26 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Code formatting only++Sun Oct 28 23:38:37 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Avoid irrefutable pattern in handling text alignment++Sun Oct 28 23:03:05 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: latest updates++Sun Oct 28 22:56:51 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added support for alignment commands in the output template++Sun Oct 28 22:55:15 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Main: removed align and added alignSep configuration option++Sun Oct 28 22:47:20 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added support for text alignment commands in the output template+ WARNING: this patch breaks old configuration files.+ - removed align configuration option+ - added alignSep configuration option, a 2 character string: the text+ before the first character will be align to left, the text in+ between the 2 characters will be centered, and the text after the+ second character will be align to the right. For instance:+ with alignSep="][" the following output template+ "left text ] %date% [ right text"+ will display "left text" aligned to the left, a centered date, and+ "right text" aligned to the right+ See xmobar.config-sample or /Plugins/helloworld.config for examples++Sun Oct 28 16:49:23 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: added credits to Lennart Kolmodin++Sun Oct 28 14:44:51 CET 2007 Lennart Kolmodin <kolmodin@gentoo.org>+ * Bump version requirement of X11-extras to 0.4+ The constructor ExposeEvent appered in X11-extras-0.4++Sun Oct 28 14:28:04 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: updated to latest changes++Sun Oct 28 14:19:56 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Now we use information returned by getScreenInfo to draw the main window and more+ - we now cache the FontStruct+ - position is automatically calculated and updated in reposn to XRandR events++Sun Oct 28 14:19:10 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Main: removed old options and added the new ones++Sun Oct 28 13:40:34 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated config-sample to latest changes++Sun Oct 28 13:40:10 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated config-sample to latest changes++Sun Oct 28 13:36:38 CET 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Removed xPos yPos width and height configuration option and added position+ WARNING: this patch breaks old configuration files:+ - removed xPos, yPos, width and height+ - a "position" configuration option has been added: this can be set to:+ Top+ Bottom+ Static {xpos = Int, ypos = Int, width = Int, height = Int}+ See xmobar.config-sample for an example++Sun Oct 28 00:05:50 CEST 2007 Spencer Janssen <sjanssen@cse.unl.edu>+ * We must listen for ConfigureNotify events on the root window for xrandr++Sun Oct 28 00:01:35 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added credits to Dmitry Kurochkin++Sat Oct 27 13:44:37 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README screenshot url++Sat Oct 27 13:33:25 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README some updates++Sat Oct 27 13:11:27 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added XRandR support+ - Added support for XRandR: if the screen configuration changes,+ Xmobar will use the configured width only if smaller than the screen+ width, otherwise the later will be used instead.+ - Now Xmonad will set _NET_WM_STRUT and will present itself as a DOCK+ application++Sat Oct 27 13:10:32 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Bump version to 0.8++Sat Oct 27 13:09:32 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Main will now open the connection with the X server++Sat Oct 27 13:08:34 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added X11-extras dependeny++Tue Oct 23 18:54:30 CEST 2007 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>+ * Fix text vertical alignment.++Fri Oct 12 21:39:44 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Allow setting the foreground color+ Now it is possible dynamically set the foreground color of strings to+ be displayed with the <fc=foreground,background>string</fc> tag.++Fri Oct 12 21:39:20 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Parser: semplify color parsing++Thu Oct 11 22:30:29 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * The MVar is needed to avoid a race condition+ As Spencer noted the checker thread may be throwing an exception+ immediately, thus producing a race condition.++Sat Oct 6 12:54:47 CEST 2007 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>+ * Remove MVar from eventLoop.++Wed Oct 3 10:58:06 CEST 2007 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>+ * Use dynamic exceptions.++Fri Oct 5 00:39:21 CEST 2007 Spencer Janssen <sjanssen@cse.unl.edu>+ * Fix race conditions in Xmobar.eventLoop++Thu Oct 4 02:03:48 CEST 2007 Spencer Janssen <sjanssen@cse.unl.edu>+ * Weather plugin: accept temperatures with decimal points++Wed Oct 3 16:27:58 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README updated to recent API changes (the last hopefully)++Wed Oct 3 16:27:00 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Date: now implemented using rate and run++Wed Oct 3 16:25:49 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Reintroduced rate with a default implementation (1 second) to be used in the default implementation of start++Wed Oct 3 13:08:14 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: updated to recent API change++Wed Oct 3 13:07:43 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * HelloWorld defines only run++Wed Oct 3 13:06:09 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * reintroduced run as an Exec method: this way it is possible to write plugins by defining either run or start++Tue Oct 2 20:45:00 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * more code formatting++Tue Oct 2 20:40:57 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * coding style consistency++Tue Oct 2 20:11:34 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated README++Tue Oct 2 17:04:04 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Removed unneeded stuff+ Removed StateT: now we only use a ReaderT+ Some more code and comments cleanup++Tue Oct 2 13:53:19 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated helloworld.config-sample to latest changes++Tue Oct 2 13:52:44 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated config-sample to latest changes++Tue Oct 2 13:50:49 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cabal: added stm to the dependency list++Tue Oct 2 13:50:14 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Updated Parsers to latest changes++Tue Oct 2 13:49:37 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated Main to lates changes++Tue Oct 2 13:48:13 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Config: removed the refresh configuration option+ WARNING: this patch breaks previous configuration files. To update+ just get rid of the refresh configuration option ;)++Tue Oct 2 13:45:38 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Now Xmobar uses STM concurrency+ Now every time a TVar is updated the output window is redrawn. ++Fri Sep 28 14:04:32 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added a plugin to read from stdin+ Try it with: xmobar -t "%StdinReader%" -c '[Run StdinReader]'+ then start writing ;)++Fri Sep 28 14:04:13 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Removed unused rate method++Fri Sep 28 14:03:44 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * code formatting++Fri Sep 28 14:02:55 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Removed unused rate method++Fri Sep 28 14:02:18 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Removed unused rate method++Thu Sep 27 21:40:26 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * more cleanup++Thu Sep 27 19:51:44 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * PipeReader: added a configurable alias++Thu Sep 27 19:37:11 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Monitors: updated to recent API changes - code formatting++Thu Sep 27 19:36:51 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * HelloWorld: updated to recent API changes++Thu Sep 27 19:35:57 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Date: updated to recent API changes++Thu Sep 27 19:35:29 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added a plugin to read named pipes (such as an XMonad logger)++Thu Sep 27 19:34:49 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Confg.hs: added PipeReader to the default configuration++Thu Sep 27 19:31:51 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Setup: waiting for Cabal-1.2 :)++Thu Sep 27 19:31:09 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Main.hs: updated to reflect the API change - code formatting and cleanup++Thu Sep 27 19:29:51 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Xmobas.hs: updated to reflect the API change - code formatting and cleanup++Thu Sep 27 19:29:24 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added Show instance to Runnable++Thu Sep 27 19:28:48 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Plugins: added tenthSeconds to the exported API++Thu Sep 27 19:27:51 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Updated Runnable to the new API - added Show instance++Thu Sep 27 19:25:06 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * API change in the Exec class+ Changed run :: a -> IO String to+ start :: a -> (String -> IO ()) -> IO ()+ Suggested by Spencer Janssen.++Sat Sep 15 18:38:46 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * code formatting++Sat Sep 15 18:36:33 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added Date to default config++Sat Sep 15 16:01:43 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added a date plugin++Fri Sep 14 18:30:19 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added creadits to Jens++Wed Sep 12 09:09:49 CEST 2007 Jens Petersen <petersen@haskell.org>+ * Parse the temperature separately in Celcius and Fahrenheit.+ Parse the pressure in hPa.+ Generalize showWithColors to (Num a, Ord a) so it works for both Int's and Float's.+ Use an Int for temperature, pressure, and relative humidity.++Wed Sep 12 08:58:03 CEST 2007 Jens Petersen <petersen@haskell.org>+ * only use 1 decimal place for showing floating numbers++Wed Sep 12 08:54:20 CEST 2007 Jens Petersen <petersen@haskell.org>+ * include BAT0 acpi battery status too++Mon Sep 10 00:20:51 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: fixed some types++Mon Aug 27 12:59:02 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Plugins.Swap: check for SwapFree and SwapTotal+ In some system SwapFree and SwapTotal are in different position, so we+ need to check for the string.+ Reported by Stan Behrens++Tue Jul 24 22:35:54 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Monitors.Common: parseString must use ByteStrings++Tue Jul 24 19:30:47 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * loadQueryFont must be protected by catch+ Expecially now that fonts can be easily choose with a command line options.++Tue Jul 24 19:06:43 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Batt: we check if the file exists instead of catching an exception++Tue Jul 24 16:22:05 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Monitors.Commons: more code cleanup++Tue Jul 24 15:32:44 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Config.hs: removed %memory%" from default template++Tue Jul 24 15:16:58 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: some more editing++Tue Jul 24 14:51:20 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * if an invalid color name or value is given the black pixel will used instead++Tue Jul 24 14:01:31 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: added an example of command line options usage++Tue Jul 24 14:01:06 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * better error handling in Main.hs++Tue Jul 24 13:40:47 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Batt: better error handling++Tue Jul 24 13:10:19 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * ./Plugins/Monitors.hs: corrected module information++Tue Jul 24 13:05:41 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: added download information++Tue Jul 24 12:22:26 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * changed home page to http://gorgias.mine.nu/xmobar/++Tue Jul 24 12:13:22 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: updated to latest changes++Tue Jul 24 12:00:29 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * The help output must be visible in a terminal 80 characters wide++Tue Jul 24 11:44:35 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * code and output cleanup++Tue Jul 24 11:44:02 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Batt.hs: refactor to reduce resource usage++Tue Jul 24 11:27:01 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Monitors.Common: parseString will not produce exceptions anymore+ An empty string will be returned instead.++Tue Jul 24 11:25:51 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Main.hs: removed exception+ Check for default configuration file existence instead.++Mon Jul 23 22:08:52 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added support for command line options+ Configuration options will override configuration files, or default+ configuration.++Mon Jul 23 13:49:36 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * the normal color is set when normal > low++Thu Jul 19 12:15:05 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Moved battery line parsing into the Maybe monad.++Thu Jul 19 03:55:30 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Safer parsing without parsec in battery monitor++Mon Jul 16 02:34:48 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Fix parsing and processing data in Batt monitor.+ Sometimes the monitor would crash due to bad index given to (!!). Now it+ should be safe, as parsing is done differently.++Fri Jul 20 13:39:17 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * X code cleanup++Thu Jul 19 07:40:59 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * oops, I forgot to add Monitors.hs (it's not possible to build xmobar without it!)++Thu Jul 12 03:36:26 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Get rid of floats in scientific notation.+ Use 'showDigits n' instead of 'show . takeDigits n'. As this example shows+ explicit precision specifications would be appreciated ;)++Thu Jul 12 03:09:11 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Allow reverse "high" and "low" thresholds++Wed Jul 18 17:12:11 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Monitors are now a Plugin that can be removed from Config.hs++Wed Jul 18 00:51:31 CEST 2007 Spencer Janssen <sjanssen@cse.unl.edu>+ * Use asynchronous exceptions to obviate the need for forkOS and threaded++Tue Jul 17 23:11:38 CEST 2007 Spencer Janssen <sjanssen@cse.unl.edu>+ * execCommands is a mapM++Tue Jul 17 19:13:07 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * threads are now started with forkOS+ This is required by the fact that calling nextEvent will block all other+ running threads. So we need forkOS, which requires the -threaded ghc flag ++Tue Jul 17 18:12:00 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cabal: corrected x11-extras version number++Tue Jul 17 18:07:56 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * XEvents code cleanup++Tue Jul 17 15:14:11 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * XExposeEvent handling: that requires X11-extras+ XExposeEvent is now properly (sort of) handled, with an hackish approch:+ before nextEvent, that will block Xmobar since an Expose event is captured,+ we create a background thread that will send an Expose event after the+ configured refresh interval. So, either a real of a fake Expose event will+ reach our window within the configured interval. Quite cool, after all.+ ++Tue Jul 17 11:14:38 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * changed runXmobar to runXbar++Sat Jul 14 12:39:13 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README and Cabal edits+ Added some more credits, corrected typos, updated darcs version to 0.7,+ changed name to Xmonbar and removed references to XMonad. Xmobar is now just+ a minimalistic text based status bar for any kind of WM (the XMonad+ community adopted the more advanced and stable dzen, after all ;-)++Fri Jul 13 14:37:07 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * haddock tuning++Fri Jul 13 13:13:02 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cabal: added Plugins to the list of modules++Fri Jul 13 13:12:29 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Plugins.hs: some haddock corrections++Fri Jul 13 13:11:48 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README: updated to the latest changes++Fri Jul 13 12:13:29 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Config.hs: more code cleanup++Fri Jul 13 11:36:47 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Runnable: cleanup and some comments++Fri Jul 13 11:36:13 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added Plugins.hs for exporting the needed plugin API++Fri Jul 13 11:35:16 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Plugins now import Plugins.hs++Fri Jul 13 11:34:02 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Commands.hs: more code cleanup++Thu Jul 12 23:56:15 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * removed the Show instance requirement for plugins++Thu Jul 12 20:05:16 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cabal updates++Thu Jul 12 20:04:34 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added a plugin example with the needed runtime configuration file++Thu Jul 12 20:04:05 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * credits to Claus Reinke and removed debugging code++Thu Jul 12 19:50:34 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * use of existential types for plugin support+ This patch, which *changes the configuration format*, adds easy plugin support+ by using an existential type for storing the list of commands to be+ executed. Adding a plugin is just a matter of writing the appropriate+ instance of the Exec class, after importing Commands.hs.+ I must thank Claus Reinke for the help in understanding the mysteries of+ reading existential types. The Read instance of Runnable must be credited to+ him. See here:+ http://www.haskell.org/pipermail/haskell-cafe/2007-July/028227.html++Wed Jul 11 20:31:31 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Commands.hs: monitors take only one action now++Wed Jul 11 20:22:21 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Weather.hs: code clean up++Wed Jul 11 20:06:30 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * config-sample: eyes candy++Wed Jul 11 20:04:37 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * more unused stuff removed++Wed Jul 11 18:54:26 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated README to latest changes++Wed Jul 11 18:52:47 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Net.hs: removed parserc. Now using list function to parse+ Profiling shows that Net.hs and getNumbers specifically takes a huge ammount+ of resources. Hope to reduce them with this patch.++Wed Jul 11 18:50:35 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * removed from monitors code not used anymore++Wed Jul 11 18:48:19 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Net.hs: removed old code++Wed Jul 11 17:02:21 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * some colors please!+ Krzysztof says that we cannot set default colors without embedding a+ Turing-complete language in the templates, so that we can take account of+ different unit of measurement. May I set some colors in the configuration+ example??++Wed Jul 11 17:02:01 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * gettin' rid of Krzysztof's object-oriented attitude...;-)++Tue Jul 10 16:15:50 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Formatting usedratio in Monitors.Swap++Tue Jul 10 16:14:06 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Fix takeDigits so it doesn't use read.++Tue Jul 10 16:13:29 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Typos in Monitors.Common++Tue Jul 10 16:08:45 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Clean up default options for monitors.+ * Moved default configuration to Monitors.Common+ * Colors are optional and are off by default++Thu Jul 5 18:03:20 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Read default configuration from ~/.xmobarrc+ I am not sure if handling of other exceptions is acceptable, the assumption is+ that failure to read ~/.xmobarrc because of other errors than parsing should+ not blow up the whole program. Otherwise explicit test for file existence+ would be required etc.++Mon Jul 9 02:29:47 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * new working version and named colors in config-sample++Mon Jul 9 02:12:03 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * comments only++Mon Jul 9 01:43:04 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * fixes a bug in the copyArea function++Mon Jul 9 01:23:38 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added a short-hand for fromintegral (much used here)++Mon Jul 9 00:48:54 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * This should fix the flickering problem on window's updates++Sun Jul 8 20:37:42 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * typo++Sun Jul 8 19:13:30 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * editing to README++Sun Jul 8 19:13:09 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added info to Commands.hs++Sun Jul 8 12:28:41 CEST 2007 Andrea Rossato <andrea.rossatoo@unibz.it>+ tagged 0.5++Sun Jul 8 12:24:59 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated to version 0.5++Sun Jul 8 12:24:18 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated (I actually wrote some) documentation about configuring XMobar++Sun Jul 8 12:17:02 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * hope this fixes the "flickering text" problem reported by Krzysztof++Sun Jul 8 12:16:28 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * some monitors are now run internally++Sun Jul 8 12:14:30 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated configurations to reflect code changes++Sun Jul 8 12:12:08 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * the output template is now parsed with the help of a finite map+ This way we can quickly implement program name aliasing.++Sun Jul 8 12:10:33 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * monitors are now run internally++Sun Jul 8 12:03:20 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * better error handling when parsing weather information++Sun Jul 8 12:01:48 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * better error handling when parsing weather information++Sun Jul 8 12:01:20 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added runM to run monitors internally++Sun Jul 8 11:55:21 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added Commands+ Command is the data type for configuring command execution in XMobar. The+ idea came in a discussion with Spencer Janssen. At first XMobar was intended+ to be used only to display the output of external commands, but it came+ clear that the main performance bottle neck was running external programs.+ Now, some monitors are run internally, even if in separated threads. ++Fri Jul 6 03:01:24 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Add support for named colors.+ If bad color name is specified then exception is thrown by Xlib.+ This should be probably handled in a more elegant way.++Fri Jul 6 04:48:14 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Fix centered text align.++Thu Jul 5 22:47:21 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Swap: usedratio reported free ratio++Thu Jul 5 17:28:15 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Fix few config name typos++Thu Jul 5 17:04:07 CEST 2007 Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>+ * Add dependency on filepath++Thu Jul 5 15:28:14 CEST 2007 Andrea Rossato <andrea.rossatoo@unibz.it>+ tagged 0.4++Thu Jul 5 15:24:27 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated sample configuration++Thu Jul 5 15:22:21 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated to version 0.4 and added new monitors++Thu Jul 5 15:21:45 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated to use the new Common.hs++Thu Jul 5 15:21:15 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated to use the new Common.hs++Thu Jul 5 15:20:22 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added a swap monitor++Thu Jul 5 15:19:49 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated to use the new Common.hs and split the swap part in a new monitor++Thu Jul 5 15:19:15 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated Cpu.hs to work with the new Common.hs++Thu Jul 5 15:18:35 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added a small library for writing monitors++Thu Jul 5 15:17:49 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added a battery monitor++Thu Jul 5 15:16:11 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * minor++Thu Jun 28 00:13:46 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Cpu.hs more code clean up++Wed Jun 27 23:49:57 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Cpu.hs now requires -threaded++Wed Jun 27 23:49:13 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * typos++Wed Jun 27 23:45:31 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Cpu.hs: removed Parsec and switched to ByteString++Wed Jun 27 11:44:46 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * possibility to delay a thread for more than (maxBound :: Int) microseconds++Wed Jun 27 00:55:38 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * version 0.3.1++Wed Jun 27 00:52:34 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * default is Glasgow ;-)++Wed Jun 27 00:51:56 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * fixed an out of bount bug that could cause a flood to http://weather.noaa.gov/++Tue Jun 26 20:45:42 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * removed debug output++Tue Jun 26 20:07:14 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added cabal and config reference to the weather monitor++Tue Jun 26 20:06:27 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * corrected the threadDelay arguments++Tue Jun 26 20:05:37 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added a weather monitor to retrieve weather information from http://weather.noaa.gov/++Tue Jun 26 13:39:48 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * splitted files++Tue Jun 26 13:01:04 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * now the Xbar monad is similar to the one of XMonad++Tue Jun 26 11:44:52 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cosmetics++Tue Jun 26 11:43:57 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * Added -threaded option for ghc++Tue Jun 26 10:06:19 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added refresh rate config option for each command to be run++Tue Jun 26 09:42:39 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * now each command is run in a separate thread and MVars are used for interprocess communication++Tue Jun 26 07:17:47 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * better error handling++Tue Jun 26 07:16:22 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * createWin will now return Xbar (Display, Window)++Mon Jun 25 18:44:19 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated the README++Mon Jun 25 14:21:59 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * * fixes some memory leak problems+ After calling loadQueryFont the FontStruct returned must be freed after using it.+ runInteractiveProcess leaks memory. runInteractiveCommand does not.++Fri Jun 22 15:07:09 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * README and description++Fri Jun 22 14:53:03 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * updated example config++Fri Jun 22 14:52:29 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * cabal updates++Fri Jun 22 14:51:52 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added some monitors with output formatted for xmobar++Fri Jun 22 14:51:33 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * comments++Fri Jun 22 12:51:28 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * removed monitor.hs (useless now)++Fri Jun 22 12:48:52 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * big update: this is a status bar now+ Added a lot of features.++Tue Jun 19 19:40:06 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added a refresh rate configuration option++Tue Jun 19 12:52:35 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * haddock and other minor editing++Tue Jun 19 12:51:50 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added cabal support++Tue Jun 19 12:51:32 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added license (bsd3)++Tue Jun 19 11:12:16 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added a sample config file++Tue Jun 19 11:00:18 CEST 2007 Andrea Rossato <andrea.rossato@ing.unitn.it>+ * added license and some info++Tue Jun 19 10:07:45 CEST 2007 Andrea Rossato <andrea.rossatoo@unibz.it>+ * some changes to monitor.hs to test xmobar++Tue Jun 19 10:06:25 CEST 2007 Andrea Rossato <andrea.rossatoo@unibz.it>+ * added a monitoring script found here http://blog.csdn.net/danranx/archive/2007/06/10/1646608.aspx++Tue Jun 19 10:03:55 CEST 2007 Andrea Rossato <andrea.rossatoo@unibz.it>+ * init
Commands.hs view
@@ -3,7 +3,7 @@ -- Module : Xmobar.Commands -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable@@ -13,11 +13,15 @@ -- The 'Exec' class rappresents the executable types, whose constructors may -- appear in the 'Config.commands' field of the 'Config.Config' data type. ----- The 'Command' data type is for OS commands to be run by Xmobar +-- The 'Command' data type is for OS commands to be run by xmobar -- ----------------------------------------------------------------------------- -module Commands where+module Commands+ ( Command (..)+ , Exec (..)+ , tenthSeconds+ ) where import Control.Concurrent import Data.Char@@ -54,12 +58,12 @@ where go = do (i,o,e,p) <- runInteractiveCommand (prog ++ concat (map (' ':) args)) exit <- waitForProcess p- let closeHandles = do + let closeHandles = do hClose o hClose i hClose e case exit of- ExitSuccess -> do + ExitSuccess -> do str <- hGetLine o closeHandles cb str
Config.hs view
@@ -3,22 +3,23 @@ -- Module : Xmobar.Config -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable ----- The configuration module of Xmobar, a text based status bar +-- The configuration module of Xmobar, a text based status bar -- ----------------------------------------------------------------------------- -module Config ( -- * Configuration- -- $config- Config (..)- , XPosition (..), Align (..)- , defaultConfig- , runnableTypes- ) where+module Config+ ( -- * Configuration+ -- $config+ Config (..)+ , XPosition (..), Align (..)+ , defaultConfig+ , runnableTypes+ ) where import Commands import {-# SOURCE #-} Runnable@@ -31,20 +32,25 @@ -- Configuration data type and default configuration -- | The configuration data type-data Config = +data Config = Config { font :: String -- ^ Font , bgColor :: String -- ^ Backgroud color , fgColor :: String -- ^ Default font color , position :: XPosition -- ^ Top Bottom or Static- , commands :: [Runnable] -- ^ For setting the command, the command argujments + , commands :: [Runnable] -- ^ For setting the command, the command argujments -- and refresh rate for the programs to run (optional) , sepChar :: String -- ^ The character to be used for indicating -- commands in the output template (default '%') , alignSep :: String -- ^ Separators for left, center and right text alignment- , template :: String -- ^ The output template + , template :: String -- ^ The output template } deriving (Read) -data XPosition = Top | TopW Align Int | Bottom | BottomW Align Int | Static {xpos, ypos, width, height :: Int} deriving ( Read, Eq )+data XPosition = Top+ | TopW Align Int+ | Bottom+ | BottomW Align Int+ | Static {xpos, ypos, width, height :: Int}+ deriving ( Read, Eq ) data Align = L | R | C deriving ( Read, Eq ) @@ -55,10 +61,11 @@ , bgColor = "#000000" , fgColor = "#BFBFBF" , position = Top- , commands = []+ , commands = [ Run $ Date "%a %b %_d %Y * %H:%M:%S" "theDate" 10+ , Run StdinReader] , sepChar = "%" , alignSep = "}{"- , template = "Uptime: <fc=#00FF00>%uptime%</fc> }{ <fc=#FF0000>%date%</fc>"+ , template = "%StdinReader% }{ <fc=#00FF00>%uname%</fc> * <fc=#FF0000>%theDate%</fc>" } -- | This is the list of types that can be hidden inside
Main.hs view
@@ -3,12 +3,12 @@ -- Module : Xmobar.Main -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable ----- The main module of Xmobar, a text based status bar +-- The main module of Xmobar, a text based status bar -- ----------------------------------------------------------------------------- @@ -22,8 +22,11 @@ import Xmobar import Parsers import Config+import XUtil +import Paths_xmobar (version) import Data.IORef+import Data.Version (showVersion) import Graphics.X11.Xlib import System.Console.GetOpt import System.Exit@@ -31,7 +34,7 @@ import System.Posix.Files -- $main- + -- | The main entry point main :: IO () main = do@@ -46,22 +49,21 @@ rootw <- rootWindow d (defaultScreen d) selectInput d rootw structureNotifyMask - civ <- newIORef c+ civ <- newIORef c doOpts civ o- conf <- readIORef civ- let loadFont = loadQueryFont d . font- fs <- catch (loadFont conf) (const $ loadFont defaultConfig)- cl <- parseTemplate conf (template conf)- vars <- mapM startCommand cl- (r,w) <- createWin d fs conf+ conf <- readIORef civ+ fs <- initFont d (font conf)+ cl <- parseTemplate conf (template conf)+ vars <- mapM startCommand cl+ (r,w) <- createWin d fs conf eventLoop (XConf d r w fs conf) vars- freeFont d fs+ releaseFont d fs -- | Reads the configuration files or quits with an error readConfig :: FilePath -> IO Config readConfig f = do file <- fileExist f- s <- if file then readFile f else error $ f ++ ": file not found!\n" ++ usage+ s <- if file then readFileSafe f else error $ f ++ ": file not found!\n" ++ usage case reads s of [(conf,_)] -> return conf [] -> error $ f ++ ": configuration file contains errors!\n" ++ usage@@ -76,7 +78,7 @@ if f then readConfig path else return defaultConfig data Opts = Help- | Version + | Version | Font String | BgColor String | FgColor String@@ -85,9 +87,9 @@ | AlignSep String | Commands String | SepChar String- | Template String + | Template String deriving Show- + options :: [OptDescr Opts] options = [ Option ['h','?' ] ["help" ] (NoArg Help ) "This help"@@ -95,16 +97,16 @@ , Option ['f' ] ["font" ] (ReqArg Font "font name") "The font name" , Option ['B' ] ["bgcolor" ] (ReqArg BgColor "bg color" ) "The background color. Default black" , Option ['F' ] ["fgcolor" ] (ReqArg FgColor "fg color" ) "The foreground color. Default grey"- , Option ['o' ] ["top" ] (NoArg T ) "Place Xmobar at the top of the screen"- , Option ['b' ] ["bottom" ] (NoArg B ) "Place Xmobar at the bottom of the screen"+ , Option ['o' ] ["top" ] (NoArg T ) "Place xmobar at the top of the screen"+ , Option ['b' ] ["bottom" ] (NoArg B ) "Place xmobar at the bottom of the screen" , Option ['a' ] ["alignsep" ] (ReqArg AlignSep "alignsep" ) "Separators for left, center and right text\nalignment. Default: '}{'" , Option ['s' ] ["sepchar" ] (ReqArg SepChar "char" ) "The character used to separate commands in\nthe output template. Default '%'"- , Option ['t' ] ["template" ] (ReqArg Template "tempate" ) "The output template"+ , Option ['t' ] ["template" ] (ReqArg Template "template" ) "The output template" , Option ['c' ] ["commands" ] (ReqArg Commands "commands" ) "The list of commands to be executed" ] getOpts :: [String] -> IO ([Opts], [String])-getOpts argv = +getOpts argv = case getOpt Permute options argv of (o,n,[]) -> return (o,n) (_,_,errs) -> error (concat errs ++ usage)@@ -114,11 +116,11 @@ where header = "Usage: xmobar [OPTION...] [FILE]\nOptions:" footer = "\nMail bug reports and suggestions to " ++ mail -version :: String-version = "Xmobar 0.8 (C) 2007 Andrea Rossato " ++ mail ++ license+info :: String+info = "xmobar " ++ showVersion version ++ " (C) 2007 - 2008 Andrea Rossato " ++ mail ++ license mail :: String-mail = "<andrea.rossato@unibz.it>\n"+mail = "<andrea.rossato@ing.unitn.it>\n" license :: String license = "\nThis program is distributed in the hope that it will be useful,\n" ++@@ -130,8 +132,8 @@ doOpts _ [] = return () doOpts conf (o:oo) = case o of- Help -> putStr usage >> exitWith ExitSuccess- Version -> putStrLn version >> exitWith ExitSuccess+ Help -> putStr usage >> exitWith ExitSuccess+ Version -> putStrLn info >> exitWith ExitSuccess Font s -> modifyIORef conf (\c -> c { font = s }) >> go BgColor s -> modifyIORef conf (\c -> c { bgColor = s }) >> go FgColor s -> modifyIORef conf (\c -> c { fgColor = s }) >> go@@ -141,7 +143,7 @@ SepChar s -> modifyIORef conf (\c -> c { sepChar = s }) >> go Template s -> modifyIORef conf (\c -> c { template = s }) >> go Commands s -> case readCom s of- Right x -> modifyIORef conf (\c -> c { commands = x }) >> go + Right x -> modifyIORef conf (\c -> c { commands = x }) >> go Left e -> putStr (e ++ usage) >> exitWith (ExitFailure 1) where readCom str = case readStr str of
Parsers.hs view
@@ -3,7 +3,7 @@ -- Module : Xmobar.Parsers -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable@@ -12,18 +12,16 @@ -- ----------------------------------------------------------------------------- -module Parsers (- -- * Parsing- -- $parser- parseString- , stringParser- , defaultColors- , colorsAndText- , templateStringParser- , templateCommandParser- , templateParser- , parseTemplate- ) where+module Parsers+ ( parseString+ , stringParser+ , colorParser+ , colorsAndText+ , templateStringParser+ , templateCommandParser+ , templateParser+ , parseTemplate+ ) where import Config import Commands@@ -31,89 +29,79 @@ import Text.ParserCombinators.Parsec import qualified Data.Map as Map --{- $parser-These are the neede parsers. Don't trust them too much.--There are parsers for the commands output and parsers for the-formatting template.- -}---- | Runs the actual string parsers+-- | Runs the string parser parseString :: Config -> String -> IO [(String, String)]-parseString config s = - case (parse (stringParser config) "" s) of- Left _ -> return [("Could not parse string: " ++ s- , (fgColor config))]- Right x -> return x+parseString c s =+ case parse (stringParser c) "" s of+ Left _ -> return [("Could not parse string: " ++ s, fgColor c)]+ Right x -> return (concat x) -- | Gets the string and combines the needed parsers-stringParser :: Config -> Parser [(String, String)]-stringParser c = manyTill (colorsAndText c <|> defaultColors c) eof+stringParser :: Config -> Parser [[(String, String)]]+stringParser = flip manyTill eof . colorParser -- | Parses a string with the default color (no color set)-defaultColors :: Config -> Parser (String, String)-defaultColors config = - do { s <- many $ noneOf "<"- ; return (s,(fgColor config))- }- <|> colorsAndText config+colorParser :: Config -> Parser [(String, String)]+colorParser c = do+ s <- manyTill anyChar (tryString "<fc" <|> endOfLine "")+ n <- colorsAndText <|> endOfLine ("","")+ return [(s,fgColor c),n] -- | Parses a string with a color set-colorsAndText :: Config -> Parser (String, String) -colorsAndText config = - do { string "<fc="- ; c <- colorSpec- ; string ">"- ; s <- many $ noneOf "<"- ; string "</fc>"- ; return (s,c)- }- <|> defaultColors config+colorsAndText :: Parser (String, String)+colorsAndText = do+ c <- inside (string "=") colors (string ">")+ s <- manyTill anyChar (tryString "</fc>")+ return (s,c) -- | Parses a color specification (hex or named)-colorSpec :: Parser String-colorSpec =- many1 (alphaNum <|> char ',' <|> char '#')+colors :: Parser String+colors = many1 (alphaNum <|> char ',' <|> char '#') -- | Parses the output template string templateStringParser :: Config -> Parser (String,String,String)-templateStringParser c =- do{ s <- many $ noneOf (sepChar c)- ; (com,_,_) <- templateCommandParser c- ; ss <- many $ noneOf (sepChar c)- ; return (com, s, ss)- } +templateStringParser c = do+ s <- allTillSep c+ com <- templateCommandParser c+ ss <- allTillSep c+ return (com, s, ss) -- | Parses the command part of the template string-templateCommandParser :: Config -> Parser (String,String,String)+templateCommandParser :: Config -> Parser String templateCommandParser c =- do { let chr = head $ sepChar c- ; char chr- ; com <- many $ noneOf (sepChar c)- ; char chr- ; return $ (com,"","")- } + let chr = char . head . sepChar+ in inside (chr c) (allTillSep c) (chr c) -- | Combines the template parsers templateParser :: Config -> Parser [(String,String,String)]-templateParser c = many (templateStringParser c)+templateParser = many . templateStringParser -- | Actually runs the template parsers parseTemplate :: Config -> String -> IO [(Runnable,String,String)]-parseTemplate config s = - do str <- case (parse (templateParser config) "" s) of+parseTemplate c s =+ do str <- case parse (templateParser c) "" s of Left _ -> return [("","","")] Right x -> return x- let comList = map alias (commands config)- m = Map.fromList $ zip comList (commands config)- return $ combine config m str+ let cl = map alias (commands c)+ m = Map.fromList $ zip cl (commands c)+ return $ combine c m str -- | Given a finite "Map" and a parsed templatet produces the -- | resulting output string. combine :: Config -> Map.Map String Runnable -> [(String, String, String)] -> [(Runnable,String,String)] combine _ _ [] = []-combine config m ((ts,s,ss):xs) = - [(com, s, ss)] ++ combine config m xs- where com = Map.findWithDefault dflt ts m- dflt = Run $ Com ts [] [] 10+combine c m ((ts,s,ss):xs) = (com, s, ss) : combine c m xs+ where com = Map.findWithDefault dflt ts m+ dflt = Run $ Com ts [] [] 10++endOfLine :: a -> Parser a+endOfLine r = eof >> return r++tryString :: String -> Parser String+tryString = try . string++allTillSep :: Config -> Parser String+allTillSep = many . noneOf . sepChar++inside :: Parser a -> Parser b -> Parser c -> Parser b+inside pa pb pc = pa >> pb >>= \r -> pc >> return r
Plugins.hs view
@@ -3,7 +3,7 @@ -- Module : Xmobar.Plugins -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable@@ -14,8 +14,12 @@ -- ----------------------------------------------------------------------------- -module Plugins ( Exec (..)- , tenthSeconds- ) where+module Plugins+ ( Exec (..)+ , tenthSeconds+ , readFileSafe+ , hGetLineSafe+ ) where import Commands+import XUtil
Plugins/Date.hs view
@@ -3,16 +3,17 @@ -- Module : Plugins.Date -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable -- -- A date plugin for Xmobar ----- Usage example: in template put --- Run Date "%a %b %_d %Y <fc=#ee9a00> %H:%M:%S</fc>" "mydate" 10+-- Usage example: in template put --+-- > Run Date "%a %b %_d %Y <fc=#ee9a00> %H:%M:%S</fc>" "Mydate" 10+-- ----------------------------------------------------------------------------- module Plugins.Date where@@ -31,6 +32,6 @@ rate (Date _ _ r) = r date :: String -> IO String-date format = do +date format = do t <- toCalendarTime =<< getClockTime return $ formatCalendarTime defaultTimeLocale format t
Plugins/Monitors.hs view
@@ -3,7 +3,7 @@ -- Module : Xmobar.Plugins.Monitors -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable@@ -23,32 +23,48 @@ import Plugins.Monitors.Swap import Plugins.Monitors.Cpu import Plugins.Monitors.Batt+import Plugins.Monitors.Thermal+import Plugins.Monitors.CpuFreq+import Plugins.Monitors.CoreTemp -data Monitors = Weather Station Args Rate+data Monitors = Weather Station Args Rate | Network Interface Args Rate- | Memory Args Rate- | Swap Args Rate- | Cpu Args Rate- | Battery Args Rate+ | Memory Args Rate+ | Swap Args Rate+ | Cpu Args Rate+ | Battery Args Rate+ | BatteryP [String] Args Rate+ | Thermal Zone Args Rate+ | CpuFreq Args Rate+ | CoreTemp Args Rate deriving (Show,Read,Eq) type Args = [String] type Program = String type Alias = String type Station = String+type Zone = String type Interface = String type Rate = Int instance Exec Monitors where- alias (Weather s _ _) = s- alias (Network i _ _) = i- alias (Memory _ _) = "memory"- alias (Swap _ _) = "swap"- alias (Cpu _ _) = "cpu"- alias (Battery _ _) = "battery"- start (Weather s a r) = runM (a ++ [s]) weatherConfig runWeather r- start (Network i a r) = runM (a ++ [i]) netConfig runNet r- start (Memory a r) = runM a memConfig runMem r- start (Swap a r) = runM a swapConfig runSwap r- start (Cpu a r) = runM a cpuConfig runCpu r- start (Battery a r) = runM a battConfig runBatt r+ alias (Weather s _ _) = s+ alias (Network i _ _) = i+ alias (Thermal z _ _) = z+ alias (Memory _ _) = "memory"+ alias (Swap _ _) = "swap"+ alias (Cpu _ _) = "cpu"+ alias (Battery _ _) = "battery"+ alias (BatteryP _ _ _)= "battery"+ alias (CpuFreq _ _) = "cpufreq"+ alias (CoreTemp _ _) = "coretemp"+ start (Weather s a r) = runM (a ++ [s]) weatherConfig runWeather r+ start (Network i a r) = runM (a ++ [i]) netConfig runNet r+ start (Thermal z a r) = runM (a ++ [z]) thermalConfig runThermal r+ start (Memory a r) = runM a memConfig runMem r+ start (Swap a r) = runM a swapConfig runSwap r+ start (Cpu a r) = runM a cpuConfig runCpu r+ start (Battery a r) = runM a battConfig runBatt r+ start (BatteryP s a r) = runM a battConfig (runBatt' s) r+ start (CpuFreq a r) = runM a cpuFreqConfig runCpuFreq r+ start (CoreTemp a r) = runM a coreTempConfig runCoreTemp r
Plugins/Monitors/Batt.hs view
@@ -3,7 +3,7 @@ -- Module : Plugins.Monitors.Batt -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable@@ -18,7 +18,7 @@ import Plugins.Monitors.Common import System.Posix.Files (fileExist) -data Batt = Batt Float +data Batt = Batt Float | NA battConfig :: IO MConfig@@ -26,17 +26,11 @@ "Batt: <left>" -- template ["left"] -- available replacements -fileB0 :: (String, String)-fileB0 = ("/proc/acpi/battery/BAT0/info", "/proc/acpi/battery/BAT0/state")--fileB1 :: (String, String)-fileB1 = ("/proc/acpi/battery/BAT1/info", "/proc/acpi/battery/BAT1/state")--fileB2 :: (String, String)-fileB2 = ("/proc/acpi/battery/BAT2/info", "/proc/acpi/battery/BAT2/state")+file2batfile :: String -> (String, String)+file2batfile s = ("/proc/acpi/battery/"++ s ++ "/info", "/proc/acpi/battery/"++ s ++ "/state") readFileBatt :: (String, String) -> IO (B.ByteString, B.ByteString)-readFileBatt (i,s) = +readFileBatt (i,s) = do a <- rf i b <- rf s return (a,b)@@ -44,11 +38,9 @@ f <- fileExist file if f then B.readFile file else return B.empty -parseBATT :: IO Batt-parseBATT =- do (a0,b0) <- readFileBatt fileB0- (a1,b1) <- readFileBatt fileB1- (a2,b2) <- readFileBatt fileB2+parseBATT :: [(String, String)] -> IO Batt+parseBATT bfs =+ do [(a0,b0),(a1,b1),(a2,b2)] <- mapM readFileBatt (take 3 $ bfs ++ repeat ("","")) let sp p s = case stringParser p s of [] -> 0 x -> read x@@ -58,16 +50,19 @@ left = (p0 + p1 + p2) / (f0 + f1 + f2) --present / full return $ if isNaN left then NA else Batt left -formatBatt :: Float -> Monitor [String] +formatBatt :: Float -> Monitor [String] formatBatt x = do let f s = floatToPercent (s / 100) l <- showWithColors f (x * 100) return [l] runBatt :: [String] -> Monitor String-runBatt _ =- do c <- io $ parseBATT- case c of- Batt x -> do l <- formatBatt x- parseTemplate l - NA -> return "N/A"+runBatt = runBatt' ["BAT0","BAT1","BAT2"]++runBatt' :: [String] -> [String] -> Monitor String+runBatt' bfs _ = do+ c <- io $ parseBATT (map file2batfile bfs)+ case c of+ Batt x -> do l <- formatBatt x+ parseTemplate l+ NA -> return "N/A"
+ Plugins/Monitors/CoreCommon.hs view
@@ -0,0 +1,52 @@+-----------------------------------------------------------------------------+-- |+-- Module : Plugins.Monitors.CoreCommon+-- Copyright : (c) Juraj Hercek+-- License : BSD-style (see LICENSE)+--+-- Maintainer : Juraj Hercek <juhe_haskell@hck.sk>+-- Stability : unstable+-- Portability : unportable+--+-- The common part for cpu core monitors (e.g. cpufreq, coretemp)+--+-----------------------------------------------------------------------------++module Plugins.Monitors.CoreCommon where++import Plugins.Monitors.Common+import System.Posix.Files (fileExist)+import System.Directory+import Data.Char (isDigit)+import Data.List (isPrefixOf)++-- |+-- Function checks the existence of first file specified by pattern and if the+-- file doesn't exists failure message is shown, otherwise the data retrieval+-- is performed.+checkedDataRetrieval :: String -> String -> String -> String -> Double -> Monitor String+checkedDataRetrieval failureMessage dir file pattern divisor = do+ exists <- io $ fileExist $ foldl (++) dir ["/", pattern, "0/", file]+ case exists of+ False -> return failureMessage+ True -> retrieveData dir file pattern divisor++-- |+-- Function retrieves data from files in directory dir specified by pattern.+-- String values are converted to double and adjusted with divisor. Final array+-- is processed by template parser function and returned as monitor string.+retrieveData :: String -> String -> String -> Double -> Monitor String+retrieveData dir file pattern divisor = do+ count <- io $ dirCount dir pattern+ contents <- io $ mapM readFile $ files count+ values <- mapM (showWithColors show) $ map conversion contents+ parseTemplate values+ where+ dirCount path str = getDirectoryContents path+ >>= return . length+ . filter (\s -> str `isPrefixOf` s+ && isDigit (last s))+ files count = [ foldl (++) dir [ "/", pattern, show i, "/", file ]+ | i <- [0 .. count - 1] ]+ conversion = flip (/) divisor . (read :: String -> Double)+
+ Plugins/Monitors/CoreTemp.hs view
@@ -0,0 +1,41 @@+-----------------------------------------------------------------------------+-- |+-- Module : Plugins.Monitors.CoreTemp+-- Copyright : (c) Juraj Hercek+-- License : BSD-style (see LICENSE)+--+-- Maintainer : Juraj Hercek <juhe_haskell@hck.sk>+-- Stability : unstable+-- Portability : unportable+--+-- A core temperature monitor for Xmobar+--+-----------------------------------------------------------------------------++module Plugins.Monitors.CoreTemp where++import Plugins.Monitors.Common+import Plugins.Monitors.CoreCommon++-- |+-- Core temperature default configuration. Default template contains only one+-- core temperature, user should specify custom template in order to get more+-- core frequencies.+coreTempConfig :: IO MConfig+coreTempConfig = mkMConfig+ "Temp: <core0>C" -- template+ (zipWith (++) (repeat "core") (map show [0 :: Int ..])) -- available+ -- replacements++-- |+-- Function retrieves monitor string holding the core temperature+-- (or temperatures)+runCoreTemp :: [String] -> Monitor String+runCoreTemp _ = do+ let dir = "/sys/bus/platform/devices"+ file = "temp1_input"+ pattern = "coretemp."+ divisor = 1e3 :: Double+ failureMessage = "CoreTemp: N/A"+ checkedDataRetrieval failureMessage dir file pattern divisor+
+ Plugins/Monitors/CpuFreq.hs view
@@ -0,0 +1,40 @@+-----------------------------------------------------------------------------+-- |+-- Module : Plugins.Monitors.CpuFreq+-- Copyright : (c) Juraj Hercek+-- License : BSD-style (see LICENSE)+--+-- Maintainer : Juraj Hercek <juhe_haskell@hck.sk>+-- Stability : unstable+-- Portability : unportable+--+-- A cpu frequency monitor for Xmobar+--+-----------------------------------------------------------------------------++module Plugins.Monitors.CpuFreq where++import Plugins.Monitors.Common+import Plugins.Monitors.CoreCommon++-- |+-- Cpu frequency default configuration. Default template contains only one+-- core frequency, user should specify custom template in order to get more+-- cpu frequencies.+cpuFreqConfig :: IO MConfig+cpuFreqConfig = mkMConfig+ "Freq: <cpu0>GHz" -- template+ (zipWith (++) (repeat "cpu") (map show [0 :: Int ..])) -- available+ -- replacements++-- |+-- Function retrieves monitor string holding the cpu frequency (or frequencies)+runCpuFreq :: [String] -> Monitor String+runCpuFreq _ = do+ let dir = "/sys/devices/system/cpu"+ file = "cpufreq/scaling_cur_freq"+ pattern = "cpu"+ divisor = 1e6 :: Double+ failureMessage = "CpuFreq: N/A"+ checkedDataRetrieval failureMessage dir file pattern divisor+
+ Plugins/Monitors/Thermal.hs view
@@ -0,0 +1,42 @@+-----------------------------------------------------------------------------+-- |+-- Module : Plugins.Monitors.Thermal+-- Copyright : (c) Juraj Hercek+-- License : BSD-style (see LICENSE)+--+-- Maintainer : Juraj Hercek <juhe_haskell@hck.sk>+-- Stability : unstable+-- Portability : unportable+--+-- A thermal monitor for Xmobar+--+-----------------------------------------------------------------------------++module Plugins.Monitors.Thermal where++import qualified Data.ByteString.Lazy.Char8 as B+import Plugins.Monitors.Common+import System.Posix.Files (fileExist)++-- | Default thermal configuration.+thermalConfig :: IO MConfig+thermalConfig = mkMConfig+ "Thm: <temp>C" -- template+ ["temp"] -- available replacements++-- | Retrieves thermal information. Argument is name of thermal directory in+-- \/proc\/acpi\/thermal_zone. Returns the monitor string parsed according to+-- template (either default or user specified).+runThermal :: [String] -> Monitor String+runThermal args = do+ let zone = head args+ file = "/proc/acpi/thermal_zone/" ++ zone ++ "/temperature"+ exists <- io $ fileExist file+ case exists of+ False -> return $ "Thermal (" ++ zone ++ "): N/A"+ True -> do number <- io $ B.readFile file+ >>= return . (read :: String -> Int)+ . stringParser (1, 0)+ thermal <- showWithColors show number+ parseTemplate [ thermal ]+
Plugins/Monitors/Weather.hs view
@@ -16,6 +16,7 @@ import Plugins.Monitors.Common +import Control.Monad (when) import System.Process import System.Exit import System.IO@@ -45,18 +46,18 @@ data WeatherInfo = WI { stationPlace :: String , stationState :: String- , year :: String- , month :: String- , day :: String- , hour :: String- , wind :: String- , visibility :: String+ , year :: String+ , month :: String+ , day :: String+ , hour :: String+ , wind :: String+ , visibility :: String , skyCondition :: String- , tempC :: Int- , tempF :: Int- , dewPoint :: String- , humidity :: Int- , pressure :: Int+ , tempC :: Int+ , tempF :: Int+ , dewPoint :: String+ , humidity :: Int+ , pressure :: Int } deriving (Show) pTime :: Parser (String, String, String, String)@@ -71,9 +72,10 @@ return (y, m, d ,([h]++[hh]++":"++[mi]++mimi)) pTemp :: Parser (Int, Int)-pTemp = do f <- manyTill (digit <|> char '.') $ char ' '+pTemp = do let num = digit <|> char '-' <|> char '.'+ f <- manyTill num $ char ' ' manyTill anyChar $ char '('- c <- manyTill digit $ (char ' ' <|> char '.')+ c <- manyTill num $ char ' ' skipRestOfLine return $ (floor (read c :: Double), floor (read f :: Double)) @@ -119,6 +121,8 @@ hClose e case exit of ExitSuccess -> do str <- hGetContents o+ when (str == str) $ return ()+ closeHandles return str _ -> do closeHandles return "Could not retrieve data"
Plugins/PipeReader.hs view
@@ -3,7 +3,7 @@ -- Module : Plugins.PipeReader -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable@@ -20,9 +20,9 @@ data PipeReader = PipeReader String String deriving (Read, Show) -instance Exec PipeReader where +instance Exec PipeReader where alias (PipeReader _ a) = a start (PipeReader p _) cb = do h <- openFile p ReadMode- forever (hGetLine h >>= cb)+ forever (hGetLineSafe h >>= cb) where forever a = a >> forever a
Plugins/StdinReader.hs view
@@ -26,7 +26,7 @@ instance Exec StdinReader where start StdinReader cb = do- cb =<< catch (hGetLine stdin) (\e -> do hPrint stderr e; return "")+ cb =<< catch (hGetLineSafe stdin) (\e -> do hPrint stderr e; return "") eof <- hIsEOF stdin if eof then exitImmediately ExitSuccess
README view
@@ -1,25 +1,27 @@-% Xmobar - A Minimalistic Text Based Status Bar+% xmobar - A Minimalistic Text Based Status Bar % Andrea Rossato About ----- -[Xmobar] is a minimalistic, text based, status bar. It was designed to-work with the [XMonad] Window Manager.+[xmobar] is a minimalistic, text based, status bar. It was designed to+work with the [xmonad] Window Manager. It was inspired by the [Ion3] status bar, and supports similar features, like dynamic color management, output templates, and extensibility through plugins. -[This is a screen shot] of my desktop with [XMonad] and [Xmobar].+[This is a screen shot] of my desktop with [xmonad] and [xmobar]. +[xmobar] supports XFT and UTF-8 locales.+ See `xmobar.config-sample`, distributed with the source code, for a sample configuration. Download -------- -You can get the [Xmobar] source code from [Hackage].+You can get the [xmobar] source code from [Hackage]. To get the darcs source run: @@ -27,35 +29,39 @@ The latest binary can be found here: - http://code.haskell.org/~arossato/xmobar/xmobar-0.8.bin+ http://code.haskell.org/~arossato/xmobar/xmobar-0.9.bin A recent screen shot can be found here: - http://code.haskell.org/~arossato/xmobar/xmobar-0.8.png--Version 0.8 requires Cabal-1.2.x, but works both with ghc-6.6.1 and-ghc-6.8.1.--[Here you can find] a source tree of xmobar-0.8 which works with-Cabal-1.1.x, but compiles only with ghc-6.6.x:-- http://code.haskell.org/~arossato/xmobar/xmobar-0.8-Cabal-1.1-ghc-6.6.tar.gz+ http://code.haskell.org/~arossato/xmobar/xmobar-0.9.png -[Here you can find]: http://code.haskell.org/~arossato/xmobar/xmobar-0.8-Cabal-1.1-ghc-6.6.tar.gz+Version 0.9 requires Cabal-1.2.x, but should work both with ghc-6.6.1+and ghc-6.8.1. Installation ------------ To install simply run: - tar xvfz xmobar-0.8- cd xmobar-0.8- runhaskell Setup.lhs configure --prefix=/usr/local+ tar xvfz xmobar-0.9+ cd xmobar-0.9++Then run the configure script:++ runhaskell Setup.lhs configure++ # To enable UTF-8 support run:+ runhaskell Setup.lhs configure --flags="with_utf8"++ # To enable both XFT and UTF-8 support run:+ runhaskell Setup.lhs configure --flags="with_xft"++Now you can build the source:+ runhaskell Setup.lhs build- runhaskell Setup.lhs haddock --executables # optional runhaskell Setup.lhs install # possibly to be run as root -Run with:+You can now run [xmobar] with: xmobar /path/to/config & @@ -65,6 +71,30 @@ if you have the default configuration file saved as `~/.xmobarrc` +Utf-8 and Xft Support+---------------------++[xmobar] can be compiled with UTF-8 and XFT support. If you want UTF-8+support only, you just need to run the configuration script with the+`"with_utf"` flag:++ runhaskell Setup.lhs configure --flags="with_utf8"++This requires the presence of [utf8-string] package.++XFT support, which will also enable UTF-8 support, requires the+[X11-xft] package too and is enabled by running the configuration+script with the `"with_xft"` flag:++ runhaskell Setup.lhs configure --flags="with_xft"++Then build [xmobar] as usual.++To use XFT fonts you need to use the `xft:` prefix in the `font`+configuration option. For instance:++ font = "xft:Times New Roman-10:italic"+ Configuration ------------- @@ -83,27 +113,27 @@ Other configuration options: `font`-: Name of the font to be used+: Name of the font to be used. Use the `xft:` prefix for XFT fonts. -`bgColor` -: Background color+`bgColor`+: Background color. -`fgColor` -: Default font color+`fgColor`+: Default font color. `position` : Top, TopW, Bottom, BottomW or Static (with x, y, width and height). : TopW and BottomW take 2 arguments: an alignment parameter (L for left, C for centered, R for Right) and an integer for the- percentage width Xmobar window will have in respect to the- screen width+ percentage width xmobar window will have in respect to the+ screen width. : For example: -: position = Bottom C 75+: position = BottomW C 75 -: to place Xmobar at the bottom, centered with the 75% of the screen width. +: to place xmobar at the bottom, centered with the 75% of the screen width. : Or @@ -114,24 +144,24 @@ : position = Top `commands`-: For setting the options of the programs to run (optional)+: For setting the options of the programs to run (optional). -`sepChar` +`sepChar` : The character to be used for indicating commands in the output- template (default '%')+ template (default '%'). `alignSep` : a 2 character string for aligning text in the output template. The text before the first character will be align to left, the text in between the 2 characters will be centered, and the text after the- second character will be align to the right. + second character will be align to the right. `template`-: The output template+: The output template. ### Command Line Options -[Xmobar] can be either configured with a configuration file or with+[xmobar] can be either configured with a configuration file or with command line options. In the second case, the command line options will overwrite the corresponding options set in the configuration file.@@ -140,7 +170,7 @@ xmobar -B white -a right -F blue -t '%LIPB%' -c '[Run Weather "LIPB" [] 36000]' -This is the list of command line options (the output of +This is the list of command line options (the output of xmobar --help): Usage: xmobar [OPTION...] [FILE]@@ -150,36 +180,36 @@ -f font name --font=font name The font name -B bg color --bgcolor=bg color The background color. Default black -F fg color --fgcolor=fg color The foreground color. Default grey- -o --top Place Xmobar at the top of the screen- -b --bottom Place Xmobar at the bottom of the screen+ -o --top Place xmobar at the top of the screen+ -b --bottom Place xmobar at the bottom of the screen -a alignsep --alignsep=alignsep Separators for left, center and right text alignment. Default: '}{' -s char --sepchar=char The character used to separate commands in the output template. Default '%'- -t tempate --template=tempate The output template+ -t template --template=template The output template -c commands --commands=commands The list of commands to be executed Mail bug reports and suggestions to <andrea.rossato@unibz.it> ### The Output Template -The output template must contain at least one command. [Xmobar] will+The output template must contain at least one command. [xmobar] will parse the template and will search for the command to be executed in the `commands` configuration option. First an `alias` will be searched (plugins such as Weather or Network have default aliases, see below). After that, the command name will be tried. If a command is found, the arguments specified in the `commands` list will be used. -If no command is found in the `commands` list, [Xmobar] will ask the+If no command is found in the `commands` list, [xmobar] will ask the operating system to execute a program with the name found in the template. If the execution is not successful an error will be reported.- + ### The `commands` Configuration Option The `commands` configuration option is a list of commands information-and arguments to be used by [Xmobar] when parsing the output template.+and arguments to be used by [xmobar] when parsing the output template. Each member of the list consists in a command prefixed by the `Run`-keyword. Each command has arguments to control the way [Xmobar] is going+keyword. Each command has arguments to control the way [xmobar] is going to execute it. The option consists in a list of commands separated by a comma and@@ -194,11 +224,11 @@ The only internal available command is `Com` (see below Executing External Commands). All other commands are provided by plugins.-[Xmobar] comes with some plugins, providing a set of system monitors,+[xmobar] comes with some plugins, providing a set of system monitors, a standard input reader, an Unix named pipe reader, and a configurable date plugin. These plugins install the following internal commands:-`Weather`, `Network`, `Memory`, `Swap`, `Cpu`, `Battery`, `Date`,-`StdinReader`, and `PipeReader`.+`Weather`, `Network`, `Memory`, `Swap`, `Cpu`, `Battery`, `Thermal`,+`CpuFreq`, `CoreTemp`, `Date`, `StdinReader` and `PipeReader`. To remove them see below Installing/Removing a Plugin @@ -217,17 +247,19 @@ - aliases to the Station ID: so `Weather "LIPB" []` can be used in template as `%LIBP%` - Args: the argument list (see below)-- Variables that can be used with the `-t`/`--template` argument: +- Variables that can be used with the `-t`/`--template` argument: `station`, `stationState`, `year`, `month`, `day`, `hour`, `wind`, `visibility`, `skyCondition`, `tempC`, `tempF`, `dewPoint`, `rh`, `pressure` - Default template: `<station>: <tempC>C, rh <rh>% (<hour>)`+- Requires `curl` in the `$PATH` to retrieve weather information from+ `http://weather.noaa.gov` `Network Interface Args RefreshRate` - aliases to the interface name: so `Network "eth0" []` can be used as `%eth0%` - Args: the argument list (see below)-- Variables that can be used with the `-t`/`--template` argument: +- Variables that can be used with the `-t`/`--template` argument: `dev`, `rx`, `tx` - Default template: `<dev>: <rx>|<tx>` @@ -235,7 +267,7 @@ - aliases to `memory` - Args: the argument list (see below)-- Variables that can be used with the `-t`/`--template` argument: +- Variables that can be used with the `-t`/`--template` argument: `total`, `free`, `buffer`, `cache`, `rest`, `used`, `usedratio` - Default template: `Mem: <usedratio>% (<cache>M)` @@ -243,7 +275,7 @@ - aliases to `swap` - Args: the argument list (see below)-- Variables that can be used with the `-t`/`--template` argument: +- Variables that can be used with the `-t`/`--template` argument: `total`, `used`, `free`, `usedratio` - Default template: `Swap: <usedratio>%` @@ -251,7 +283,7 @@ - aliases to `cpu` - Args: the argument list (see below)-- Variables that can be used with the `-t`/`--template` argument: +- Variables that can be used with the `-t`/`--template` argument: `total`, `user`, `nice`, `system`, `idle` - Default template: `Cpu: <total>` @@ -259,10 +291,53 @@ - aliases to `battery` - Args: the argument list (see below)-- Variables that can be used with the `-t`/`--template` argument: +- Variables that can be used with the `-t`/`--template` argument: `left` - Default template: `Batt: <left>` +`BatteryP Dirs Args RefreshRate`++- aliases to `battery`+- Files: list of directories in /proc/acpi/battery/ direcotry where to+ look for the `state` and `info` files. Example:+ `["BAT0","BAT1","BAT2"]`. Only the first 3 directories will be+ searched.+- Args: the argument list (see below)+- Variables that can be used with the `-t`/`--template` argument:+ `left`+- Default template: `Batt: <left>`++`Thermal Zone Args RefreshRate`++- aliases to the Zone: so `Zone "THRM" []` can be used in template as `%THRM%`+- Args: the argument list (see below)+- Variables that can be used with the `-t`/`--template` argument:+ `temp`+- Default template: `Thm: <temp>C`+- This plugin works only on sytems with devices having thermal zone.+ Check directories in /proc/acpi/thermal_zone for possible values.+- Example: `Run Thermal "THRM" ["-t","iwl4965-temp: \<temp\>C"]`++`CpuFreq Args RefreshRate`++- aliases to `cpufreq`+- Args: the argument list (see below)+- Variables that can be used with the `-t`/`--template` argument:+ `cpu0`, `cpu1`, .., `cpuN`+- Default template: `Freq: <cpu0>GHz`+- This monitor requires acpi_cpufreq module to be loaded in kernel+- Example: `Run CpuFreq ["-t","Freq:\<cpu0\>|\<cpu1\>GHz","-L","0","-H","2","-l","lightblue","-n","white","-h","red"] 50`++`CoreTemp Args RefreshRate`++- aliases to `coretemp`+- Args: the argument list (see below)+- Variables that can be used with the `-t`/`--template` argument:+ `core0`, `core1`, .., `coreN`+- Default template: `Temp: <core0>C`+- This monitor requires coretemp module to be loaded in kernel+- Example: `Run CoreTemp ["-t","Temp:\<core0\>|\<core1\>C","-L","40","-H","60","-l","lightblue","-n","gray90","-h","red"] 50`+ ### Monitor Plugins Commands Arguments These are the arguments that can be used for internal commands in the@@ -279,7 +354,7 @@ Run Weather "EGPF" ["-t","<station>: <tempC>C"] 36000 -In this case [Xmobar] will run the weather monitor, getting information+In this case [xmobar] will run the weather monitor, getting information for the weather station ID EGPF (Glasgow Airport, as a homage to GHC) every hour (36000 tenth of seconds), with a template that will output something like:@@ -293,7 +368,7 @@ arguments, or you can configure it in the "commands" configuration option list with the Com template command: -`Com ProgarmName Args Alias RefreshRate`+`Com ProgramName Args Alias RefreshRate` - ProgramName: the name of the program - Args: the arguments to be passed to the program at execution time@@ -323,7 +398,7 @@ ### Writing a Plugin -Writing a plugin for [Xmobar] should be very simple. You need to create+Writing a plugin for [xmobar] should be very simple. You need to create a data type with at least one constructor. Next you must declare this data type an instance of the `Exec` class, by@@ -352,7 +427,7 @@ instance Exec Date where alias (Date _ a _) = a start (Date f _ r) = date f r- + date :: String -> Int -> (String -> IO ()) -> IO () date format r callback = do go where go = do@@ -376,19 +451,19 @@ Runnable type constructor `Run` in the `commands` list of the configuration options. -This requires importing your plugin into `Config.hs` and adding you+This requires importing your plugin into `Config.hs` and adding your type to the type list in the type signature of `Config.runnableTypes`. For a very basic example see `Plugins/HelloWorld.hs` or the other-plugins that are distributed with [Xmobar].+plugins that are distributed with [xmobar]. ### Installing/Removing a Plugin Installing a plugin should require 3 steps. Here we are going to-install the HelloWorld plugin that comes with [Xmobar]:+install the HelloWorld plugin that comes with [xmobar]: -1. import the plugin module in `Config.hs`, by adding: - +1. import the plugin module in `Config.hs`, by adding:+ import Plugins.HelloWorld 2. add the plugin data type to the list of data types in the type@@ -398,7 +473,7 @@ runnableTypes :: (Command,(Monitors,(HelloWorld,()))) runnableTypes = undefined -3. Rebuild and reinstall [Xmobar]. Now test it with:+3. Rebuild and reinstall [xmobar]. Now test it with: xmobar Plugins/helloworld.config @@ -432,39 +507,39 @@ runnableTypes :: (Command,()) runnableTypes = undefined -3. rebuild [Xmobar].+3. rebuild [xmobar]. Credits ------- Thanks to Robert Manea and Spencer Janssen for their help in understanding how X works. They gave me suggestions on how to solve-many problems with [Xmobar].+many problems with [xmobar]. Thanks to Claus Reinke for make me understand existential types (or at-least for letting me think I grasp existential types...;-). +least for letting me think I grasp existential types...;-). -[Xmobar] incorporates patches from: Krzysztof Kosciuszkiewicz, Spencer+[xmobar] incorporates patches from: Krzysztof Kosciuszkiewicz, Spencer Janssen, Jens Petersen, Dmitry Kurochkin, and Lennart Kolmodin. Useful links ------------ -The [Xmobar] home page+The [xmobar] home page -The [XMonad] home page+The [xmonad] home page -[Xmobars darcs repository]+[xmobar darcs repository] -To understand the internal mysteries of Xmobar you may try reading+To understand the internal mysteries of xmobar you may try reading this tutorial [on X Window Programming in Haskell]. Author ------ -Andrea Rossato +Andrea Rossato -`andrea.rossato at unibz.it`+`andrea.rossato at ing.unitn.it` Legal -----@@ -476,8 +551,10 @@ [This is a screen shot]: http://haskell.org/sitewiki/images/a/ae/Arossato-config.png [Hackage]: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar-[Xmobar]: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar-[Xmobars darcs repository]: http://code.haskell.org/xmobar+[xmobar]: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar+[xmobar darcs repository]: http://code.haskell.org/xmobar [on X Window Programming in Haskell]: http://www.haskell.org/haskellwiki/X_window_programming_in_Haskell [Ion3]: http://modeemi.fi/~tuomov/ion/-[XMonad]: http://xmonad.org+[xmonad]: http://xmonad.org+[utf8-string]: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-string+[X11-xft]: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/X11-xft
− README.html
@@ -1,1012 +0,0 @@-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">-<html xmlns="http://www.w3.org/1999/xhtml"-><head- ><title- >Xmobar - A Minimalistic Text Based Status Bar</title- ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"- /><meta name="generator" content="pandoc"- /><meta name="author" content="Andrea Rossato"- /><style type="text/css"- >-ol.decimal { list-style-type: decimal; }-</style- ><link rel="stylesheet" href="xmobar.css" type="text/css" media="all" />-</head- ><body- ><h1 class="title"- >Xmobar - A Minimalistic Text Based Status Bar</h1- ><div id="toc"- ><ul- ><li- ><a href="#about" id="TOC-about"- >About</a- ></li- ><li- ><a href="#download" id="TOC-download"- >Download</a- ></li- ><li- ><a href="#installation" id="TOC-installation"- >Installation</a- ></li- ><li- ><a href="#configuration" id="TOC-configuration"- >Configuration</a- ><ul- ><li- ><a href="#quick-start" id="TOC-quick-start"- >Quick Start</a- ></li- ><li- ><a href="#command-line-options" id="TOC-command-line-options"- >Command Line Options</a- ></li- ><li- ><a href="#the-output-template" id="TOC-the-output-template"- >The Output Template</a- ></li- ><li- ><a href="#the-commands-configuration-option" id="TOC-the-commands-configuration-option"- >The <code- >commands</code- > Configuration Option</a- ></li- ><li- ><a href="#system-monitor-plugins" id="TOC-system-monitor-plugins"- >System Monitor Plugins</a- ></li- ><li- ><a href="#monitor-plugins-commands-arguments" id="TOC-monitor-plugins-commands-arguments"- >Monitor Plugins Commands Arguments</a- ></li- ><li- ><a href="#executing-external-commands" id="TOC-executing-external-commands"- >Executing External Commands</a- ></li- ><li- ><a href="#other-plugins" id="TOC-other-plugins"- >Other Plugins</a- ></li- ></ul- ></li- ><li- ><a href="#plugins" id="TOC-plugins"- >Plugins</a- ><ul- ><li- ><a href="#writing-a-plugin" id="TOC-writing-a-plugin"- >Writing a Plugin</a- ></li- ><li- ><a href="#installingremoving-a-plugin" id="TOC-installingremoving-a-plugin"- >Installing/Removing a Plugin</a- ></li- ></ul- ></li- ><li- ><a href="#credits" id="TOC-credits"- >Credits</a- ></li- ><li- ><a href="#useful-links" id="TOC-useful-links"- >Useful links</a- ></li- ><li- ><a href="#author" id="TOC-author"- >Author</a- ></li- ><li- ><a href="#legal" id="TOC-legal"- >Legal</a- ></li- ></ul- ></div- ><h2 id="about"- ><a href="#TOC-about"- >About</a- ></h2- ><p- ><a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > is a minimalistic, text based, status bar. It was designed to work with the <a href="http://xmonad.org"- >XMonad</a- > Window Manager.</p- ><p- >It was inspired by the <a href="http://modeemi.fi/~tuomov/ion/"- >Ion3</a- > status bar, and supports similar features, like dynamic color management, output templates, and extensibility through plugins.</p- ><p- ><a href="http://haskell.org/sitewiki/images/a/ae/Arossato-config.png"- >This is a screen shot</a- > of my desktop with <a href="http://xmonad.org"- >XMonad</a- > and <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- >.</p- ><p- >See <code- >xmobar.config-sample</code- >, distributed with the source code, for a sample configuration.</p- ><h2 id="download"- ><a href="#TOC-download"- >Download</a- ></h2- ><p- >You can get the <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > source code from <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Hackage</a- >.</p- ><p- >To get the darcs source run:</p- ><pre- ><code- > darcs get http://code.haskell.org/xmobar/-</code- ></pre- ><p- >The latest binary can be found here:</p- ><pre- ><code- > http://code.haskell.org/~arossato/xmobar/xmobar-0.8.bin-</code- ></pre- ><p- >A recent screen shot can be found here:</p- ><pre- ><code- > http://code.haskell.org/~arossato/xmobar/xmobar-0.8.png-</code- ></pre- ><p- >Version 0.8 requires Cabal-1.2.x, but works both with ghc-6.6.1 and ghc-6.8.1.</p- ><p- ><a href="http://code.haskell.org/~arossato/xmobar/xmobar-0.8-Cabal-1.1-ghc-6.6.tar.gz"- >Here you can find</a- > a source tree of xmobar-0.8 which works with Cabal-1.1.x, but compiles only with ghc-6.6.x:</p- ><pre- ><code- > http://code.haskell.org/~arossato/xmobar/xmobar-0.8-Cabal-1.1-ghc-6.6.tar.gz-</code- ></pre- ><h2 id="installation"- ><a href="#TOC-installation"- >Installation</a- ></h2- ><p- >To install simply run:</p- ><pre- ><code- > tar xvfz xmobar-0.8- cd xmobar-0.8- runhaskell Setup.lhs configure --prefix=/usr/local- runhaskell Setup.lhs build- runhaskell Setup.lhs haddock --executables # optional- runhaskell Setup.lhs install # possibly to be run as root-</code- ></pre- ><p- >Run with:</p- ><pre- ><code- > xmobar /path/to/config &-</code- ></pre- ><p- >or</p- ><pre- ><code- > xmobar &-</code- ></pre- ><p- >if you have the default configuration file saved as <code- >~/.xmobarrc</code- ></p- ><h2 id="configuration"- ><a href="#TOC-configuration"- >Configuration</a- ></h2- ><h3 id="quick-start"- ><a href="#TOC-quick-start"- >Quick Start</a- ></h3- ><p- >See <code- >xmobar.config-sample</code- > for an example.</p- ><p- >For the output template:</p- ><ul- ><li- ><p- ><code- >%command%</code- > will execute command and print the output. The output may contain markups to change the characters' color.</p- ></li- ><li- ><p- ><code- ><fc=#FF0000>string</fc></code- > will print <code- >string</code- > with <code- >#FF0000</code- > color (red).</p- ></li- ></ul- ><p- >Other configuration options:</p- ><dl- ><dt- ><code- >font</code- ></dt- ><dd- ><p- >Name of the font to be used</p- ></dd- ><dt- ><code- >bgColor</code- ></dt- ><dd- ><p- >Background color</p- ></dd- ><dt- ><code- >fgColor</code- ></dt- ><dd- ><p- >Default font color</p- ></dd- ><dt- ><code- >position</code- ></dt- ><dd- ><p- >Top, TopW, Bottom, BottomW or Static (with x, y, width and height).</p- ><p- >TopW and BottomW take 2 arguments: an alignment parameter (L for left, C for centered, R for Right) and an integer for the percentage width Xmobar window will have in respect to the screen width</p- ><p- >For example:</p- ><pre- ><code- > position = Bottom C 75-</code- ></pre- ><p- >to place Xmobar at the bottom, centered with the 75% of the screen width.</p- ><p- >Or</p- ><pre- ><code- > position = Static { xpos = 0 , ypos = 0, width = 1024, height = 15 }-</code- ></pre- ><p- >or</p- ><pre- ><code- > position = Top-</code- ></pre- ></dd- ><dt- ><code- >commands</code- ></dt- ><dd- ><p- >For setting the options of the programs to run (optional)</p- ></dd- ><dt- ><code- >sepChar</code- ></dt- ><dd- ><p- >The character to be used for indicating commands in the output template (default '%')</p- ></dd- ><dt- ><code- >alignSep</code- ></dt- ><dd- ><p- >a 2 character string for aligning text in the output template. The text before the first character will be align to left, the text in between the 2 characters will be centered, and the text after the second character will be align to the right.</p- ></dd- ><dt- ><code- >template</code- ></dt- ><dd- ><p- >The output template</p- ></dd- ></dl- ><h3 id="command-line-options"- ><a href="#TOC-command-line-options"- >Command Line Options</a- ></h3- ><p- ><a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > can be either configured with a configuration file or with command line options. In the second case, the command line options will overwrite the corresponding options set in the configuration file.</p- ><p- >Example:</p- ><pre- ><code- >xmobar -B white -a right -F blue -t '%LIPB%' -c '[Run Weather "LIPB" [] 36000]'-</code- ></pre- ><p- >This is the list of command line options (the output of xmobar --help):</p- ><pre- ><code- >Usage: xmobar [OPTION...] [FILE]-Options:- -h, -? --help This help- -V --version Show version information- -f font name --font=font name The font name- -B bg color --bgcolor=bg color The background color. Default black- -F fg color --fgcolor=fg color The foreground color. Default grey- -o --top Place Xmobar at the top of the screen- -b --bottom Place Xmobar at the bottom of the screen- -a alignsep --alignsep=alignsep Separators for left, center and right text- alignment. Default: '}{'- -s char --sepchar=char The character used to separate commands in- the output template. Default '%'- -t tempate --template=tempate The output template- -c commands --commands=commands The list of commands to be executed-Mail bug reports and suggestions to <andrea.rossato@unibz.it>-</code- ></pre- ><h3 id="the-output-template"- ><a href="#TOC-the-output-template"- >The Output Template</a- ></h3- ><p- >The output template must contain at least one command. <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > will parse the template and will search for the command to be executed in the <code- >commands</code- > configuration option. First an <code- >alias</code- > will be searched (plugins such as Weather or Network have default aliases, see below). After that, the command name will be tried. If a command is found, the arguments specified in the <code- >commands</code- > list will be used.</p- ><p- >If no command is found in the <code- >commands</code- > list, <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > will ask the operating system to execute a program with the name found in the template. If the execution is not successful an error will be reported.</p- ><h3 id="the-commands-configuration-option"- ><a href="#TOC-the-commands-configuration-option"- >The <code- >commands</code- > Configuration Option</a- ></h3- ><p- >The <code- >commands</code- > configuration option is a list of commands information and arguments to be used by <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > when parsing the output template. Each member of the list consists in a command prefixed by the <code- >Run</code- > keyword. Each command has arguments to control the way <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > is going to execute it.</p- ><p- >The option consists in a list of commands separated by a comma and enclosed by square parenthesis.</p- ><p- >Example:</p- ><pre- ><code- >[Run Memory ["-t","Mem: <usedratio>%"] 10, Run Swap [] 10]-</code- ></pre- ><p- >to run the Memory monitor plugin with the specified template, and the swap monitor plugin, with default options, every second.</p- ><p- >The only internal available command is <code- >Com</code- > (see below Executing External Commands). All other commands are provided by plugins. <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > comes with some plugins, providing a set of system monitors, a standard input reader, an Unix named pipe reader, and a configurable date plugin. These plugins install the following internal commands: <code- >Weather</code- >, <code- >Network</code- >, <code- >Memory</code- >, <code- >Swap</code- >, <code- >Cpu</code- >, <code- >Battery</code- >, <code- >Date</code- >, <code- >StdinReader</code- >, and <code- >PipeReader</code- >.</p- ><p- >To remove them see below Installing/Removing a Plugin</p- ><p- >Other commands can be created as plugins with the Plugin infrastructure. See below Writing a Plugin</p- ><h3 id="system-monitor-plugins"- ><a href="#TOC-system-monitor-plugins"- >System Monitor Plugins</a- ></h3- ><p- >This is the description of the system monitor plugins that are installed by default.</p- ><p- >Each monitor has an <code- >alias</code- > to be used in the output template. Monitors have default aliases.</p- ><p- ><code- >Weather StationID Args RefreshRate</code- ></p- ><ul- ><li- >aliases to the Station ID: so <code- >Weather "LIPB" []</code- > can be used in template as <code- >%LIBP%</code- ></li- ><li- >Args: the argument list (see below)</li- ><li- >Variables that can be used with the <code- >-t</code- >/<code- >--template</code- > argument: <code- >station</code- >, <code- >stationState</code- >, <code- >year</code- >, <code- >month</code- >, <code- >day</code- >, <code- >hour</code- >, <code- >wind</code- >, <code- >visibility</code- >, <code- >skyCondition</code- >, <code- >tempC</code- >, <code- >tempF</code- >, <code- >dewPoint</code- >, <code- >rh</code- >, <code- >pressure</code- ></li- ><li- >Default template: <code- ><station>: <tempC>C, rh <rh>% (<hour>)</code- ></li- ></ul- ><p- ><code- >Network Interface Args RefreshRate</code- ></p- ><ul- ><li- >aliases to the interface name: so <code- >Network "eth0" []</code- > can be used as <code- >%eth0%</code- ></li- ><li- >Args: the argument list (see below)</li- ><li- >Variables that can be used with the <code- >-t</code- >/<code- >--template</code- > argument: <code- >dev</code- >, <code- >rx</code- >, <code- >tx</code- ></li- ><li- >Default template: <code- ><dev>: <rx>|<tx></code- ></li- ></ul- ><p- ><code- >Memory Args RefreshRate</code- ></p- ><ul- ><li- >aliases to <code- >memory</code- ></li- ><li- >Args: the argument list (see below)</li- ><li- >Variables that can be used with the <code- >-t</code- >/<code- >--template</code- > argument: <code- >total</code- >, <code- >free</code- >, <code- >buffer</code- >, <code- >cache</code- >, <code- >rest</code- >, <code- >used</code- >, <code- >usedratio</code- ></li- ><li- >Default template: <code- >Mem: <usedratio>% (<cache>M)</code- ></li- ></ul- ><p- ><code- >Swap Args RefreshRate</code- ></p- ><ul- ><li- >aliases to <code- >swap</code- ></li- ><li- >Args: the argument list (see below)</li- ><li- >Variables that can be used with the <code- >-t</code- >/<code- >--template</code- > argument: <code- >total</code- >, <code- >used</code- >, <code- >free</code- >, <code- >usedratio</code- ></li- ><li- >Default template: <code- >Swap: <usedratio>%</code- ></li- ></ul- ><p- ><code- >Cpu Args RefreshRate</code- ></p- ><ul- ><li- >aliases to <code- >cpu</code- ></li- ><li- >Args: the argument list (see below)</li- ><li- >Variables that can be used with the <code- >-t</code- >/<code- >--template</code- > argument: <code- >total</code- >, <code- >user</code- >, <code- >nice</code- >, <code- >system</code- >, <code- >idle</code- ></li- ><li- >Default template: <code- >Cpu: <total></code- ></li- ></ul- ><p- ><code- >Battery Args RefreshRate</code- ></p- ><ul- ><li- >aliases to <code- >battery</code- ></li- ><li- >Args: the argument list (see below)</li- ><li- >Variables that can be used with the <code- >-t</code- >/<code- >--template</code- > argument: <code- >left</code- ></li- ><li- >Default template: <code- >Batt: <left></code- ></li- ></ul- ><h3 id="monitor-plugins-commands-arguments"- ><a href="#TOC-monitor-plugins-commands-arguments"- >Monitor Plugins Commands Arguments</a- ></h3- ><p- >These are the arguments that can be used for internal commands in the <code- >commands</code- > configuration option:</p- ><pre- ><code- >-H number --High=number The high threshold--L number --Low=number The low threshold--h color number --high=color number Color for the high threshold: es "#FF0000"--n color number --normal=color number Color for the normal threshold: es "#00FF00"--l color number --low=color number Color for the low threshold: es "#0000FF"--t output template --template=output template Output template of the command.-</code- ></pre- ><p- >Commands' arguments must be set as a list. Es:</p- ><pre- ><code- >Run Weather "EGPF" ["-t","<station>: <tempC>C"] 36000-</code- ></pre- ><p- >In this case <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > will run the weather monitor, getting information for the weather station ID EGPF (Glasgow Airport, as a homage to GHC) every hour (36000 tenth of seconds), with a template that will output something like:</p- ><pre- ><code- >Glasgow Airport: 16.0C-</code- ></pre- ><h3 id="executing-external-commands"- ><a href="#TOC-executing-external-commands"- >Executing External Commands</a- ></h3- ><p- >In order to execute an external command you can either write the command name in the template, in this case it will be executed without arguments, or you can configure it in the "commands" configuration option list with the Com template command:</p- ><p- ><code- >Com ProgarmName Args Alias RefreshRate</code- ></p- ><ul- ><li- >ProgramName: the name of the program</li- ><li- >Args: the arguments to be passed to the program at execution time</li- ><li- >Alias: a name to be used in the template. If the alias is en empty string the program name can be used in the template.</li- ></ul- ><p- >Es:</p- ><pre- ><code- > Run Com "uname" ["-s","-r"] "" 36000-</code- ></pre- ><p- >can be used in the output template as <code- >%uname%</code- ></p- ><pre- ><code- > Run Com "date" ["+\"%a %b %_d %H:%M\""] "mydate" 600-</code- ></pre- ><p- >can be used in the output template as <code- >%mydate%</code- ></p- ><h3 id="other-plugins"- ><a href="#TOC-other-plugins"- >Other Plugins</a- ></h3- ><p- ><code- >Date Args Alias RefreshRate</code- ></p- ><p- ><code- >StdinReader</code- ></p- ><p- ><code- >PipeReader "/path/to/pipe" Alias</code- ></p- ><h2 id="plugins"- ><a href="#TOC-plugins"- >Plugins</a- ></h2- ><h3 id="writing-a-plugin"- ><a href="#TOC-writing-a-plugin"- >Writing a Plugin</a- ></h3- ><p- >Writing a plugin for <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > should be very simple. You need to create a data type with at least one constructor.</p- ><p- >Next you must declare this data type an instance of the <code- >Exec</code- > class, by defining the 1 needed method (alternatively <code- >start</code- > or <code- >run</code- >) and 2 optional ones (alias and rate):</p- ><pre- ><code- > start :: e -> (String -> IO ()) -> IO ()- run :: e -> IO String- rate :: e -> Int- alias :: e -> String-</code- ></pre- ><p- ><code- >start</code- > must receive a callback to be used to display the <code- >String</code- > produced by the plugin. This method can be used for plugins that need to perform asynchronous actions. See <code- >Plugins/PipeReader.hs</code- > for an example.</p- ><p- ><code- >run</code- > can be used for simpler plugins. If you define only <code- >run</code- > the plugin will be run every second. To overwrite this default you just need to implement <code- >rate</code- >, which must return the number of tenth of seconds between every successive runs. See <code- >Plugins/HelloWorld.hs</code- > for an example of a plugin that runs just once, and <code- >Plugins/Date.hs</code- > for one that implements <code- >rate</code- >.</p- ><p- >Notice that Date could be implemented as:</p- ><pre- ><code- > instance Exec Date where- alias (Date _ a _) = a- start (Date f _ r) = date f r-- date :: String -> Int -> (String -> IO ()) -> IO ()- date format r callback = do go- where go = do- t <- toCalendarTime =<< getClockTime- callback $ formatCalendarTime defaultTimeLocale format t- tenthSeconds r >> go-</code- ></pre- ><p- >This implementation is equivalent to the one you can read in <code- >Plugins/Date.hs</code- >.</p- ><p- ><code- >alias</code- > is the name to be used in the output template. Default alias will be the data type constructor.</p- ><p- >Implementing a plugin requires importing the plugin API (the <code- >Exec</code- > class definition), that is exported by <code- >Plugins.hs</code- >. So you just need to import it in your module with:</p- ><pre- ><code- > import Plugins-</code- ></pre- ><p- >After that your type constructor can be used as an argument for the Runnable type constructor <code- >Run</code- > in the <code- >commands</code- > list of the configuration options.</p- ><p- >This requires importing your plugin into <code- >Config.hs</code- > and adding you type to the type list in the type signature of <code- >Config.runnableTypes</code- >.</p- ><p- >For a very basic example see <code- >Plugins/HelloWorld.hs</code- > or the other plugins that are distributed with <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- >.</p- ><h3 id="installingremoving-a-plugin"- ><a href="#TOC-installingremoving-a-plugin"- >Installing/Removing a Plugin</a- ></h3- ><p- >Installing a plugin should require 3 steps. Here we are going to install the HelloWorld plugin that comes with <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- >:</p- ><ol class="decimal"- ><li- ><p- >import the plugin module in <code- >Config.hs</code- >, by adding:</p- ><pre- ><code- >import Plugins.HelloWorld-</code- ></pre- ></li- ><li- ><p- >add the plugin data type to the list of data types in the type signature of <code- >runnableTypes</code- > in <code- >Config.hs</code- >. For instance, for the HelloWorld plugin, change <code- >runnableTypes</code- > into:</p- ><pre- ><code- >runnableTypes :: (Command,(Monitors,(HelloWorld,())))-runnableTypes = undefined-</code- ></pre- ></li- ><li- ><p- >Rebuild and reinstall <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- >. Now test it with:</p- ><pre- ><code- >xmobar Plugins/helloworld.config-</code- ></pre- ></li- ></ol- ><p- >As you may see in the example configuration file, the plugin can be used by adding, in the <code- >commands</code- > list:</p- ><pre- ><code- > Run HelloWorld-</code- ></pre- ><p- >and, in the output template, the alias of the plugin:</p- ><pre- ><code- > %helloWorld%-</code- ></pre- ><p- >That's it.</p- ><p- >To remove a plugin, just remove its type from the type signature of runnableTypes and remove the imported modules.</p- ><p- >To remove the system monitor plugin:</p- ><ol class="decimal"- ><li- ><p- >remove, from <code- >Config.hs</code- >, the line</p- ><pre- ><code- >import Plugins.Monitors-</code- ></pre- ></li- ><li- ><p- >in <code- >Config.hs</code- > change</p- ><pre- ><code- > runnableTypes :: (Command,(Monitors,()))- runnableTypes = undefined-</code- ></pre- ><p- >to</p- ><pre- ><code- > runnableTypes :: (Command,())- runnableTypes = undefined-</code- ></pre- ></li- ><li- ><p- >rebuild <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- >.</p- ></li- ></ol- ><h2 id="credits"- ><a href="#TOC-credits"- >Credits</a- ></h2- ><p- >Thanks to Robert Manea and Spencer Janssen for their help in understanding how X works. They gave me suggestions on how to solve many problems with <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- >.</p- ><p- >Thanks to Claus Reinke for make me understand existential types (or at least for letting me think I grasp existential types...;-).</p- ><p- ><a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > incorporates patches from: Krzysztof Kosciuszkiewicz, Spencer Janssen, Jens Petersen, Dmitry Kurochkin, and Lennart Kolmodin.</p- ><h2 id="useful-links"- ><a href="#TOC-useful-links"- >Useful links</a- ></h2- ><p- >The <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmobar"- >Xmobar</a- > home page</p- ><p- >The <a href="http://xmonad.org"- >XMonad</a- > home page</p- ><p- ><a href="http://code.haskell.org/xmobar"- >Xmobars darcs repository</a- ></p- ><p- >To understand the internal mysteries of Xmobar you may try reading this tutorial <a href="http://www.haskell.org/haskellwiki/X_window_programming_in_Haskell"- >on X Window Programming in Haskell</a- >.</p- ><h2 id="author"- ><a href="#TOC-author"- >Author</a- ></h2- ><p- >Andrea Rossato</p- ><p- ><code- >andrea.rossato at unibz.it</code- ></p- ><h2 id="legal"- ><a href="#TOC-legal"- >Legal</a- ></h2- ><p- >This software is released under a BSD-style license. See LICENSE for more details.</p- ><p- >Copyright © 2007 Andrea Rossato</p- ></body- ></html->-
Runnable.hs view
@@ -4,16 +4,16 @@ -- Module : Xmobar.Runnable -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable -- -- The existential type to store the list of commands to be executed. -- I must thank Claus Reinke for the help in understanding the mysteries of--- reading existential types. The Read instance of Runnable must be credited to --- him. --- +-- reading existential types. The Read instance of Runnable must be credited to+-- him.+-- -- See here: -- http:\/\/www.haskell.org\/pipermail\/haskell-cafe\/2007-July\/028227.html --@@ -43,10 +43,10 @@ -- | Reads an existential type as any of hidden types ts readAsAnyOf :: ts -> ReadPrec ex -instance ReadAsAnyOf () ex where +instance ReadAsAnyOf () ex where readAsAnyOf ~() = mzero -instance (Show t, Read t, Exec t, ReadAsAnyOf ts Runnable) => ReadAsAnyOf (t,ts) Runnable where +instance (Show t, Read t, Exec t, ReadAsAnyOf ts Runnable) => ReadAsAnyOf (t,ts) Runnable where readAsAnyOf ~(t,ts) = r t `mplus` readAsAnyOf ts where r ty = do { m <- readPrec; return (Run (m `asTypeOf` ty)) }
Runnable.hs-boot view
@@ -6,6 +6,3 @@ instance Read Runnable instance Exec Runnable---
Setup.lhs view
@@ -1,4 +1,4 @@ #!/usr/bin/env runhaskell > import Distribution.Simple-> main = defaultMainWithHooks defaultUserHooks+> main = defaultMainWithHooks simpleUserHooks
+ XUtil.hsc view
@@ -0,0 +1,224 @@+{-# OPTIONS -fglasgow-exts #-}+-----------------------------------------------------------------------------+-- |+-- Module : XUtil+-- Copyright : (C) 2007 Andrea Rossato+-- License : BSD3+--+-- Maintainer : andrea.rossato@unibz.it+-- Stability : unstable+-- Portability : unportable+--+-----------------------------------------------------------------------------++module XUtil+ ( XFont+ , initFont+ , initCoreFont+ , initUtf8Font+ , releaseFont+ , textExtents+ , textWidth+ , printString+ , initColor+ , newWindow+ , nextEvent'+ , readFileSafe+ , hGetLineSafe+ , io+ , fi+ ) where++import Control.Concurrent+import Control.Monad+import Control.Monad.Trans+import Foreign+import Graphics.X11.Xlib hiding (textExtents, textWidth)+import qualified Graphics.X11.Xlib as Xlib (textExtents, textWidth)+import Graphics.X11.Xlib.Extras+import System.Posix.Types (Fd(..))+import System.IO+#if defined XFT || defined UTF8+import Foreign.C+import qualified System.IO.UTF8 as UTF8 (readFile,hGetLine)+#endif+#if defined XFT+import Data.List+import Graphics.X11.Xft+import Graphics.X11.Xrender+#endif++readFileSafe :: FilePath -> IO String+#if defined XFT || defined UTF8+readFileSafe = UTF8.readFile+#else+readFileSafe = readFile+#endif++hGetLineSafe :: Handle -> IO String+#if defined XFT || defined UTF8+hGetLineSafe = UTF8.hGetLine+#else+hGetLineSafe = hGetLine+#endif++-- Hide the Core Font/Xft switching here+data XFont =Core FontStruct+ | Utf8 FontSet+#ifdef XFT+ | Xft XftFont+#endif++-- | When initFont gets a font name that starts with 'xft:' it switchs to the Xft backend+-- Example: 'xft:Sans-10'+initFont :: Display ->String -> IO XFont+initFont d s =+#ifdef XFT+ if xftPrefix `isPrefixOf` s then+ do setupLocale+ xftdraw <- xftFontOpen d (defaultScreenOfDisplay d) (drop (length xftPrefix) s)+ return (Xft xftdraw)+ else+#endif+#ifdef UTF8+ (setupLocale >> initUtf8Font d s >>= return . Utf8)+#else+ (initCoreFont d s >>= return . Core)+#endif+#ifdef XFT+ where xftPrefix = "xft:"+#endif++releaseFont :: Display -> XFont -> IO ()+#ifdef XFT+releaseFont d (Xft xftfont) = xftFontClose d xftfont+#endif+releaseFont d (Utf8 fs) = releaseUtf8Font d fs+releaseFont d (Core fs) = releaseCoreFont d fs++-- | Given a fontname returns the font structure. If the font name is+-- not valid the default font will be loaded and returned.+initCoreFont :: Display -> String -> IO FontStruct+initCoreFont dpy s = catch (getIt dpy) (fallBack dpy)+ where getIt d = loadQueryFont d s+ fallBack d = const $ loadQueryFont d "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"++releaseCoreFont :: Display -> FontStruct -> IO ()+releaseCoreFont d = freeFont d++-- | Given a fontname returns the font structure. If the font name is+-- not valid the default font will be loaded and returned.+initUtf8Font :: Display -> String -> IO FontSet+initUtf8Font dpy s = do+ (_,_,fs) <- catch (getIt dpy) (fallBack dpy)+ return fs+ where getIt d = createFontSet d s+ fallBack d = const $ createFontSet d "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"++releaseUtf8Font :: Display -> FontSet -> IO ()+releaseUtf8Font d = freeFontSet d++textWidth :: Display -> XFont -> String -> IO Int+textWidth _ (Utf8 fs) s = return $ fi $ wcTextEscapement fs s+textWidth _ (Core fs) s = return $ fi $ Xlib.textWidth fs s+#ifdef XFT+textWidth dpy (Xft xftdraw) s = do+ gi <- xftTextExtents dpy xftdraw s+ return $ xglyphinfo_xOff gi+#endif++textExtents :: XFont -> String -> IO (Int32,Int32)+textExtents (Core fs) s = do+ let (_,a,d,_) = Xlib.textExtents fs s+ return (a,d)+textExtents (Utf8 fs) s = do+ let (_,rl) = wcTextExtents fs s+ ascent = fi $ - (rect_y rl)+ descent = fi $ rect_height rl + (fi $ rect_y rl)+ return (ascent, descent)+#ifdef XFT+textExtents (Xft xftfont) _ = do+ ascent <- fi `fmap` xftfont_ascent xftfont+ descent <- fi `fmap` xftfont_descent xftfont+ return (ascent, descent)+#endif++printString :: Display -> Drawable -> XFont -> GC -> String -> String+ -> Position -> Position -> String -> IO ()+printString d p (Core fs) gc fc bc x y s = do+ setFont d gc $ fontFromFontStruct fs+ [fc',bc'] <- mapM (initColor d) [fc,bc]+ setForeground d gc fc'+ setBackground d gc bc'+ drawImageString d p gc x y s+printString d p (Utf8 fs) gc fc bc x y s = do+ [fc',bc'] <- mapM (initColor d) [fc,bc]+ setForeground d gc fc'+ setBackground d gc bc'+ io $ wcDrawImageString d p fs gc x y s+#ifdef XFT+printString dpy drw fs@(Xft font) gc fc bc x y s = do+ let screen = defaultScreenOfDisplay dpy+ colormap = defaultColormapOfScreen screen+ visual = defaultVisualOfScreen screen+ bcolor <- initColor dpy bc+ (a,d) <- textExtents fs s+ gi <- xftTextExtents dpy font s+ setForeground dpy gc bcolor+ fillRectangle dpy drw gc (x - fi (xglyphinfo_x gi))+ (y - fi a)+ (fi $ xglyphinfo_xOff gi)+ (fi $ a + d)+ withXftDraw dpy drw visual colormap $+ \draw -> withXftColorName dpy visual colormap fc $+ \color -> xftDrawString draw color font x y s+#endif++-- | Get the Pixel value for a named color: if an invalid name is+-- given the black pixel will be returned.+initColor :: Display -> String -> IO Pixel+initColor dpy c =+ catch (initColor' dpy c) (const . return . blackPixel dpy $ (defaultScreen dpy))++initColor' :: Display -> String -> IO Pixel+initColor' dpy c = (color_pixel . fst) `liftM` allocNamedColor dpy colormap c+ where colormap = defaultColormap dpy (defaultScreen dpy)++-- | Creates a window with the attribute override_redirect set to True.+-- Windows Managers should not touch this kind of windows.+newWindow :: Display -> Screen -> Window -> Rectangle -> Bool -> IO Window+newWindow dpy scr rw (Rectangle x y w h) o = do+ let visual = defaultVisualOfScreen scr+ attrmask = cWOverrideRedirect+ allocaSetWindowAttributes $+ \attributes -> do+ set_override_redirect attributes o+ createWindow dpy rw x y w h 0 (defaultDepthOfScreen scr)+ inputOutput visual attrmask attributes+-- | A version of nextEvent that does not block in foreign calls.+nextEvent' :: Display -> XEventPtr -> IO ()+nextEvent' d p = do+ pend <- pending d+ if pend /= 0+ then nextEvent d p+ else do+ threadWaitRead (Fd fd)+ nextEvent' d p+ where+ fd = connectionNumber d++io :: MonadIO m => IO a -> m a+io = liftIO++-- | Short-hand for 'fromIntegral'+fi :: (Integral a, Num b) => a -> b+fi = fromIntegral++#if defined XFT || defined UTF8+#include <locale.h>+foreign import ccall unsafe "locale.h setlocale"+ setlocale :: CInt -> CString -> IO CString++setupLocale :: IO CString+setupLocale = withCString "" $ setlocale (#const LC_ALL)+#endif
Xmobar.hs view
@@ -4,37 +4,33 @@ -- Module : Xmobar -- Copyright : (c) Andrea Rossato -- License : BSD-style (see LICENSE)--- +-- -- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> -- Stability : unstable -- Portability : unportable ----- A status bar for the Xmonad Window Manager +-- A status bar for the Xmonad Window Manager -- ----------------------------------------------------------------------------- -module Xmobar (-- * Main Stuff- -- $main- X, XConf (..), runX- , eventLoop- -- * Program Execution- -- $command- , startCommand- -- * Window Management- -- $window- , createWin, updateWin- -- * Printing- -- $print- , drawInWin, printStrings- -- * Unmamaged Windows- -- $unmanwin- , mkUnmanagedWindow- -- * Useful Utilities- , initColor, io, nextEvent', fi- ) where+module Xmobar+ ( -- * Main Stuff+ -- $main+ X , XConf (..), runX+ , eventLoop+ -- * Program Execution+ -- $command+ , startCommand+ -- * Window Management+ -- $window+ , createWin, updateWin+ -- * Printing+ -- $print+ , drawInWin, printStrings+ ) where import Prelude hiding (catch)-import Graphics.X11.Xlib+import Graphics.X11.Xlib hiding (textExtents, textWidth) import Graphics.X11.Xlib.Extras import Graphics.X11.Xinerama @@ -44,12 +40,14 @@ import Control.Concurrent.STM import Control.Exception hiding (handle) import Data.Bits-import System.Posix.Types (Fd(..))+import Data.Char + import Config import Parsers import Commands import Runnable+import XUtil -- $main --@@ -63,7 +61,7 @@ XConf { display :: Display , rect :: Rectangle , window :: Window- , fontS :: FontStruct+ , fontS :: XFont , config :: Config } @@ -75,9 +73,9 @@ eventLoop :: XConf -> [(Maybe ThreadId, TVar String)] -> IO () eventLoop xc@(XConf d _ w fs c) v = block $ do tv <- atomically $ newTVar []- t <- myThreadId+ t <- myThreadId ct <- forkIO (checker t tv "" `catch` \_ -> return ())- go tv ct + go tv ct where -- interrupt the drawing thread every time a var is updated checker t tvar ov = do@@ -127,32 +125,32 @@ -- $window -- | The function to create the initial window-createWin :: Display -> FontStruct -> Config -> IO (Rectangle,Window)+createWin :: Display -> XFont -> Config -> IO (Rectangle,Window) createWin d fs c = do let dflt = defaultScreen d- r:_ <- getScreenInfo d- rootw <- rootWindow d dflt- let (_,as,ds,_) = textExtents fs []- ht = as + ds + 2- (x,y,w,h,o) = setPosition (position c) r (fi ht)- win <- mkUnmanagedWindow d (defaultScreenOfDisplay d) rootw x y w h o+ sr:_ <- getScreenInfo d+ rootw <- rootWindow d dflt+ (as,ds) <- textExtents fs "0"+ let ht = as + ds + 4+ (r,o) = setPosition (position c) sr (fi ht)+ win <- newWindow d (defaultScreenOfDisplay d) rootw r o selectInput d win (exposureMask .|. structureNotifyMask)- setProperties h c d win+ setProperties r c d win mapWindow d win- return (Rectangle x y w h,win)+ return (r,win) -setPosition :: XPosition -> Rectangle -> Dimension -> (Position,Position,Dimension,Dimension,Bool)+setPosition :: XPosition -> Rectangle -> Dimension -> (Rectangle,Bool) setPosition p (Rectangle rx ry rw rh) ht = case p of- Top -> (rx , ry , rw , h , True)- TopW L i -> (rx , ry , nw i , h , True) - TopW R i -> (right i, ry , nw i , h , True)- TopW C i -> (center i, ry , nw i , h , True)- Bottom -> (rx , ny , rw , h , True)- BottomW L i -> (rx , ny , nw i , h , True)- BottomW R i -> (right i, ny , nw i , h , True)- BottomW C i -> (center i, ny , nw i , h , True)- Static cx cy cw ch -> (fi cx , fi cy , fi cw, fi ch, True)+ Top -> (Rectangle rx ry rw h , True)+ TopW L i -> (Rectangle rx ry (nw i) h , True)+ TopW R i -> (Rectangle (right i) ry (nw i) h , True)+ TopW C i -> (Rectangle (center i) ry (nw i) h , True)+ Bottom -> (Rectangle rx ny rw h , True)+ BottomW L i -> (Rectangle rx ny (nw i) h , True)+ BottomW R i -> (Rectangle (right i) ny (nw i) h , True)+ BottomW C i -> (Rectangle (center i) ny (nw i) h , True)+ Static cx cy cw ch -> (Rectangle (fi cx ) (fi cy) (fi cw) (fi ch), True) where ny = ry + fi (rh - ht) center i = rx + (fi $ div (remwid i) 2)@@ -162,29 +160,34 @@ nw = fi . pw . fi h = fi ht -setProperties :: Dimension -> Config -> Display -> Window -> IO ()-setProperties h c d w = do- a1 <- internAtom d "_NET_WM_STRUT" False+setProperties :: Rectangle -> Config -> Display -> Window -> IO ()+setProperties r c d w = do+ a1 <- internAtom d "_NET_WM_STRUT_PARTIAL" False c1 <- internAtom d "CARDINAL" False a2 <- internAtom d "_NET_WM_WINDOW_TYPE" False c2 <- internAtom d "ATOM" False v <- internAtom d "_NET_WM_WINDOW_TYPE_DOCK" False- changeProperty32 d w a1 c1 propModeReplace $ map fi $ getStrutValues h c+ changeProperty32 d w a1 c1 propModeReplace $ map fi $ getStrutValues r c changeProperty32 d w a2 c2 propModeReplace [fromIntegral v] -getStrutValues :: Dimension -> Config -> [Int]-getStrutValues h c =+getStrutValues :: Rectangle -> Config -> [Int]+getStrutValues (Rectangle x _ w h) c = case position c of- Top -> [0, 0, fi h, 0 ]- Bottom -> [0, 0, 0 , fi h]- _ -> [0, 0, 0 , 0 ]+ Top -> [0, 0, nh, 0, 0, 0, 0, 0, nx, nw, 0, 0]+ TopW _ _ -> [0, 0, nh, 0, 0, 0, 0, 0, nx, nw, 0, 0]+ Bottom -> [0, 0, 0, nh, 0, 0, 0, 0, 0, 0, nx, nw]+ BottomW _ _ -> [0, 0, 0, nh, 0, 0, 0, 0, 0, 0, nx, nw]+ _ -> [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]+ where nh = fi h+ nx = fi x+ nw = fi (x + fi w - 1) updateWin :: TVar String -> X () updateWin v = do xc <- ask let (conf,rec) = (config &&& rect) xc- [lc,rc] = if length (alignSep conf) == 2 - then alignSep conf + [lc,rc] = if length (alignSep conf) == 2+ then alignSep conf else alignSep defaultConfig i <- io $ atomically $ readTVar v let def = [i,[],[]]@@ -204,10 +207,9 @@ r <- ask let (c,d ) = (config &&& display) r (w,fs) = (window &&& fontS ) r+ strLn = io . mapM (\(s,cl) -> textWidth d fs s >>= \tw -> return (s,cl,fi tw)) bgcolor <- io $ initColor d $ bgColor c gc <- io $ createGC d w- --let's get the fonts- io $ setFont d gc (fontFromFontStruct fs) -- create a pixmap to write to and fill it with a rectangle p <- io $ createPixmap d w wid ht (defaultDepthOfScreen (defaultScreenOfDisplay d))@@ -215,10 +217,9 @@ io $ setForeground d gc bgcolor io $ fillRectangle d p gc 0 0 wid ht -- write to the pixmap the new string- let strWithLenth = map (\(s,cl) -> (s,cl,textWidth fs s))- printStrings p gc fs 1 L $ strWithLenth left- printStrings p gc fs 1 R $ strWithLenth right- printStrings p gc fs 1 C $ strWithLenth center+ printStrings p gc fs 1 L =<< strLn left+ printStrings p gc fs 1 R =<< strLn right+ printStrings p gc fs 1 C =<< strLn center -- copy the pixmap with the new string to the window io $ copyArea d p w gc 0 0 wid ht 0 0 -- free up everything (we do not want to leak memory!)@@ -228,91 +229,23 @@ io $ sync d True -- | An easy way to print the stuff we need to print-printStrings :: Drawable -> GC -> FontStruct -> Position+printStrings :: Drawable -> GC -> XFont -> Position -> Align -> [(String, String, Position)] -> X () printStrings _ _ _ _ _ [] = return () printStrings dr gc fontst offs a sl@((s,c,l):xs) = do r <- ask+ (as,ds) <- io $ textExtents fontst s let (conf,d) = (config &&& display) r- Rectangle _ _ wid ht = rect r- (_,as,ds,_) = textExtents fontst s+ Rectangle _ _ wid _ = rect r totSLen = foldr (\(_,_,len) -> (+) len) 0 sl- valign = (fi ht + fi as - fi ds) `div` 2+ valign = fi $ as + ds remWidth = fi wid - fi totSLen offset = case a of C -> (remWidth + offs) `div` 2 R -> remWidth - 1 L -> offs- (fc,bc) <- case (break (==',') c) of- (f,',':b) -> do- fgc <- io $ initColor d f- bgc <- io $ initColor d b- return (fgc,bgc) - (f,_) -> do- fgc <- io $ initColor d f- bgc <- io $ initColor d (bgColor conf)- return (fgc,bgc) - io $ setForeground d gc fc- io $ setBackground d gc bc- io $ drawImageString d dr gc offset valign s+ (fc,bc) = case (break (==',') c) of+ (f,',':b) -> (f, b )+ (f, _) -> (f, bgColor conf)+ io $ printString d dr fontst gc fc bc offset valign s printStrings dr gc fontst (offs + l) a xs--{- $unmanwin--This is a way to create unmamaged window.---}---- | Creates a window with the attribute override_redirect set to True.--- Windows Managers should not touch this kind of windows.-mkUnmanagedWindow :: Display- -> Screen- -> Window- -> Position- -> Position- -> Dimension- -> Dimension- -> Bool- -> IO Window-mkUnmanagedWindow dpy scr rw x y w h o = do- let visual = defaultVisualOfScreen scr- attrmask = cWOverrideRedirect- allocaSetWindowAttributes $ - \attributes -> do- set_override_redirect attributes o- createWindow dpy rw x y w h 0 (defaultDepthOfScreen scr) - inputOutput visual attrmask attributes --{- $utility-Utilities--}---- | Get the Pixel value for a named color: if an invalid name is--- given the black pixel will be returned.-initColor :: Display -> String -> IO Pixel-initColor dpy c =- catch (initColor' dpy c) (const . return . blackPixel dpy $ (defaultScreen dpy))--initColor' :: Display -> String -> IO Pixel-initColor' dpy c = (color_pixel . fst) `liftM` allocNamedColor dpy colormap c- where colormap = defaultColormap dpy (defaultScreen dpy)---- | A version of nextEvent that does not block in foreign calls.-nextEvent' :: Display -> XEventPtr -> IO ()-nextEvent' d p = do- pend <- pending d- if pend /= 0- then nextEvent d p- else do- threadWaitRead (Fd fd)- nextEvent' d p- where- fd = connectionNumber d---- | Short-hand for lifting in the IO monad-io :: IO a -> X a-io = liftIO---- | Short-hand for 'fromIntegral'-fi :: (Integral a, Num b) => a -> b-fi = fromIntegral
xmobar.cabal view
@@ -1,5 +1,5 @@ name: xmobar-version: 0.8+version: 0.9 homepage: http://code.haskell.org/~arossato/xmobar synopsis: A Minimalistic Text Based Status Bar description: Xmobar is a minimalistic text based status bar.@@ -13,17 +13,34 @@ author: Andrea Rossato maintainer: andrea.rossato@unibz.it cabal-version: >= 1.2+build-type: Simple+ flag small_base description: Choose the new smaller, split-up base package. +flag with_xft+ description: Use Xft to render text. UTF-8 support included.++flag with_utf8+ description: With UTF-8 support.+ executable xmobar main-is: Main.hs- other-Modules: Xmobar, Config, Parsers, Commands, Runnable, Plugins- ghc-options: -funbox-strict-fields -O2 -fasm -Wall -optl-Wl,-s -threaded+ other-Modules: Xmobar, Config, Parsers, Commands, XUtil, Runnable, Plugins+ ghc-options: -funbox-strict-fields -Wall ghc-prof-options: -prof -auto-all if flag(small_base)- build-depends: base >= 3, containers, process, old-time, old-locale, bytestring+ build-depends: base >= 3, containers, process, old-time, old-locale, bytestring, directory+ else build-depends: base < 3- build-depends: X11>=1.3.0, mtl, unix, parsec, filepath, stm + if flag(with_xft)+ build-depends: utf8-string, X11-xft >= 0.2+ cpp-options: -DXFT++ if flag(with_utf8)+ build-depends: utf8-string+ cpp-options: -DUTF8++ build-depends: X11>=1.3.0, mtl, unix, parsec, filepath, stm
xmobar.config-sample view
@@ -1,7 +1,7 @@ Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*" , bgColor = "black" , fgColor = "grey"- , position = Static { xpos = 0 , ypos = 0, width = 1024, height = 15 }+ , position = Top , commands = [ Run Weather "EGPF" ["-t","<station>: <tempC>C","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000 , Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10 , Run Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10
− xmobar.css
@@ -1,88 +0,0 @@-body {- margin: auto;- padding-right: 1em;- padding-left: 1em;- max-width: 50em; - border-left: 1px solid black;- border-right: 1px solid black;- color: black;- font-family: Verdana, sans-serif;- font-size: 100%;- line-height: 140%;- color: #333; -}-pre {- border: 1px dotted gray;- background-color: #ccffcc;- color: #111111;- padding: 0.5em;-}-code {- font-family: monospace;- font-size: 110%;-}-h1 a, h2 a, h3 a, h4 a, h5 a { - text-decoration: none;- color: #009900; -}-h1, h2, h3, h4, h5 { font-family: verdana;- font-weight: bold;- color: #009900; }-h1 {- font-size: 130%;-}--h2 {- font-size: 110%;- border-bottom: 1px dotted black;-}--h3 {- font-size: 95%;-}--h4 {- font-size: 90%;- font-style: italic;-}--h5 {- font-size: 90%;- font-style: italic;-}--h1.title {- font-size: 150%;- font-weight: bold;- text-align: left;- border: none;-}--dt code {- font-weight: bold;-}-dd p {- margin-top: 0;-}--a:link {- color: #009900- }--a:visited {- color: #669966- }-a:hover {- color: #669966- }-a:active {- color: #009900- }--#footer {- padding-top: 1em;- font-size: 70%;- color: gray;- text-align: center;-}-