summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2021-05-14Fix delayed reaction to USR1/2 signalsTomas Janousek
While using xmobar to reproduce/fix a bug in xmonad I noticed that xmobar doesn't react immediately to the signals to reposition or change screen. Apparently none of the Xlib functions called from `repositionWin` flush the Xlib output buffer (XMoveResizeWindow is known to not flush, although it's unfortunately not documented), so when compiled with the threaded runtime that runs XNextEvent in a separate thread, the reposition is sent to the X server only later when other stuff happens. With all monitors set to refresh once a minute, this can take a looong time. (It's entirely possible this happens even without the threaded runtime, I didn't test that, sorry.) The fix is to call XSync at the end of `repositionWin`. While at it, I spotted that drawInWin calls XSync with discard=true, which seems like a mistake. We don't want to discard any events, do we? (In practice, I'd expect the `eventer` thread to read all events even before the drawing thread manages to discard them, so even if this discarding XSync ever had any reason to be there, I don't think it does anything meaningful these days. I may be wrong, though.)
2021-05-06Fix a linkJulin S
Fix a link to an example.
2021-04-27Revert "Conditional encoding …" and "Avoid double utf8 encoding" (#482)Tomas Janousek
This reverts commits c6669e26e1 (partially; changelog entry kept), 73e02934d6, 78efa5900a. These commits were introduced as a workaround for a double UTF-8 encoding bug in xmonad-contrib which itself was meant to be a fix/workaround for another issue. We have now identified the underlying issue and fixed it right at the root, so this entire cascade of hacky (and wrong) workarounds can be safely reverted. Thankfully, none of the xmonad-contrib hacks made it into a release, so there's no backward compat to worry about. Should anyone be interested in the details, https://github.com/xmonad/xmonad-contrib/commit/63e31ccd8d2865863778207b679f806941bf2788 provides a summary and links to all the related issues and PRs. Related: https://github.com/jaor/xmobar/pull/482 Related: https://github.com/jaor/xmobar/issues/476 Related: https://github.com/xmonad/xmonad-contrib/commit/63e31ccd8d2865863778207b679f806941bf2788 Related: https://github.com/xmonad/xmonad-contrib/pull/471 Related: https://github.com/xmonad/xmonad-contrib/issues/377
2021-04-27Changelog update (#538, #530)Tomas Janousek
2021-04-26Workaround for hlint failureTomas Janousek
hlint started failing recently: src/Xmobar/X11/Text.hs:121:32: Error: Parse error: on input `-' Found: textExtents (Utf8 fs) s = do let (_,rl) = wcTextExtents fs s > ascent = fromIntegral $ - (rect_y rl) descent = fromIntegral $ rect_height rl + fromIntegral (rect_y rl) return (ascent, descent) It's probably a change in the parser or something, didn't really look into it, just changed it to something that's parsable.
2021-04-26Fix off-by-one in strut calculation for Static positionTomas Janousek
Pixel intervals in _NET_WM_STRUT_PARTIAL are closed, not open [1], so xmobar of width 1920 at x=0 needs to be encoded as ⟨0, 1919⟩, not ⟨0, 1920). The code already does this for Top/Bottom positioning, but Static has been buggy for years. [1]: https://specifications.freedesktop.org/wm-spec/1.5/ar01s05.html#idm46075117229424 Fixes: https://old.reddit.com/r/xmonad/comments/mynegr/xmobar_dual_monitor_bug/ Fixes: https://github.com/jaor/xmobar/issues/530
2021-03-30Add FreeBSD support to Cpu pluginKevin Zheng
2021-03-18Fix typo `DRTSOPTS` -> `RTSOPTS`Claudio Bley
The cpp option `-DRTSOPTS` results in `RTSOPTS` being defined.
2021-02-25Examples link correction (fixes #527)jao
2021-01-28Add plugins.org to readmeslotThe
2021-01-18Expose Xmobar.Plugins.Monitors.Common (fixes #520)jao
Exposing Common.Types and Common.Run is now redundant, but we could break configurations out there, so i'm not sure if we should remove them.
2021-01-15Extract compiling xmobar from source to its own fileslotThe
2021-01-15Add installation instructions for OpenSUSEslotThe
2021-01-15Extract writing your own plugin into its own fileslotThe
2020-12-20Including new .org doc files in extra-source-filesjao
2020-12-15Subdivide system monitorsslotThe
2020-12-15Subdivide window manager integrationslotThe
2020-12-15Prefer UnsafeXmonadLog over UnsafeStdinReaderslotThe
2020-12-14Further improvementsslotThe
2020-12-14Split out contributing and quick-start part from readmeslotThe
The contributing.org file also contains information on how to write a new monitor for xmobar. The quick-start guide got reworked a bit to inline similar parts.
2020-12-14Add installation instructions via package managerslotThe
2020-12-14Move plugins to doc/plugins.orgslotThe
This also moves Date and DateZone to the monitors section (as they are monitors themselves). A little bit of documentation was also added/updated.
2020-12-14Update readme.orgslotThe
Mostly updating links and old (i.e. outdated) information
2020-12-14Convert readme to org-modeslotThe
2020-11-29Tweaks to website makefilejao
2020-11-290.370.37jao
2020-11-29Update readme and changelogslotThe
2020-11-29Add new plugin: NotmuchMailslotThe
This plugin checks for new mail, provided that this mail is indexed by notmuch. As mail that was tagged is moved from the new directory to cur, the 'Mail' plugin (and its variants) won't work for such mail.
2020-11-25More consistent argument order for MPDXjao
2020-11-25Use tripple backticks for Haskell codeslotThe
Also make indentation of shell code a little bit more regular.
2020-11-24New monitor: MPDXjao
2020-11-19test: Fix flaky CpuSpecTomas Janousek
Failed at least once in GitHub Actions: predicate failed on: "Cpu: <fc=red>100</fc>% <fc=red>##########</fc>" Also, there's no need to guard the Xmobar.Plugins.Monitors.CpuSpec module with the with_alsa flag. (And it doesn't really work anyway, hspec-discover doesn't care about what modules are declared in cabal, so stack/ghc complains that "These modules are needed for compilation but not listed in your .cabal file's other-modules: Xmobar.Plugins.Monitors.AlsaSpec" and then fails to detect changes in those modules.)
2020-11-19StdinReader: Remove throttling on exceptionTomas Janousek
Introducing the throttling unfortunately has a negative side-effect: it delays all stdin processing, including EOF detection, which can cause confusion the previous commit tries to fix. The only benefit of the throttling is to prevent 100% CPU usage when a lot of garbage is provided on xmobar stdin. We still don't know where that garbage comes from in https://github.com/jaor/xmobar/issues/438, or rather why there's more than a handful of lines of such garbage. @psibi has since fixed his setup to not produce that garbage, and no one else ever reported such a problem, so it's probably safe to ignore it for now. Should anyone ever encounter that again, feel free to ping me, even in the middle of the night, to help debug this. Fixes: 7759df11f746 ("StdinReader: Improve exception handling") Fixes: b7a3d6745817 ("Avoid busy looping by not catching all exceptions")
2020-11-19StdinReader: Improve exception handlingTomas Janousek
This corrects a misleading comment "EOF check is necessary for certain systems" which was added without complete understanding of the root cause of #442. That issue was in fact caused by old xmobars not being terminated on early EOF, and is thus necessary on _all_ systems that rely on EOF to terminate old xmobar before starting a new one. (To trigger the bug, one additionally needs to close the xmobar pipe before sending any input to it, which is unusual, but incorrectly configured xmonad might trigger that.) Furthermore, this fixes another execution path that could lead to xmobar not being terminated on EOF: `echo -e '\xff' | xmobar -c '[Run StdinReader]' -t '%StdinReader%'` would terminate the StdinReader thread upon catching the "invalid argument (invalid byte sequence)" so there'd be no thread to detect the subsequent EOF and xmobar would get stuck. Additionally, I believe that terminating either the thread or the entire xmobar upon receiving a single miscoded byte isn't desirable, as this might be an intermittent issue and another input line can be perfectly okay. Therefore I suggest that the original issue @psibi was trying to fix by b7a3d6745817 is worked around by introducing a throttling delay instead of terminating the thread, as I assume that exceptions other than async and EOF are recoverable. Fixes: b7a3d6745817 ("Avoid busy looping by not catching all exceptions") Fixes: 68ac4d3ae6f3 ("Update stderr and the bar on receiving exception") Fixes: ed0663aac942 ("Add EOF check before getLine operation from stdin") Fixes: https://github.com/jaor/xmobar/issues/442 Related: https://github.com/jaor/xmobar/pull/439 Related: https://github.com/jaor/xmobar/pull/448
2020-11-18changelog linkjao
2020-11-18Nitsjao
2020-11-18clean-ups for web page generationjao
2020-11-18Wee tidy-upsjao
2020-11-18More readme clean-upsjao
2020-11-18Link fixjao
2020-11-18Readme imagesjao
2020-11-15Fix crash on <fn=1>x</fn> when no additional fonts are specifiedTomas Janousek
This fixes the following crash that happens with the default xmobar configuration (using HOME=/ makes xmobar ignore ~/.xmobarrc): $ echo "<fn=1>x</fn>" | HOME=/ xmobar xmobar: Prelude.!!: index too large Commit 3e9e1cb9d300 ("Fix crashes/busy looping happening via index") meant to fix this but apparently it only fixed indexing of fontlist, not voffs, so the crash was still there. Fixes: https://github.com/jaor/xmobar/issues/504
2020-11-15Fix vertical centering of additional fontsTomas Janousek
The readme says additional fonts are centered vertically if a corresponding offset isn't specified in `textOffsets`, but this didn't happen as we used the first font's metrics for centering of all fonts instead. Fixes: a2365debfaba ("New configuration parameter `textOffsets` (fixes #311)")
2020-11-13Another image in readme.mdjao
2020-11-13Optimize Date plugin again (refresh timezone only once a minute)Tomas Janousek
This makes the Date plugin approximately twice as fast, and makes xmobar up to about 5–10 % faster if Date is the only active plugin. (If more expensive plugins like Network or MultiCpu are used, it doesn't make any measurable difference.) Micro-benchmark results on my HW: Date Benchmarks/Date mean 2.833 μs ( +- 16.08 ns ) Date Benchmarks/DateZonedTime mean 5.020 μs ( +- 32.91 ns ) Date Benchmarks/DateWithTimeZone mean 2.827 μs ( +- 20.52 ns ) (DateZonedTime is the original implementation and DateWithTimeZone is the implementation we had since 0.34 which never refreshes timezone.) Real-life measurements (done overnight on an idle laptop, with all measured xmobars running in parallel to ensure comparable conditions; xmobars configured to only display date and with rate 10 — once per second): $ time timeout 6h xmobar .xmobarrc-DateZonedTime real 360m0,010s user 0m9,867s sys 0m4,644s (9.867 + 4.644) / (360 * 60) = 0.000672 $ time timeout 6h xmobar .xmobarrc-Date real 360m0,008s user 0m9,535s sys 0m4,327s (9.535 + 4.327) / (360 * 60) = 0.000642 $ time timeout 6h xmobar .xmobarrc-Date-10m real 360m0,010s user 0m9,780s sys 0m4,215s (9.780 + 4.215) / (360 * 60) = 0.000648 $ time timeout 6h xmobar .xmobarrc-DateWithTimeZone real 360m0,006s user 0m9,658s sys 0m4,166s (9.658 + 4.166) / (360 * 60) = 0.000640 (.xmobarrc-Date-10m is the proposed implementation, but with timezone refresh every 10 minutes instead of every 1 minute) Interpretation of these results: * refreshing xmobar with just date takes around 650 μs * that is xmobar with just date uses around 0.065 % of CPU time * refreshing timezone takes additional cca 30 μs When we only refresh timezone once a minute, these 30 μs become 0.5 μs amortized, and that should be acceptable to even the most dedicated perfectionist :-) Fixes: a58e32f7c8af ("Revert "Optimize date plugin"") Fixes: 878db3908060 ("Optimize date plugin") Co-authored-by: Sibi Prabakaran <sibi@psibi.in>
2020-11-13bench: Clean up a bitTomas Janousek
2020-11-08Changelog entry for Revert "Optimize date plugin"Tomas Janousek
A missing bit from a58e32f7c8af7b03410ab6693019cfc92c9cfca3.
2020-11-02Revert "Optimize date plugin"ivanbrennan
This reverts commit 878db39080607ba476ba8d8f547ad28259efb6a9. That commit optimized the date plugin by avoiding calling getTimeZone on each execution, instead calling it just once upon startup and reusing that zone. As a result, the time zone will not be updated dynamically, e.g. when shifting in or out of daylight savings time. I noticed this after my local time zone had shifted from EDT to EST. My xmobar showed 4:30 when the local time was in fact 3:30 (and running date on the command line confirmed that my system clock was actually aware of this shift). I had to restart xmobar in order to pick up the new time zone. I repro'd the unexpected behavior by temporarily disabling my system's time syncing, setting the time to 30 seconds before the zone shift, running date to confirm I'd set the correct time, restarting xmobar, and observing. sudo systemctl stop systemd-timesyncd.service date --set="01:59:30" date I observed my xmobar clock go from 1:59 to 2:00, rather than from 1:59 to 1:00 as expected. Following the same steps, I was able to verify that this commit fixes the issue.
2020-10-25Fix for broken DateZone monitorDino Morelli
There's a longstanding bug in timezone-olson that causes it to fail to read some zoneinfo files (but not all, oddly). This was resolved in timezone-olson-0.2.0 which can be built against by using a later Stackage snapshot than master currently points to. This fix pushes the snapshot up to lts-16.0 and also modifies the cabal version range for timezone-olson to set 0.2.0 as the minimum.
2020-10-24Adding example xmobar library install with cabalMark Watts
- Relates to #491