From e85b0920a06ad019754e1cb8e72eb6cc34cdeedc Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Thu, 12 Jul 2007 19:50:34 +0200 Subject: 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 darcs-hash:20070712175034-d6583-f10174bb3b0a9b4f6e08d05052c18f30e539b319.gz --- xmobar.config-sample | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'xmobar.config-sample') diff --git a/xmobar.config-sample b/xmobar.config-sample index e2d54a6..3092cbc 100644 --- a/xmobar.config-sample +++ b/xmobar.config-sample @@ -7,15 +7,15 @@ Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*" , height = 15 , align = "right" , refresh = 10 - , commands = [ (Weather "EGPF" ["-t",": C","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"], 36000) - , (Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"], 10) - , (Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"], 10) - , (Cpu ["-L","3","-H","50","--normal","green","--high","red"], 10) - , (Exec "date" ["+\"%a %b %_d %H:%M\""] "mydate", 600) - , (Exec "date" ["+%Y"] "year", 304128000) - , (Memory ["-t","Mem: %"], 10) - , (Swap [], 10) - , (Exec "uname" ["-s","-r"] "", 36000) + , commands = [ Run Weather "EGPF" ["-t",": 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 + , Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10 + , Run Com "date" ["+\"%a %b %_d %H:%M\""] "mydate" 600 + , Run Com "date" ["+%Y"] "year" 304128000 + , Run Memory ["-t","Mem: %"] 10 + , Run Swap [] 10 + , Run Com "uname" ["-s","-r"] "" 36000 ] , sepChar = "%" , template = "%cpu% | %memory% * %swap% | %eth0% - %eth1% | %EGPF% | %mydate% of %year% %uname%" -- cgit v1.2.3