summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins
AgeCommit message (Collapse)Author
2020-06-13Initial support for benchmarks of the pluginsSibi Prabakaran
2020-06-12Update UVWeather branchSibi Prabakaran
2020-06-12Optimize weather plugin by reusing manager and other refactorsSibi Prabakaran
As documented in the http-client library, calling newManager is an expensive operation: ``` Creating a new Manager is a relatively expensive operation, you are advised to share a single Manager between requests instead. ``` But inspite of the haddocks in xmobar claiming that once 'Manager' is created, it will be used throughout the monitor is not true. Because for every call of `startWeather` a new manager is being created. Also I removed the option in WeatherOpts because even if it is false, it will be ultimately created in `getData` function. Also without using a manager - the plugin won't really work. So, I don't think there is any reason for this option to exist. I have introduced a new dependency http-client-tls to use the shared global manager so that we reuse the same manager every time. This simplifies a lot of code. Note that this is not really a new dependency because http-conduit already depends on it transitively.
2020-06-05Optimize date pluginSibi Prabakaran
We avoid calling getTimeZone for each of the time the date has to be updated. Instead, it's computed once at the start and re-used for each invocation. Looking at the implementation of 'getTimeZone', we can see that it's very expensive: https://www.stackage.org/haddock/lts-15.15/time-1.9.3/src/Data-Time-LocalTime-Internal-TimeZone.html#getTimeZone It calls a C FFI each time to get the time zone (getTimeZoneCTime). This is something which we can avoid and the MR implements that. I have been using my xmobar with this patch and the result has been quite good. My xmobar CPU usage has used to hit 3~7% intermittently. With this MR, It hits only 0.7% intermittently which is nice. :-)
2020-05-19hlintingjao
2020-05-19Add EOF check before getLine operation from stdinSibi Prabakaran
Fixes https://github.com/jaor/xmobar/issues/442
2020-05-17Temporarily restore Stdin to its previous statejao
2020-05-06recursively hlintingjao
2020-05-06hlintingjao
2020-05-02Update stderr and the bar on receiving exceptionSibi Prabakaran
2020-05-02Avoid busy looping by not catching all exceptionsSibi Prabakaran
This specifically avoids situation described in this issue https://github.com/jaor/xmobar/issues/438 where the handle was throwing the IOException continously in a loop: <stdin>: hGetLine: invalid argument (invalid byte sequence) It happened because my system's environment was right, but the proper behaviour hear would be to let it to throw the exception rather than leading to a busy loop. I did some git blame to find out that this commit introduced the behaviour: https://github.com/jaor/xmobar/commit/fc24dc1874dcf7c9e66e21502a58b40cbe627c85 but there was no reason mentioned in the commit for trying to capture all exceptions.
2020-04-30Spurious import and hlintingjao
2020-04-30Refactor the usage of hGetLineSafeSibi Prabakaran
hGetLineSafe is always hGetLine and hence we can directly use it.
2020-04-21Whitespacejao
2020-04-21MPD: catch errors earlier so that reconnections are allowedjao
2020-04-12Add a HandleReader PluginPavan Rikhi
This adds a new `HandleReader` plugin, which displays data from a Haskell `Handle`. This is really only useful if you are running xmobar from within another Haskell program, but lets you avoid the mechanics of creating a named pipe with the proper file permissions. Instead, you can use `System.Process.createPipe` to make a pair of read & write Handles. If you pass the read handle to HandleReader, you can use hPutStr on the write Handle to send data to xmobar from your application code.
2020-03-05Network: up indicatorjao
2020-03-05Wireless: fix hlint warnings, reenable CI checksPaul Fertser
This makes the code hlint-clean for --cpp-define=USE_NL80211, --cpp-define=IWLIB and without --cpp-define too.
2020-02-26hlint nitjao
2020-02-25Wireless: support NL80211 userspace <-> kernelspace APIPaul Fertser
NL80211 was introduced in Linux 2.6.24 in 2007 as a new extensible universal API, replacing "wireless extensions" ioctls. It works on top of netlink, and allows direct communication to cfg80211 kernel subsystem. Since then it became a hard requirement for all upstream wireless drivers to hook into cfg80211 (SoftMAC drivers do it via the common mac80211 layer). There's still additional compatibility code that allows limited Wext functionality for cfg80211 drivers but it's buggy and can be disabled altogether when CONFIG_CFG80211_WEXT is not set. This patch makes use of "netlink" Haskell library which doesn't have any additional runtime dependencies (so neither iwlib nor libnl are required). The operation is the same as performed by "iw dev <devname> link" command. The signal level is transformed to "quality" by first clamping it to [-110; -40], then adding 110 and dividing by 70 (same meaningless formula as used by the cfg80211 Wext compatibility layer). "essid" template argument is replaced by more appropriate "ssid" (with the old variant still available for backwards compatibility)
2020-02-22Refactor code from tenthSeconds to doEveryTenthSecondsTomas Janousek
A preparation for timer coalescing: tenthSeconds is just a sleep whereas doEveryTenthSeconds enables using a central timer and waiting for all monitors to update before refreshing the window. This commit is just a simple refactor, the actual timer coalescing code comes later.
2020-02-11Battery: fix time calculations on some Linux systemsPaul Fertser
The calculations are based on the assumption that current_now (or power_now) are always positive. However, power_supply documentation in the kernel sources say nothing about it, and so some drivers provide a signed value (e.g. bq27xxx_battery_current). Discovered and fixed on ac100/paz00 netbook.
2020-02-05Update changelog and readmeslotThe
2020-02-05'Manager' is now internal to UVMeterslotThe
2020-02-05'Manager' is now internal to weatherslotThe
2020-02-05New function `getArgvs` to get all values from user inputslotThe
2020-01-27Revert "Use a single Manager across the whole application"jao
This reverts commit 1f1f0bd8b811740c84215f9ed4fa5ebd8309a990.
2020-01-27Revert "Only require http-conduit when absolutely necessary"jao
This reverts commit efb6d6817c092fe08e9b0f1b8a17bddd29d97cdb.
2020-01-16Only require http-conduit when absolutely necessaryslotThe
2020-01-16Use a single Manager across the whole applicationslotThe
2020-01-09Remove remaining redundant functions and use generic parseOptsWith insteadslotThe
2020-01-08FreeBSD battery: Condition to notify if battery is full.Dhananjay Balan
2020-01-06Support for freebsd battery status:Dhananjay Balan
Exposed via -f with_freebsd flag, uses sysctl to query battery status.
2020-01-05Add <volumestatus> template to VolumeslotThe
2020-01-04Replace parseOpts with a generic functionslotThe
2020-01-04hlitingjao
2020-01-04Update readme and changelogslotThe
2020-01-04Add 'WeatherOpts' type and first option to weather pluginslotThe
The first option applied here is a default value for a field that's not always reported to be there, namely the 'weather' field. It now defaults to saying "normal" instead of displaying an empty string.
2019-12-23Add support for the "Weather" fieldslotThe
2019-12-08Undocumented for now non-contiguous Diskjao
2019-11-17DateZone: get timezone series from TZDIREmmanuel Rosa
The DateZone plugin calls `getTimeZoneSeriesFromOlsonFile` using the hard-coded path /usr/share/zoneinfo. While that may work just fine on most Linux distros, it does not work on NixOS since that directory is always locates somewhere under /nix/store. Based on mild research, it seems the environment variable TZDIR is commonly set to the absolute path to `zoneinfo` (but without a trailing slash). This change modifies the DateZone plugin to first try getting the zoneinfo path from the TZDIR environment variable, falling back to the hard-coded path /usr/share/zoneinfo
2019-11-14MPD monitor: host and port specifiable in configjao
2019-10-28Optimize Net a bit (noticeably less CPU/power usage)Tomas Janousek
- use strict ByteString as the Lazy version of readFile allocates a 32k buffer even though we usually need much less (isUp needs a few bytes) - refactor NetDev datatype and use unsafeInterleaveIO in isUp to avoid reading the operstate file entirely if we're not interested in that device - postpone ByteString unpacking in netParser to shave off some cycles, and avoid ByteString unpacking in isUp entirely On my system with 8 network devices (and more if docker is up), this seems to reduce xmobar's CPU usage noticeably. I have two "Run Network" in xmobar configuration, for eth and wlan, so without these changes, xmobar would evaluate isUp 16 times a second, and each evaluation would allocate a buffer for the IO Handle and then another buffer for the lazy ByteString readFile. Now it only does isUp once for every device I'm interested in, and the only large buffers allocated are the IO Handle ones (getting rid of these isn't worth the code complexity).
2019-10-21add filtering option for Net devices (#408)vindex10
* add filtering option for Net devices * relate to comments * upd readme * add few more words to readme
2019-10-15Battery: -P to show %jao
2019-10-15New plugin: MailXjao
2019-10-14Add ability to display string based on volume percentageslotThe
2019-10-14Add VolumeStatus and ways to convert Float -> VolumeStatus, VolumeStatus -> ↵slotThe
[low,medium,high]String
2019-10-14Add types for displaying a string based on volume percentageslotThe
2019-10-14Add types for percentage based volume controlslotThe