Without this change yambar can't be installed/used without libmpdclient even for
people who do not use MPD. Let's make this optional.
We could put the optional module summary in the module meson.build but we'd have
to move summary() in main meson.build so that they appear in proper order.
This adds a new ‘poll-interval’ option to the network module. When set
to a non-zero value, the following Wi-Fi stats will be updated:
* Signal strength
* RX+TX bitrate
This cleans up the nl80211 handling quite a bit, and adds initial
support for nl80211 notifications.
* We now join the nl80211 MLME multicast group (done by parsing the
CTRL_ATTR_MCAST_GROUPS attribute in the reply to our
CTRL_CMD_GETFAMILY request). This gives us CONNECT and DISCONNECT
notifications, allowing us to request and reset SSID that way, instead
of detecting the link’s OPER state.
* Before parsing an nl80211 message, verify it’s for us, by looking
for a NL80211_ATTR_IFINDEX attribute in the message (and comparing the
contents with our previously detected ifindex).
This mostly comes down to tracking whether each channel is a playback,
or capture channel, and using the appropriate APIs when dealing with
it.
Some cleanup related to this:
* Add a channel struct, for per-channel data. Previously, our channel
list was just a list of ALSA channel IDs.
* We now store current volume per-channel (but volume min/max is
per-device)
* Muted state is stored per-channel
* Track both the device’s playback and capture volume ranges, as well
as whether the device *has* playback or capture volume.
* Get the playback/capture volume ranges once, during init, instead of
at each update.
* Use struct pointers for the volume/muted channels. This way we don’t
have to iterate all channels and to string comparisons on the name
each time we update our state.
* Bind the foreign-toplevel-manager object *after* the first round of
global objects. This ensures we bind all pre-existing wl-output
objects before binding the toplevel manager. This is important, since
otherwise we wont get any output_enter() events for the initial set of
toplevels.
* Bind xdg-output-manager, to be able to bind xdg-output objects for
each wl-output.
* Add xdg-output-listener to each wl/xdg-output, to be able to get the
outputs’ names.
* Add a list of outputs to each toplevel. The output_enter() event
adds to this list, and output_leave() removes from it.
* Add option ‘all-monitors’. When not set (the default), toplevels are
only included in the generated content if they are mapped on the same
output as the bar itself. When *not* set, all toplevels are always
included in the generated content.
* ‘content’ is a template; the module returns a list of toplevels,
each one instantiated using the content template.
* Each toplevel has 6 tags:
- app-id (string)
- title (string)
- maximized (bool)
- minimized (bool)
- activated (bool)
- fullscreen (bool)
To show the application name and title of the currently active window,
one can do:
- foreign-toplevel:
content:
map:
tag: activated
values:
false: {empty: {}}
true: {string: {text: "{app-id}: {title}"}}
Otherwise we’ll keep adding the same channel(s) over and over again,
for each (successful) connect attempt.
I.e. if you plug and unplug an USB soundcard repeatedly, we’ll keep
extending the channel list each time.
When e.g. a USB soundcard is inserted, we get several CREATE
events. In my experiments, we only succeed in connecting to ALSA after
the last event.
This means, we’ll have several CREATE events that we receive, remove
the watcher, attempt to connect, fail, and then re-add the watcher.
What if that “last” CREATE event occurs while our watcher has been
removed? That’s right, we miss it, and will get stuck waiting forever.
The solution is keep the watcher around.
Now, if we’ve been successfully connected to ALSA for a long time,
chances are we’ve built up events (for other cards, for example). We
don’t want to trigger a storm of re-connect attempts, so drain the
event queue after having been disconnected from ALSA.
There *is* a small race here - if a card is removed and
re-added *very* fast, we _may_ accidentally drain the CREATE event. I
don’t see this happening in reality though.
While waiting for the configured ALSA card to become available, use
inotify and watch for CREATE events on /dev/snd instead of
polling (using a timeout in the poll(3) call).
Note that we don’t know the actual names of the files that (will) be
created. This means:
* Every time we see a CREATE event on /dev/snd, we *try* to connect to
ALSA. If we fail, we go back to watching /dev/snd again.
* ALSA (not yambar) will log an error message each time we fail.
These options allows you to select which channel to use as volume
source, and which channel to use as the source for the muted state.
With this, we can also remove the check for *all* (playback) channels
having the same volume/muted state. And with that, we no longer need
to warn when not all channels have the same volume/muted state.
With this patch, a non-existing ALSA device is no longer considered a
fatal error. Instead, we keep retrying until we succeed.
Furthermore, if we have successfully opened the ALSA device, and it
then disappears, we a) no longer crash, or cause 100% CPU usage, and
b) try to re-connect to the device.
With this, we now handle e.g. USB soundcards being disconnected and
then re-connected. We should also handle pseudo devices, like pipewire
provides ones, when yambar is started before pipewire.
Closes#59Closes#61Closes#86
When set, river tags and seats’ view titles apply to the output yambar
is on, only.
The default is disabled, which implements the old behavior, where
river tags and seats’ view titles represent the union of all
outputs.
Add ‘persistent’, a list-of-strings specifying workspace names that
should be persistent. That is, workspaces that should never be
removed, even if empty.
Note that the workspaces _are_ still destroyed (in i3/Sway), but
yambar keeps abstractions for them around. This is useful to e.g. keep
a strict order between your “core” workspaces.
Closes#72
When set to a non-negative value, the script module will call the
configured script every <poll-interval> second.
In this mode, the script is expected to write one tag set and then
exit.
This is intended to simplify the implementation of scripts that would
otherwise just do a loop + sleep.
Closes#67
Some batteries support charge thresholds and when the upper limit is set to a number less than 100 percent and it reaches that limit and it is connected to the charger the battery state will be "Not charging".
It doesn't charge anymore despite it's not full.
Some battery drivers will remove their sysfs directory when the
battery goes from charging to discharging, or vice verse.
This caused yambar’s battery module to terminate, resulting in the
last known battery state to “freeze”.
With this patch, failure to read the battery directory the *first*
time is still considered a hard failure, resulting in an error message
and then termination.
However, subsequent failures, i.e. while polling the battery state,
is *not* considered fatal; we simply don’t update the bar, and retry
again the next poll interval. Error messages are still logged however.
Closes#44
This is already being done in the initial query response. Not doing it
in the input event handler too leads to an assertion if there are
multiple devices with the same ID.
Hopefully fixes#54
When sorting workspaces in ascending order, put numerical
workspaces *after* non-numerical ones.
When sorting in descending order, put numerical workspaces *before*
non-numerical.
In both cases, sort numerical workspaces using a numerical comparison,
rather that doing a lexicographical sorting.
Closes#30
96d2d057e0
added a new tag, ‘volume’, but didn’t bump the tag count.
This meant the last tag in the set, ‘elapsed’ was never seen by
anybody, and not free:d when the tag set was free:d.