summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
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-26Copyright yearsjao
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-23Timer coalescing: handle exceptions in timer coordination threadTomas Janousek
This corrects my (wrong) assumption that the timer coordination thread will only fail if there's an error in the code, and in that case any attempt to recover is futile. It turns out that the thread does fail recoverably in one notable case: when running in the non-threaded RTS, registerDelay fails immediately. And we probably still wish for xmobar to support the non-threaded RTS. One way to solve this issue is to add a bunch of #ifdefs and compile the code only in the threaded case. This would double the number of configurations that need to be tested, though. Instead, let's make the code robust against all kinds of exceptions in the timer coordination thread, and get non-threaded RTS support for free.
2020-02-22Timer coalescing: gracefully uncoalesce slow timersTomas Janousek
The first implementation assumed all timers (monitors) are fast and frequent (which happens to be the case in my configuration). This meant that a single on-line weather monitor could block the entire xmobar instance for a long time due to the refresh pausing (meant to reduce power consumption). This commit attempts to fix that by limiting the refresh pause time and using the old periodic sleep method for these slow timers (monitors).
2020-02-22Implement timer coalescing (noticeably less CPU/power usage)Tomas Janousek
xmobar currently runs every monitor in its own thread. Monitors that do periodic updates simply sleep and loop. This unfortunately leads to these threads coming out of sync, and xmobar ends up waking up and redrawing for every periodic monitor. In my case, that is 7 times per second, which is enough for xmobar to be at the top of "top" with more than 1% CPU usage, and to have a noticeable impact on battery life. This commit adds a central timer coordination thread which makes sure that periodic updates happen together and that we only redraw once they're all done. Together with PR #409, I managed to lower the idle power draw of my laptop from 4W to 3W.
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-22Silence some warningsTomas Janousek
src/Xmobar/X11/Draw.hs:51:11-12: warning: [-Wunused-matches] Defined but not used: ‘wr’ | 51 | drawInWin wr@(Rectangle _ _ wid ht) ~[left,center,right] = do | ^^ src/Xmobar/App/EventLoop.hs:50:1-36: warning: [-Wunused-imports] The import of ‘Xmobar.X11.Events’ is redundant | 50 | import Xmobar.X11.Events(nextEvent') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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-15A second attempt at fixing #405jao
This time taking into account that ~/.config/xmobar could be populated
2019-10-15Battery: -P to show %jao
2019-10-15New plugin: MailXjao
2019-10-14Don't create .xmobar if it doesn't exist (issue #405)jao
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
2019-10-13Plugins/Kbd: ignore "terminate" layout tokenGreg Steuck
This fixes printing of Kbd from terminate(ctrl_alt_bksp) to RU as expected given this config stanza: , Run Kbd [("us", "US"), ("ru", "RU")] and this layout: % setxkbmap -print xkb_keymap { xkb_keycodes { include "xfree86+aliases(qwerty)" }; xkb_types { include "complete" }; xkb_compat { include "complete" }; xkb_symbols { include "pc+us+inet(pc105)+terminate(ctrl_alt_bksp)+ru:2+capslock(grouplock)" }; xkb_geometry { include "pc(pc105)" }; };
2019-10-12Replacing the cute <> operator to make GHC 8.0/8.2 happyjao
2019-10-12Display additional strings depending on battery statusslotThe
2019-10-10Fix type errors in MPD pluginJohn Tyree
2019-10-06hlinitjao
2019-10-05New flag `contiguous-icons` for `MultiCpu` (issue #388)jao
2019-09-06Write error log to data dir, not conf dirChuck
Write xmobar.errors to XMOBAR_DATA_DIR, not XMOBAR_CONFIG_DIR. This allows XMOBAR_CONFIG_DIR to be read-only. This brings xmobar into alignment with how xmonad manages its analogous directories (before this change, a read-only DATA dir worked with xmonad but not with xmobar).
2019-07-14allow seperate icon-patterns in MultiCoreTelpFelix Springer
2019-07-12fixed old CoreTemp in Monitors.hs, set up xmobar.cabal for MultiCoreTempFelix Springer
2019-07-12put in old CoreTempFelix Springer