Codebase list xmobar / b9b85bb
New upstream version 0.30 Apollon Oikonomopoulos 4 years ago
25 changed file(s) with 575 addition(s) and 172 deletion(s). Raw diff Collapse all Expand all
1212 /out/
1313 /cabal.config
1414 codex.tags
15 cabal.project.local
15 cabal.project.localtags
16 *.swp
17 tags
18 /cabal.project.local
0 ## Version 0.30 (August, 2019)
1
2 _New features_
3
4 - New monitor `MultiCoreTemp`, thanks to Felix Springer.
5 - `DiskIO`: Additional template variables for absolute number of
6 bytes rather than speeds (see [issue #390].
7 - `WeatherX`: An extension to the `Weather` monitor allowing the
8 spefication of custom strings or icons for sky conditions.
9 - The battery monitors accept the new arguments `-a` and `-A` to
10 specify a system command executed if battery left goes beyond a
11 given threshold.
12
13 [issue #390]: https://github.com/jaor/xmobar/issues/390
14
15 ## Version 0.29.5 (March, 2019)
16
17 _Bug fixes_
18
19 - Honour command line flags when starting xmobar without any
20 configuration file (issue #375).
21 - `Alsa` plugin: restart `alsactl` if it quits, e.g. because of a
22 sleep/awake cycle (issue #376).
23 - `Weather` using the new HTTPS URL, which requires http-conduit as
24 a dependency (issue #378).
25 - `MarqueePipeReader` exported at the API level (issue #381).
26
027 ## Version 0.29.4 (December, 2018)
128
229 Upgrade to alsa-mixer 0.3.0. See issues #372 and #373.
0 { mkDerivation, alsa-core, alsa-mixer, async, base, bytestring
1 , containers, dbus, directory, extensible-exceptions, filepath
2 , hinotify, hspec, http-conduit, http-types, iwlib, libmpd, libXpm
3 , libXrandr, libXrender, mtl, old-locale, parsec, parsec-numbers
4 , process, regex-compat, stdenv, stm, temporary, time
5 , timezone-olson, timezone-series, transformers, unix, utf8-string
6 , wirelesstools, X11, X11-xft
7 }:
8 mkDerivation {
9 pname = "xmobar";
10 version = "0.29.5";
11 src = ./.;
12 configureFlags = [
13 "-fwith_alsa" "-fwith_conduit" "-fwith_datezone" "-fwith_dbus"
14 "-fwith_inotify" "-fwith_iwlib" "-fwith_mpd" "-fwith_mpris"
15 "-fwith_rtsopts" "-fwith_threaded" "-fwith_utf8" "-fwith_uvmeter"
16 "-fwith_weather" "-fwith_xft" "-fwith_xpm"
17 ];
18 isLibrary = true;
19 isExecutable = true;
20 libraryHaskellDepends = [
21 alsa-core alsa-mixer async base bytestring containers dbus
22 directory extensible-exceptions filepath hinotify http-conduit
23 http-types iwlib libmpd mtl old-locale parsec parsec-numbers
24 process regex-compat stm time timezone-olson timezone-series
25 transformers unix utf8-string X11 X11-xft
26 ];
27 librarySystemDepends = [
28 libXpm libXrandr libXrender wirelesstools
29 ];
30 executableHaskellDepends = [
31 async base containers directory filepath parsec unix X11
32 ];
33 testHaskellDepends = [
34 alsa-core alsa-mixer async base bytestring containers directory
35 filepath hspec mtl old-locale parsec parsec-numbers process
36 regex-compat stm temporary time transformers unix X11
37 ];
38 doCheck = false;
39 homepage = "http://xmobar.org";
40 description = "A Minimalistic Text Based Status Bar";
41 license = stdenv.lib.licenses.bsd3;
42 }
+0
-32
doc/web/Makefile less more
0 index.src = ../readme.md
1 index = readme.md
2 releases = ../news.md
3 css = xmobar.css
4 images = xmobar-sawfish.png xmobar-xmonad.png
5 remote = community.haskell.org:/srv/projects/xmobar/
6 htmls = index.html releases.html
7 title = % xmobar - a minimalistic status bar
8
9 default: index.html
10
11 $(index): $(index.src)
12 @tail -n+3 $(index.src) | sed "1s/^/$(title)\n/" > $(index)
13
14 index.html: releases.html $(index) $(css)
15 pandoc -f markdown -t html -c $(css) --toc -N -s \
16 $(index) > index.html
17
18 releases.html: $(releases) $(css)
19 pandoc -f markdown -t html -c $(css) -s \
20 $(releases) > releases.html
21
22 upload-images:
23 rsync -zav $(images) $(remote)
24
25 upload-pages: $(htmls)
26 scp $(htmls) $(css) $(remote)
27
28 upload: upload-images upload-pages
29
30 clean:
31 rm -f $(htmls) $(index)
0 index.src = ../../readme.md
1 index = readme.md
2 releases = ../../changelog.md
3 css = xmobar.css
4 images = ../xmobar-sawfish.png ../xmobar-xmonad.png
5 remote = root@xmobar.org:/var/www/xmobar.org/
6 htmls = index.html releases.html
7 title = % xmobar - a minimalistic status bar
8
9 default: index.html
10
11 $(index): $(index.src)
12 @tail -n+3 $(index.src) | sed "1s/^/$(title)\n/" > $(index)
13
14 index.html: releases.html $(index) $(css)
15 pandoc -f markdown -t html -c $(css) --toc -N -s \
16 $(index) > index.html
17
18 releases.html: $(releases) $(css)
19 pandoc -f markdown -t html -c $(css) -s \
20 $(releases) > releases.html
21
22 imgs:
23 cp $(images) .
24
25 upload-images: imgs
26 rsync -zav $(images) $(remote)
27
28 upload-pages: $(htmls)
29 scp $(htmls) $(css) $(remote)
30
31 upload: upload-images upload-pages
32
33 clean:
34 rm -f $(htmls) $(index) *.png
+0
-1
doc/web/xmobar-sawfish.png less more
0 ../xmobar-sawfish.png
+0
-1
doc/web/xmobar-xmonad.png less more
0 ../xmobar-xmonad.png
1212 }
1313 pre {
1414 border: 1px dotted gray;
15 background-color: #efebe7;
15 background-color: #fafafa;
1616 color: #111111;
1717 padding: 0.5em;
1818 }
00 ------------------------------------------------------------------------------
11 -- |
2 -- Copyright: (c) 2018 Jose Antonio Ortega Ruiz
2 -- Copyright: (c) 2018, 2019 Jose Antonio Ortega Ruiz
33 -- License: BSD3-style (see LICENSE)
44 --
55 -- Maintainer: jao@gnu.org
2929 -- Configuration, using predefined monitors as well as our HelloWorld
3030 -- plugin:
3131
32 config :: Config
3233 config = defaultConfig {
3334 font = "xft:Sans Mono-9"
3435 , additionalFonts = []
1010 features, like dynamic color management, icons, output templates, and
1111 extensibility through plugins.
1212
13 [This screenshot](doc/xmobar-sawfish.png) shows xmobar running under
14 [sawfish], and [this one](doc/xmobar-xmonad.png) is a desktop with
15 [xmonad] and two instances of xmobar.
13 These are two xmobar instances using the author's configuration:
14
15 ![top](https://gitlab.com/jaor/xmobar-config/raw/master/img/xmobar-top.png)
16
17 ![bottom](https://gitlab.com/jaor/xmobar-config/raw/master/img/xmobar-bottom.png)
18
19 and [this one](doc/xmobar-xmonad.png) is a full desktop with [xmonad]
20 and, again, two instances of xmobar.
1621
1722 [xmonad]: http://xmonad.org
1823 [Ion3]: http://tuomov.iki.fi/software/
129134 .xpm files in `<icon>`. Requires the [libXpm] C library.
130135
131136 - `with_uvmeter` Enables UVMeter plugin. The plugin shows UV data for
132 Australia. Requires `with_conduit` to connect to HTTPS URLs.
137 Australia.
133138
134139 - `with_weather` Support to display weather information. Enables
135140 Weather plugin.
136
137 - `with_conduit` Use http-conduit for getting weather data enabling
138 support for http proxies. Requires [http-conduit] and [http-types].
139 Note that this flag has only an effect if `with_weather` is also set.
140141
141142 - `all_extensions` Enables all the extensions above.
142143
742743 - Default template: `<station>: <tempC>C, rh <rh>% (<hour>)`
743744 - Retrieves weather information from http://tgftp.nws.noaa.gov.
744745
746 ### `WeatherX StationID SkyConditions Args RefreshRate`
747
748 - Works in the same way as `Weather`, but takes an additional
749 argument, a list of pairs from sky conditions to their replacement
750 (typically a unicode string or an icon specification).
751 - Use the variable `skyConditionS` to display the replacement of the
752 corresponding sky condition. All other `Weather` template variables
753 are available as well.
754
755 For example:
756
757 ```haskell
758 WeatherX "LEBL"
759 [ ("clear", "🌣")
760 , ("sunny", "🌣")
761 , ("mostly clear", "🌤")
762 , ("mostly sunny", "🌤")
763 , ("partly sunny", "⛅")
764 , ("fair", "🌑")
765 , ("cloudy","☁")
766 , ("overcast","☁")
767 , ("partly cloudy", "⛅")
768 , ("mostly cloudy", "🌧")
769 , ("considerable cloudiness", "⛈")]
770 ["-t", "<fn=2><skyConditionS></fn> <tempC>° <rh>% <windKmh> (<hour>)"
771 , "-L","10", "-H", "25", "--normal", "black"
772 , "--high", "lightgoldenrod4", "--low", "darkseagreen4"]
773 18000
774 ```
775
776 As mentioned, the replacement string can also be an icon
777 specification, such as `("clear", "<icon=weather-clear.xbm/>")`.
778
745779 ### `Network Interface Args RefreshRate`
746780
747781 - Aliases to the interface name: so `Network "eth0" []` can be used as
868902 - `-p`: color to display positive power (battery charging)
869903 - `-f`: file in `/sys/class/power_supply` with AC info (default:
870904 "AC/online")
905 - `-A`: a number between 0 and 100, threshold below which the action
906 given by `-a`, if any, is performed (default: 5)
907 - `-a`: a string with a system command that is run when the
908 percentage left in the battery is less or equal than the threshold
909 given by the `-A` option. If not present, no action is
910 undertaken.
871911 - `--on-icon-pattern`: dynamic string for current battery charge
872912 when AC is "on" in `leftipat`.
873913 - `--off-icon-pattern`: dynamic string for current battery charge
886926 "-L", "10", "-H", "80", "-p", "3",
887927 "--", "-O", "<fc=green>On</fc> - ", "-i", "",
888928 "-L", "-15", "-H", "-5",
889 "-l", "red", "-m", "blue", "-h", "green"]
929 "-l", "red", "-m", "blue", "-h", "green"
930 "-a", "notify-send -u critical 'Battery running out!!'",
931 "-A", "3"]
890932 600
891933
892934 In the above example, the thresholds before the "--" separator
893935 affect only the `<left>` and `<leftbar>` fields, while those after
894936 the separator affect how `<watts>` is displayed. For this monitor,
895937 neither the generic nor the specific options have any effect on
896 `<timeleft>`.
938 `<timeleft>`. We are also telling the monitor to execute the unix
939 command `notify-send` when the percentage left in the battery
940 reaches 6%.
897941
898942 It is also possible to specify template variables in the `-O` and
899943 `-o` switches, as in the following example:
9671011
9681012 - Aliases to `diskio`
9691013 - Disks: list of pairs of the form (device or mount point, template),
970 where the template can contain `<total>`, `<read>`, `<write>` for total,
971 read and write speed, respectively. There are also bar versions of each:
972 `<totalbar>`, `<totalvbar>`, `<totalipat>`,
973 `<readbar>`, `<readvbar>`, `<readipat>`,
974 `<writebar>`, `<writevbar>`, and `<writeipat>`.
1014 where the template can contain `<total>`, `<read>`, `<write>` for
1015 total, read and write speed, respectively, as well as `<totalb>`,
1016 `<readb>`, `<writeb>`, which report number of bytes during the last
1017 refresh period rather than speed. There are also bar versions of
1018 each: `<totalbar>`, `<totalvbar>`, `<totalipat>`, `<readbar>`,
1019 `<readvbar>`, `<readipat>`, `<writebar>`, `<writevbar>`, and
1020 `<writeipat>`; and their "bytes" counterparts: `<totalbbar>`,
1021 `<totalbvbar>`, `<totalbipat>`, `<readbbar>`, `<readbvbar>`,
1022 `<readbipat>`, `<writebbar>`, `<writebvbar>`, and `<writebipat>`.
9751023 - Thresholds refer to speed in b/s
9761024 - Args: default monitor arguments. `-t`/`--template` is ignored. Plus
9771025 - `--total-icon-pattern`: dynamic string for total disk I/O in `<totalipat>`.
10441092 Run CoreTemp ["-t", "Temp:<core0>|<core1>C",
10451093 "-L", "40", "-H", "60",
10461094 "-l", "lightblue", "-n", "gray90", "-h", "red"] 50
1095
1096 ### `MultiCoreTemp Args RefreshRate`
1097
1098 - Aliases to `multicoretemp`
1099 - Args: default monitor arguments, plus:
1100 - `--max-icon-pattern`: dynamic string for overall cpu load in `maxipat`.
1101 - `--avg-icon-pattern`: dynamic string for overall cpu load in `avgipat`.
1102 - `--mintemp`: temperature in degree Celsius, that sets the lower
1103 limit for percentage calculation.
1104 - `--maxtemp`: temperature in degree Celsius, that sets the upper
1105 limit for percentage calculation.
1106 - Thresholds refer to temperature in degree Celsius
1107 - Variables that can be used with the `-t`/`--template` argument:
1108 `max`, `maxpc`, `maxbar`, `maxvbar`, `maxipat`,
1109 `avg`, `avgpc`, `avgbar`, `avgvbar`, `avgipat`,
1110 `core0`, `core1`, ..., `coreN`
1111
1112 The *pc, *bar, *vbar and *ipat variables are showing percentages on the scale
1113 defined by `--mintemp` and `--maxtemp`.
1114 The max* and avg* variables to the highest and the average core temperature.
1115 - Default template: `Temp: <max>°C - <maxpc>%`
1116 - This monitor requires coretemp module to be loaded in kernel
1117 - Example:
1118
1119 Run MultiCoreTemp ["-t", "Temp: <avg>°C | <avgpc>%",
1120 "-L", "60", "-H", "80",
1121 "-l", "green", "-n", "yellow", "-h", "red"
1122 "--", "--mintemp", "20", "--maxtemp", "100"] 50
10471123
10481124 ### `Volume Mixer Element Args RefreshRate`
10491125
14701546
14711547 `start` must receive a callback to be used to display the `String`
14721548 produced by the plugin. This method can be used for plugins that need
1473 to perform asynchronous actions. See `Plugins/PipeReader.hs` for an
1474 example.
1549 to perform asynchronous actions. See
1550 `src/Xmobar/Plugins/PipeReader.hs` for an example.
14751551
14761552 `run` can be used for simpler plugins. If you define only `run` the
14771553 plugin will be run every second. To overwrite this default you just
14781554 need to implement `rate`, which must return the number of tenth of
1479 seconds between every successive runs. See `Plugins/HelloWorld.hs` for
1480 an example of a plugin that runs just once, and `Plugins/Date.hs` for
1481 one that implements `rate`.
1555 seconds between every successive runs. See `examples/xmobar.hs` for an
1556 example of a plugin that runs just once, and
1557 `src/Xmobar/Plugins/Date.hs` for one that implements `rate`.
14821558
14831559 Notice that Date could be implemented as:
14841560
15071583
15081584 To use your new plugin, you need to use a pure Haskell configuration
15091585 for xmobar, and load your definitions there. You can see an example
1510 in [examples/xmobar.hs] showing you how to write a Haskell
1511 configuration that uses a new plugin, all in one file.
1586 in [examples/xmobar.hs](./examples/xmobar.hs) showing you how to write
1587 a Haskell configuration that uses a new plugin, all in one file.
15121588
15131589 When xmobar runs with the full path to that Haskell file as its
15141590 argument (or if you put it in `~/.config/xmobar/xmobar.hs`), and with
15171593
15181594 That's it!
15191595
1596 ## Configurations written in pure Haskell
1597
1598 xmobar can be used as a pure Haskell program, that is compiled with
1599 your specific configuration, expressed as Haskell source code. For an
1600 example, see [the author's
1601 configuration](https://gitlab.com/jaor/xmobar-config/).
1602
15201603 # Authors and credits
15211604
15221605 Andrea Rossato originally designed and implemented xmobar up to
15241607 with the help of the greater xmobar and Haskell communities.
15251608
15261609 In particular, xmobar [incorporates patches] by Mohammed Alshiekh,
1527 Axel Angel, Dragos Boca, Ben Boeckel, Duncan Burke, Roman Cheplyaka,
1528 Patrick Chilton, Antoine Eiche, Nathaniel Wesley Filardo, John
1529 Goerzen, Reto Hablützel, Juraj Hercek, Tomáš Janoušek, Ada Joule,
1530 Spencer Janssen, Roman Joost, Jochen Keil, Lennart Kolmodin, Krzysztof
1531 Kosciuszkiewicz, Dmitry Kurochkin, Todd Lunter, Vanessa McHale, Robert
1532 J. Macomber, Dmitry Malikov, David McLean, Marcin Mikołajczyk, Dino
1533 Morelli, Tony Morris, Eric Mrak, Thiago Negri, Edward O'Callaghan,
1534 Svein Ove, Martin Perner, Jens Petersen, Alexander Polakov, Pavan
1535 Rikhi, Petr Rockai, Andrew Sackville-West, Markus Scherer, Daniel
1536 Schüssler, Olivier Schneider, Alexander Shabalin, Valentin Shirokov,
1537 Peter Simons, Alexander Solovyov, Will Song, John Soros, Travis
1538 Staton, Artem Tarasov, Samuli Thomasson, Edward Tjörnhammar, Sergei
1539 Trofimovich, Thomas Tuegel, Jan Vornberger, Anton Vorontsov, Daniel
1540 Wagner, Zev Weiss, Phil Xiaojun Hu, Edward Z. Yang and Norbert Zeh.
1610 Alex Ameen, Axel Angel, Claudio Bley, Dragos Boca, Ben Boeckel, Duncan
1611 Burke, Roman Cheplyaka, Patrick Chilton, Antoine Eiche, Nathaniel
1612 Wesley Filardo, John Goerzen, Reto Hablützel, Juraj Hercek, Tomáš
1613 Janoušek, Ada Joule, Spencer Janssen, Roman Joost, Jochen Keil,
1614 Lennart Kolmodin, Krzysztof Kosciuszkiewicz, Dmitry Kurochkin, Todd
1615 Lunter, Vanessa McHale, Robert J. Macomber, Dmitry Malikov, David
1616 McLean, Marcin Mikołajczyk, Dino Morelli, Tony Morris, Eric Mrak,
1617 Thiago Negri, Edward O'Callaghan, Svein Ove, Martin Perner, Jens
1618 Petersen, Alexander Polakov, Pavan Rikhi, Petr Rockai, Andrew
1619 Sackville-West, Markus Scherer, Daniel Schüssler, Olivier Schneider,
1620 Alexander Shabalin, Valentin Shirokov, Peter Simons, Alexander
1621 Solovyov, Will Song, John Soros, Felix Springer, Travis Staton, Artem
1622 Tarasov, Samuli Thomasson, Edward Tjörnhammar, Sergei Trofimovich,
1623 Thomas Tuegel, Jan Vornberger, Anton Vorontsov, Daniel Wagner, Zev
1624 Weiss, Phil Xiaojun Hu, Edward Z. Yang and Norbert Zeh.
15411625
15421626 [jao]: http://jao.io
15431627 [incorporates patches]: http://www.ohloh.net/p/xmobar/contributors
15741658 This software is released under a BSD-style license. See [LICENSE] for
15751659 more details.
15761660
1577 Copyright &copy; 2010-2018 Jose Antonio Ortega Ruiz
1661 Copyright &copy; 2010-2019 Jose Antonio Ortega Ruiz
15781662
15791663 Copyright &copy; 2007-2010 Andrea Rossato
15801664
00 ------------------------------------------------------------------------------
11 -- |
22 -- Module: Xmobar.App.Main
3 -- Copyright: (c) 2018 Jose Antonio Ortega Ruiz
3 -- Copyright: (c) 2018, 2019 Jose Antonio Ortega Ruiz
44 -- License: BSD3-style (see LICENSE)
55 --
66 -- Maintainer: jao@gnu.org
9898 case cf of
9999 Nothing -> case rest of
100100 (c:_) -> error $ c ++ ": file not found"
101 _ -> xmobar defaultConfig
101 _ -> doOpts defaultConfig flags >>= xmobar
102102 Just p -> do r <- readConfig defaultConfig p
103103 case r of
104104 Left e ->
00 ------------------------------------------------------------------------------
11 -- |
22 -- Module: Xmobar.App.Opts
3 -- Copyright: (c) 2018 Jose Antonio Ortega Ruiz
3 -- Copyright: (c) 2018, 2019 Jose Antonio Ortega Ruiz
44 -- License: BSD3-style (see LICENSE)
55 --
66 -- Maintainer: jao@gnu.org
104104 info :: String
105105 info = "xmobar " ++ showVersion version
106106 ++ "\n (C) 2007 - 2010 Andrea Rossato "
107 ++ "\n (C) 2010 - 2018 Jose A Ortega Ruiz\n "
107 ++ "\n (C) 2010 - 2019 Jose A Ortega Ruiz\n "
108108 ++ mail ++ "\n" ++ license
109109
110110 mail :: String
1111 --
1212 -----------------------------------------------------------------------------
1313
14 module Xmobar.Plugins.MarqueePipeReader where
14 module Xmobar.Plugins.MarqueePipeReader(MarqueePipeReader(..)) where
1515
1616 import System.IO (openFile, IOMode(ReadWriteMode), Handle)
1717 import Xmobar.System.Environment
1111 --
1212 -----------------------------------------------------------------------------
1313
14 {-# LANGUAGE PatternGuards #-}
1415 module Xmobar.Plugins.Monitors.Alsa
1516 ( startAlsaPlugin
1617 , withMonitorWaiter
2223 import Control.Concurrent.Async
2324 import Control.Exception
2425 import Control.Monad
26 import Data.IORef
27 import Data.Time.Clock
2528 import Xmobar.Plugins.Monitors.Common
2629 import qualified Xmobar.Plugins.Monitors.Volume as Volume;
2730 import System.Console.GetOpt
2831 import System.Directory
2932 import System.Exit
3033 import System.IO
34 import System.IO.Error
3135 import System.Process
36
37 alsaCtlRestartRateLimit :: NominalDiffTime
38 alsaCtlRestartRateLimit = 3 -- 'Num NominalDiffTime' assumes seconds
3239
3340 data AlsaOpts = AlsaOpts
3441 { aoVolumeOpts :: Volume.VolumeOpts
7582 opts2 <- io $ parseOpts args2
7683 Volume.runVolumeWith (aoVolumeOpts opts2) mixerName controlName
7784
78 withMonitorWaiter mixerName (aoAlsaCtlPath opts) $ \wait_ ->
85 withMonitorWaiter mixerName (aoAlsaCtlPath opts) cb $ \wait_ ->
7986 runMB args Volume.volumeConfig run wait_ cb
8087
81 withMonitorWaiter :: String -> Maybe FilePath -> (IO () -> IO a) -> IO a
82 withMonitorWaiter mixerName alsaCtlPath cont = do
88 withMonitorWaiter :: String -> Maybe FilePath -> (String -> IO ()) -> (IO () -> IO a) -> IO a
89 withMonitorWaiter mixerName alsaCtlPathOverride outputCallback cont = do
8390 mvar <- newMVar ()
8491
85 path <- determineAlsaCtlPath
92 effectivePath <- determineAlsaCtlPath
8693
87 bracket (async $ readerThread mvar path) cancel $ \a -> do
94 bracket (async $ alsaReaderThread mixerName effectivePath outputCallback mvar) cancel $ \a -> do
8895
8996 -- Throw on this thread if there's an exception
9097 -- on the reader thread.
93100 cont $ takeMVar mvar
94101
95102 where
96
97 readerThread mvar path =
98 let createProc = (proc "stdbuf" ["-oL", path, "monitor", mixerName])
99 {std_out = CreatePipe}
100 in
101 withCreateProcess createProc $ \_ (Just alsaOut) _ _ -> do
102 hSetBuffering alsaOut LineBuffering
103
104 forever $ do
105 c <- hGetChar alsaOut
106 when (c == '\n') $
107 -- This uses 'tryPutMVar' because 'putMVar' would make 'runVolume' run
108 -- once for each event. But we want it to run only once after a burst
109 -- of events.
110 void $ tryPutMVar mvar ()
111
112103 defaultPath = "/usr/sbin/alsactl"
113104
114105 determineAlsaCtlPath =
115 case alsaCtlPath of
106 case alsaCtlPathOverride of
116107 Just path -> do
117108 found <- doesFileExist path
118109 if found
136127 alsaCtlOptionName ++ "=/path/to/alsactl"
137128
138129
130 alsaReaderThread :: String -> String -> (String -> IO a) -> MVar () -> IO b
131 alsaReaderThread mixerName alsaCtlPath outputCallback mvar =
132 let createProc = (proc "stdbuf" ["-oL", alsaCtlPath, "monitor", mixerName])
133 {std_out = CreatePipe}
134
135 runAlsaOnce =
136 withCreateProcess createProc $ \_ (Just alsaOut) _ _ -> do
137 hSetBuffering alsaOut LineBuffering
138
139 tryPutMVar mvar () -- Refresh immediately after restarting alsactl
140
141 forever $ do
142 c <- hGetChar alsaOut
143 when (c == '\n') $
144 -- This uses 'tryPutMVar' because 'putMVar' would make 'runVolume' run
145 -- once for each event. But we want it to run only once after a burst
146 -- of events.
147 void $ tryPutMVar mvar ()
148 in do
149 limiter <- createRateLimiter alsaCtlRestartRateLimit
150
151 forever $ do
152 limiter
153
154 catchJust
155 (guard . isEOFError)
156 runAlsaOnce
157 pure
158
159 outputCallback "Restarting alsactl..."
160
161
162
139163 -- This is necessarily very inefficient on 'String's
140164 trimTrailingNewline :: String -> String
141165 trimTrailingNewline x =
143167 '\n' : '\r' : y -> reverse y
144168 '\n' : y -> reverse y
145169 _ -> x
170
171 -- |
172 -- Returns an IO action that completes at most once per @interval@.
173 -- The returned cation is not safe for concurrent use.
174 createRateLimiter :: NominalDiffTime -> IO (IO ())
175 createRateLimiter interval = do
176 prevTimeRef <- newIORef Nothing
177
178 let
179 limiter = do
180 prevTime0 <- readIORef prevTimeRef
181 curTime <- getCurrentTime
182
183 case prevTime0 of
184 Just prevTime | diff <- interval - (curTime `diffUTCTime` prevTime),
185 diff > 0
186 -> do
187 threadDelayNDT diff
188 writeIORef prevTimeRef . Just =<< getCurrentTime
189
190 _ -> writeIORef prevTimeRef (Just curTime)
191
192 pure limiter
193
194 threadDelayNDT :: NominalDiffTime -> IO ()
195 threadDelayNDT ndt =
196 threadDelay (round (realToFrac ndt * 1e6 :: Double))
00 -----------------------------------------------------------------------------
11 -- |
22 -- Module : Plugins.Monitors.Batt
3 -- Copyright : (c) 2010, 2011, 2012, 2013, 2015, 2016, 2018 Jose A Ortega
3 -- Copyright : (c) 2010, 2011, 2012, 2013, 2015, 2016, 2018, 2019 Jose A Ortega
44 -- (c) 2010 Andrea Rossato, Petr Rockai
55 -- License : BSD-style (see LICENSE)
66 --
1414
1515 module Xmobar.Plugins.Monitors.Batt ( battConfig, runBatt, runBatt' ) where
1616
17 import System.Process (system)
18 import Control.Monad (void, unless)
1719 import Control.Exception (SomeException, handle)
1820 import Xmobar.Plugins.Monitors.Common
1921 import System.FilePath ((</>))
3537 , highWColor :: Maybe String
3638 , lowThreshold :: Float
3739 , highThreshold :: Float
40 , onLowAction :: Maybe String
41 , actionThreshold :: Float
3842 , onlineFile :: FilePath
3943 , scale :: Float
4044 , onIconPattern :: Maybe IconPattern
5155 , lowWColor = Nothing
5256 , mediumWColor = Nothing
5357 , highWColor = Nothing
58 , onLowAction = Nothing
59 , actionThreshold = 6
5460 , lowThreshold = 10
5561 , highThreshold = 12
5662 , onlineFile = "AC/online"
7379 , Option "H" ["hight"] (ReqArg (\x o -> o { highThreshold = read x }) "") ""
7480 , Option "f" ["online"] (ReqArg (\x o -> o { onlineFile = x }) "") ""
7581 , Option "s" ["scale"] (ReqArg (\x o -> o {scale = read x}) "") ""
82 , Option "a" ["action"] (ReqArg (\x o -> o { onLowAction = Just x }) "") ""
83 , Option "A" ["action-threshold"]
84 (ReqArg (\x o -> o { actionThreshold = read x }) "") ""
7685 , Option "" ["on-icon-pattern"] (ReqArg (\x o ->
7786 o { onIconPattern = Just $ parseIconPattern x }) "") ""
7887 , Option "" ["off-icon-pattern"] (ReqArg (\x o ->
171180 mostCommonDef :: Eq a => a -> [a] -> a
172181 mostCommonDef x xs = head $ last $ [x] : sortOn length (group xs)
173182
183 maybeAlert :: BattOpts -> Float -> IO ()
184 maybeAlert opts left =
185 case onLowAction opts of
186 Nothing -> return ()
187 Just x -> unless (isNaN left || actionThreshold opts < 100 * left)
188 $ void $ system x
189
174190 readBatteries :: BattOpts -> [Files] -> IO Result
175191 readBatteries opts bfs =
176192 do let bfs' = filter (/= NoFiles) bfs
191207 | time == 0 = Idle
192208 | ac = Charging
193209 | otherwise = Discharging
210 unless ac (maybeAlert opts left)
194211 return $ if isNaN left then NA else Result left watts time racst
195212
196213 runBatt :: [String] -> Monitor String
208225 do l <- fmtPercent x
209226 ws <- fmtWatts w opts suffix d
210227 si <- getIconPattern opts s x
211 parseTemplate (l ++ [fmtStatus opts s nas, fmtTime $ floor t, ws, si])
228 st <- showWithColors' (fmtStatus opts s nas) (100 * x)
229 parseTemplate (l ++ [st, fmtTime $ floor t, ws, si])
212230 NA -> getConfigValue naString
213231 where fmtPercent :: Float -> Monitor [String]
214232 fmtPercent x = do
00 -----------------------------------------------------------------------------
11 -- |
22 -- Module : Plugins.Monitors.Disk
3 -- Copyright : (c) 2010, 2011, 2012, 2014, 2018 Jose A Ortega Ruiz
3 -- Copyright : (c) 2010, 2011, 2012, 2014, 2018, 2019 Jose A Ortega Ruiz
44 -- License : BSD-style (see LICENSE)
55 --
66 -- Maintainer : Jose A Ortega Ruiz <jao@gnu.org>
5353
5454 diskIOConfig :: IO MConfig
5555 diskIOConfig = mkMConfig "" ["total", "read", "write"
56 ,"totalb", "readb", "writeb"
5657 ,"totalbar", "readbar", "writebar"
58 ,"totalbbar", "readbbar", "writebbar"
5759 ,"totalvbar", "readvbar", "writevbar"
60 ,"totalbvbar", "readbvbar", "writebvbar"
5861 ,"totalipat", "readipat", "writeipat"
62 ,"totalbipat", "readbipat", "writebipat"
5963 ]
6064
6165 data DiskUOpts = DiskUOpts
147151 case find ((==dev) . fst) dat of
148152 Nothing -> (dev, [0, 0, 0])
149153 Just (_, xs) ->
150 let rSp = speed (xs !! 2) (xs !! 3)
151 wSp = speed (xs !! 6) (xs !! 7)
152 sp = speed (xs !! 2 + xs !! 6) (xs !! 3 + xs !! 7)
153 speed x t = if t == 0 then 0 else 500 * x / t
154 dat' = if length xs > 6 then [sp, rSp, wSp] else [0, 0, 0]
154 let r = xs !! 2
155 w = xs !! 6
156 t = r + w
157 rSp = speed r (xs !! 3)
158 wSp = speed w (xs !! 7)
159 sp = speed t (xs !! 3 + xs !! 7)
160 speed x d = if d == 0 then 0 else 500 * x / d
161 dat' = if length xs > 6
162 then [sp, rSp, wSp, t, r, w]
163 else [0, 0, 0, 0, 0, 0]
155164 in (dev, dat')
156165
157166 speedToStr :: Float -> String
183192 b <- mapM (showLogBar 0.8) xs
184193 vb <- mapM (showLogVBar 0.8) xs
185194 ipat <- mapM (\(f,v) -> showLogIconPattern (f opts) 0.8 v)
186 $ zip [totalIconPattern, readIconPattern, writeIconPattern] xs
195 $ zip [totalIconPattern, readIconPattern, writeIconPattern
196 , totalIconPattern, readIconPattern, writeIconPattern]
197 xs
187198 setConfigValue tmp template
188199 parseTemplate $ s ++ b ++ vb ++ ipat
189200
8484 runMPRIS :: (MprisVersion a) => a -> String -> [String] -> Monitor String
8585 runMPRIS version playerName _ = do
8686 metadata <- io $ getMetadata version dbusClient playerName
87 if [] == metadata then
87 if null metadata then
8888 getConfigValue naString
8989 else mapM showWithPadding (makeList version metadata) >>= parseTemplate
9090
0 -----------------------------------------------------------------------------
1 -- |
2 -- Module : Plugins.Monitors.MultiCoreTemp
3 -- Copyright : (c) 2019 Felix Springer
4 -- License : BSD-style (see LICENSE)
5 --
6 -- Maintainer : Felix Springer <felixspringer149@gmail.com>
7 -- Stability : unstable
8 -- Portability : unportable
9 --
10 -- A core temperature monitor for Xmobar
11 --
12 -----------------------------------------------------------------------------
13
14 module Xmobar.Plugins.Monitors.MultiCoreTemp (startMultiCoreTemp) where
15
16 import Xmobar.Plugins.Monitors.Common
17 import Control.Monad (filterM)
18 import System.Console.GetOpt
19 import System.Directory ( doesDirectoryExist
20 , doesFileExist
21 )
22
23 -- | Declare Options.
24 data CTOpts = CTOpts { maxIconPattern :: Maybe IconPattern
25 , avgIconPattern :: Maybe IconPattern
26 , mintemp :: Float
27 , maxtemp :: Float
28 }
29
30 -- | Set default Options.
31 defaultOpts :: CTOpts
32 defaultOpts = CTOpts { maxIconPattern = Nothing
33 , avgIconPattern = Nothing
34 , mintemp = 0
35 , maxtemp = 100
36 }
37
38 -- | Apply configured Options.
39 options :: [OptDescr (CTOpts -> CTOpts)]
40 options = [ Option [] ["max-icon-pattern"]
41 (ReqArg
42 (\ arg opts -> opts { maxIconPattern = Just $ parseIconPattern arg })
43 "")
44 ""
45 , Option [] ["avg-icon-pattern"]
46 (ReqArg
47 (\ arg opts -> opts { avgIconPattern = Just $ parseIconPattern arg })
48 "")
49 ""
50 , Option [] ["mintemp"]
51 (ReqArg
52 (\ arg opts -> opts { mintemp = read arg })
53 "")
54 ""
55 , Option [] ["maxtemp"]
56 (ReqArg
57 (\ arg opts -> opts { maxtemp = read arg })
58 "")
59 ""
60 ]
61
62 -- | Parse Arguments and apply them to Options.
63 parseOpts :: [String] -> IO CTOpts
64 parseOpts argv = case getOpt Permute options argv of
65 (opts , _ , [] ) -> return $ foldr id defaultOpts opts
66 (_ , _ , errs) -> ioError . userError $ concat errs
67
68 -- | Generate Config with a default template and options.
69 cTConfig :: IO MConfig
70 cTConfig = mkMConfig cTTemplate cTOptions
71 where cTTemplate = "Temp: <max>°C - <maxpc>%"
72 cTOptions = [ "max" , "maxpc" , "maxbar" , "maxvbar" , "maxipat"
73 , "avg" , "avgpc" , "avgbar" , "avgvbar" , "avgipat"
74 ] ++ map (("core" ++) . show) [0 :: Int ..]
75
76 -- | Returns the first coretemp.N path found.
77 coretempPath :: IO String
78 coretempPath = do xs <- filterM doesDirectoryExist ps
79 let x = head xs
80 return x
81 where ps = [ "/sys/bus/platform/devices/coretemp." ++ show (x :: Int) ++ "/" | x <- [0..9] ]
82
83 -- | Returns the first hwmonN path found.
84 hwmonPath :: IO String
85 hwmonPath = do p <- coretempPath
86 xs <- filterM doesDirectoryExist [ p ++ "hwmon/hwmon" ++ show (x :: Int) ++ "/" | x <- [0..9] ]
87 let x = head xs
88 return x
89
90 -- | Checks Labels, if they refer to a core and returns Strings of core-
91 -- temperatures.
92 corePaths :: IO [String]
93 corePaths = do p <- hwmonPath
94 ls <- filterM doesFileExist [ p ++ "temp" ++ show (x :: Int) ++ "_label" | x <- [0..9] ]
95 cls <- filterM isLabelFromCore ls
96 return $ map labelToCore cls
97
98 -- | Checks if Label refers to a core.
99 isLabelFromCore :: FilePath -> IO Bool
100 isLabelFromCore p = do a <- readFile p
101 return $ take 4 a == "Core"
102
103 -- | Transform a path to Label to a path to core-temperature.
104 labelToCore :: FilePath -> FilePath
105 labelToCore = (++ "input") . reverse . drop 5 . reverse
106
107 -- | Reads core-temperatures as data from the system.
108 cTData :: IO [Float]
109 cTData = do fps <- corePaths
110 traverse readSingleFile fps
111 where readSingleFile :: FilePath -> IO Float
112 readSingleFile s = do a <- readFile s
113 return $ parseContent a
114 where parseContent :: String -> Float
115 parseContent = read . head . lines
116
117 -- | Transforms data of temperatures into temperatures of degree Celsius.
118 parseCT :: IO [Float]
119 parseCT = do rawCTs <- cTData
120 let normalizedCTs = map (/ 1000) rawCTs :: [Float]
121 return normalizedCTs
122
123 -- | Performs calculation for maximum and average.
124 -- Sets up Bars and Values to be printed.
125 formatCT :: CTOpts -> [Float] -> Monitor [String]
126 formatCT opts cTs = do let CTOpts { mintemp = minT
127 , maxtemp = maxT } = opts
128 domainT = maxT - minT
129 maxCT = maximum cTs
130 avgCT = sum cTs / fromIntegral (length cTs)
131 calcPc t = (t - minT) / domainT
132 maxCTPc = calcPc maxCT
133 avgCTPc = calcPc avgCT
134
135 cs <- traverse showTempWithColors cTs
136
137 m <- showTempWithColors maxCT
138 mp <- showWithColors' (show (round (100*maxCTPc) :: Int)) maxCT
139 mb <- showPercentBar maxCT maxCTPc
140 mv <- showVerticalBar maxCT maxCTPc
141 mi <- showIconPattern (maxIconPattern opts) maxCTPc
142
143 a <- showTempWithColors avgCT
144 ap <- showWithColors' (show (round (100*avgCTPc) :: Int)) avgCT
145 ab <- showPercentBar avgCT avgCTPc
146 av <- showVerticalBar avgCT avgCTPc
147 ai <- showIconPattern (avgIconPattern opts) avgCTPc
148
149 let ms = [ m , mp , mb , mv , mi ]
150 as = [ a , ap , ab , av , ai ]
151
152 return (ms ++ as ++ cs)
153 where showTempWithColors :: Float -> Monitor String
154 showTempWithColors = showWithColors (show . (round :: Float -> Int))
155
156
157 runCT :: [String] -> Monitor String
158 runCT argv = do cTs <- io parseCT
159 opts <- io $ parseOpts argv
160 l <- formatCT opts cTs
161 parseTemplate l
162
163 startMultiCoreTemp :: [String] -> Int -> (String -> IO ()) -> IO ()
164 startMultiCoreTemp a = runM a cTConfig runCT
1818
1919 import qualified Control.Exception as CE
2020
21 #ifdef HTTP_CONDUIT
2221 import Network.HTTP.Conduit
2322 import Network.HTTP.Types.Status
2423 import Network.HTTP.Types.Method
2524 import qualified Data.ByteString.Lazy.Char8 as B
26 #else
27 import Network.HTTP
28 #endif
25 import Data.Char (toLower)
2926
3027 import Text.ParserCombinators.Parsec
3128
4643 , "windMs"
4744 , "visibility"
4845 , "skyCondition"
46 , "skyConditionS"
4947 , "tempC"
5048 , "tempF"
5149 , "dewPointC"
182180 return [WI st ss y m d h w v sk tC tF dC dF rh p]
183181
184182 defUrl :: String
185 -- "http://weather.noaa.gov/pub/data/observations/metar/decoded/"
186 defUrl = "http://tgftp.nws.noaa.gov/data/observations/metar/decoded/"
183 defUrl = "https://tgftp.nws.noaa.gov/data/observations/metar/decoded/"
187184
188185 stationUrl :: String -> String
189186 stationUrl station = defUrl ++ station ++ ".TXT"
190187
191188 getData :: String -> IO String
192 #ifdef HTTP_CONDUIT
193189 getData station = CE.catch (do
194190 manager <- newManager tlsManagerSettings
195 request <- parseUrl $ stationUrl station
191 request <- parseUrlThrow $ stationUrl station
196192 res <- httpLbs request manager
197193 return $ B.unpack $ responseBody res
198194 ) errHandler
199195 where errHandler :: CE.SomeException -> IO String
200196 errHandler _ = return "<Could not retrieve data>"
201 #else
202 getData station = do
203 let request = getRequest (stationUrl station)
204 CE.catch (simpleHTTP request >>= getResponseBody) errHandler
205 where errHandler :: CE.IOException -> IO String
206 errHandler _ = return "<Could not retrieve data>"
207 #endif
208
209 formatWeather :: [WeatherInfo] -> Monitor String
210 formatWeather [WI st ss y m d h (WindInfo wc wa wm wk wkh wms) v sk tC tF dC dF r p] =
197
198 formatSk :: Eq p => [(p, p)] -> p -> p
199 formatSk ((a,b):sks) sk = if a == sk then b else formatSk sks sk
200 formatSk [] sk = sk
201
202 formatWeather :: [(String,String)] -> [WeatherInfo] -> Monitor String
203 formatWeather sks [WI st ss y m d h (WindInfo wc wa wm wk wkh wms) v sk tC tF dC dF r p] =
211204 do cel <- showWithColors show tC
212205 far <- showWithColors show tF
213 parseTemplate [st, ss, y, m, d, h, wc, wa, wm, wk, wkh, wms, v, sk, cel, far, show dC, show dF, show r , show p ]
214 formatWeather _ = getConfigValue naString
206 let sk' = formatSk sks (map toLower sk)
207 parseTemplate [st, ss, y, m, d, h, wc, wa, wm, wk, wkh
208 , wms, v, sk, sk', cel, far
209 , show dC, show dF, show r , show p ]
210 formatWeather _ _ = getConfigValue naString
215211
216212 runWeather :: [String] -> Monitor String
217 runWeather str =
218 do d <- io $ getData $ head str
213 runWeather = runWeather' []
214
215 runWeather' :: [(String, String)] -> [String] -> Monitor String
216 runWeather' sks args =
217 do d <- io $ getData $ head args
219218 i <- io $ runP parseData d
220 formatWeather i
219 formatWeather sks i
221220
222221 weatherReady :: [String] -> Monitor Bool
223 #ifdef HTTP_CONDUIT
224222 weatherReady str = do
225 initRequest <- parseUrl $ stationUrl $ head str
223 initRequest <- parseUrlThrow $ stationUrl $ head str
226224 let request = initRequest{method = methodHead}
227225 io $ CE.catch ( do
228226 manager <- newManager tlsManagerSettings
234232 | statusIsServerError status = False
235233 | statusIsClientError status = False
236234 | otherwise = True
237 #else
238 weatherReady str = do
239 let station = head str
240 request = headRequest (stationUrl station)
241 io $ CE.catch (simpleHTTP request >>= checkResult) errHandler
242 where errHandler :: CE.IOException -> IO Bool
243 errHandler _ = return False
244 checkResult result =
245 case result of
246 Left _ -> return False
247 Right response ->
248 case rspCode response of
249 -- Permission or network errors are failures; anything
250 -- else is recoverable.
251 (4, _, _) -> return False
252 (5, _, _) -> return False
253 (_, _, _) -> return True
254 #endif
22 -----------------------------------------------------------------------------
33 -- |
44 -- Module : Xmobar.Plugins.Monitors
5 -- Copyright : (c) 2010, 2011, 2012, 2013, 2017, 2018 Jose Antonio Ortega Ruiz
5 -- Copyright : (c) 2010, 2011, 2012, 2013, 2017, 2018, 2019 Jose Antonio Ortega Ruiz
66 -- (c) 2007-10 Andrea Rossato
77 -- License : BSD-style (see LICENSE)
88 --
3333 import Xmobar.Plugins.Monitors.ThermalZone
3434 import Xmobar.Plugins.Monitors.CpuFreq
3535 import Xmobar.Plugins.Monitors.CoreTemp
36 import Xmobar.Plugins.Monitors.MultiCoreTemp
3637 import Xmobar.Plugins.Monitors.Disk
3738 import Xmobar.Plugins.Monitors.Top
3839 import Xmobar.Plugins.Monitors.Uptime
7172 | Brightness Args Rate
7273 | CpuFreq Args Rate
7374 | CoreTemp Args Rate
75 | MultiCoreTemp Args Rate
7476 | TopProc Args Rate
7577 | TopMem Args Rate
7678 | Uptime Args Rate
7779 | CatInt Int FilePath Args Rate
7880 #ifdef WEATHER
7981 | Weather Station Args Rate
82 | WeatherX Station SkyConditions Args Rate
8083 #endif
8184 #ifdef UVMETER
8285 | UVMeter Station Args Rate
102105 type Program = String
103106 type Alias = String
104107 type Station = String
108 type SkyConditions = [(String, String)]
105109 type Zone = String
106110 type ZoneNo = Int
107111 type Interface = String
111115 instance Exec Monitors where
112116 #ifdef WEATHER
113117 alias (Weather s _ _) = s
118 alias (WeatherX s _ _ _) = s
114119 #endif
115120 alias (Network i _ _) = i
116121 alias (DynNetwork _ _) = "dynnetwork"
128133 alias (TopProc _ _) = "top"
129134 alias (TopMem _ _) = "topmem"
130135 alias (CoreTemp _ _) = "coretemp"
136 alias (MultiCoreTemp _ _) = "multicoretemp"
131137 alias DiskU {} = "disku"
132138 alias DiskIO {} = "diskio"
133139 alias (Uptime _ _) = "uptime"
158164 start (TopMem a r) = runM a topMemConfig runTopMem r
159165 #ifdef WEATHER
160166 start (Weather s a r) = runMD (a ++ [s]) weatherConfig runWeather r weatherReady
167 start (WeatherX s c a r) = runMD (a ++ [s]) weatherConfig (runWeather' c) r weatherReady
161168 #endif
162169 start (Thermal z a r) = runM (a ++ [z]) thermalConfig runThermal r
163170 start (ThermalZone z a r) =
170177 start (Brightness a r) = runM a brightConfig runBright r
171178 start (CpuFreq a r) = runM a cpuFreqConfig runCpuFreq r
172179 start (CoreTemp a r) = runM a coreTempConfig runCoreTemp r
180 start (MultiCoreTemp a r) = startMultiCoreTemp a r
173181 start (DiskU s a r) = runM a diskUConfig (runDiskU s) r
174182 start (DiskIO s a r) = startDiskIO s a r
175183 start (Uptime a r) = runM a uptimeConfig runUptime r
5454 -> Parser [[(Widget, ColorString, FontIndex, Maybe [Action])]]
5555 stringParser c f a = manyTill (allParsers c f a) eof
5656
57 -- | Parses a maximal string without color markup.
57 -- | Parses a maximal string without markup.
5858 textParser :: String -> FontIndex -> Maybe [Action]
5959 -> Parser [(Widget, ColorString, FontIndex, Maybe [Action])]
6060 textParser c f a = do s <- many1 $
22 -----------------------------------------------------------------------------
33 -- |
44 -- Module : Xmobar
5 -- Copyright : (c) 2011, 2012, 2013, 2014, 2015, 2017, 2018 Jose Antonio Ortega Ruiz
5 -- Copyright : (c) 2011, 2012, 2013, 2014, 2015, 2017, 2018, 2019 Jose Antonio Ortega Ruiz
66 -- (c) 2007 Andrea Rossato
77 -- License : BSD-style (see LICENSE)
88 --
1818 , xmobarMain
1919 , defaultConfig
2020 , configFromArgs
21 , tenthSeconds
2122 , Runnable (..)
2223 , Exec (..)
2324 , Command (..)
3839 #endif
3940 , module Xmobar.Plugins.Monitors
4041 , module Xmobar.Plugins.PipeReader
42 , module Xmobar.Plugins.MarqueePipeReader
4143 , module Xmobar.Plugins.StdinReader
4244 , module Xmobar.Plugins.XMonadLog
4345 ) where
6365 import Xmobar.Plugins.Monitors
6466 import Xmobar.Plugins.PipeReader
6567 import Xmobar.Plugins.StdinReader
68 import Xmobar.Plugins.MarqueePipeReader
6669 import Xmobar.Plugins.XMonadLog
6770
6871 import Xmobar.App.Main(xmobar, xmobarMain, configFromArgs)
0 # Compiling with ghc 8.6.3
1 resolver: lts-13.0
0 # Compiling with ghc 8.6.4
1 resolver: lts-13.17
22
33 # To use ghc 4.4 try:
44 # resolver: lts-12.24
1717 # - parsec-numbers-0.1.0
1818 # - libmpd-0.9.0.9
1919 # - alsa-mixer-0.3.0
20
21 nix:
22 packages:
23 - alsaLib
24 - pkgconfig
25 - wirelesstools
26 - xorg.libX11
27 - xorg.libXext
28 - xorg.libXft
29 - xorg.libXpm
30 - xorg.libXrandr
31 - xorg.libXScrnSaver
32 - zlib
5757 waiterTaskIsRunning <- newEmptyMVar :: IO (MVar ())
5858 waiterTaskIsWaiting <- newEmptyMVar :: IO (MVar ())
5959
60 withMonitorWaiter fifoPath (Just fakeAlsactlPath) $ \waitFunc -> do
60 let outputCallback msg = fail ("Did not expect the output callback to be invoked (message: "++show msg++")")
61
62 withMonitorWaiter fifoPath (Just fakeAlsactlPath) outputCallback $ \waitFunc -> do
6163
6264 let addToTimeline e = modifyMVar_ timeline (pure . (e :))
6365
00 name: xmobar
1 version: 0.29.4
1 version: 0.30
22 homepage: http://xmobar.org
33 synopsis: A Minimalistic Text Based Status Bar
44 description: Xmobar is a minimalistic text based status bar.
8585 flag with_weather
8686 description: Enable weather plugin.
8787 default: True
88
89 flag with_conduit
90 description: Use http-conduits for weather data, used only if with_weather.
91 default: False
9288
9389 library
9490 hs-source-dirs: src
146142 Xmobar.Plugins.Monitors.Cpu,
147143 Xmobar.Plugins.Monitors.Disk,
148144 Xmobar.Plugins.Monitors.Mem,
145 Xmobar.Plugins.Monitors.MultiCoreTemp,
149146 Xmobar.Plugins.Monitors.MultiCpu,
150147 Xmobar.Plugins.Monitors.Net,
151148 Xmobar.Plugins.Monitors.Swap,
250247 cpp-options: -DXPM
251248
252249 if flag(with_weather) || flag(all_extensions)
253 build-depends: HTTP >= 4000.2.4
254250 exposed-modules: Xmobar.Plugins.Monitors.Weather
255251 cpp-options: -DWEATHER
256 if flag(with_conduit)
257 -- use http-conduit instead of simple-http
258 build-depends: http-conduit, http-types
259 cpp-options: -DHTTP_CONDUIT
260
261 if flag(with_uvmeter) && flag(with_conduit)
252 build-depends: http-conduit, http-types
253
254 if flag(with_uvmeter)
262255 exposed-modules: Xmobar.Plugins.Monitors.UVMeter
263256 build-depends: http-conduit, http-types
264257 cpp-options: -DUVMETER