1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
|
<!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 tempalte --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>
</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 ProgramName 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
>
|