Commit graph

1265 commits

Author SHA1 Message Date
Daniel Eklöf
25379b7e1f
changelog: new network tags (ssid, signal rx+tx bitrate) 2021-09-01 19:10:22 +02:00
Daniel Eklöf
01ee028c4d
doc: network: document ssid, signal, rx-bitrate and tx-bitrate 2021-09-01 19:10:22 +02:00
Daniel Eklöf
a685dadb75
module/network: expose signal strength and rx+tx bitrates 2021-09-01 19:10:22 +02:00
Daniel Eklöf
b27eff36f9
module/network: nl80211: join the MLME mcast group, ignore messages not for us
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).
2021-09-01 19:10:22 +02:00
Daniel Eklöf
9b3548736a
module/network: refactor: add foreach_nlattr()
This function iterates all attributes of a NETLINK_GENERIC message,
and calls the provided callback for each attribute.
2021-09-01 19:10:22 +02:00
Daniel Eklöf
5249d9ef79
module/network: use separate functions to connect to RT/GENL netlink 2021-09-01 19:10:21 +02:00
Daniel Eklöf
d39e6b8b94
module/network: initial support for Wifi extensions
Currently capable of getting the SSID.
2021-09-01 19:10:21 +02:00
Daniel Eklöf
e4e9587322
particle/progress-bar: fix regression in width calculation: = -> += 2021-08-30 18:00:41 +02:00
Daniel Eklöf
e9d762fa03
module/foreign-toplevel: disable debug logging 2021-08-27 10:14:54 +02:00
Daniel Eklöf
149798fe98
Merge branch 'alsa-capture-devices' 2021-08-27 06:42:42 +02:00
Daniel Eklöf
1079bca3eb
Silence “variable length array bound evaluates to non-positive value 0” 2021-08-26 13:27:29 +02:00
Daniel Eklöf
d1c7647b03
module/alsa: add support for capture devices
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.
2021-08-26 11:03:12 +02:00
Daniel Eklöf
7c7c4e7ce9
module/alsa: rename {volume,muted}_channel -> {volume,muted}_name 2021-08-26 09:42:41 +02:00
Daniel Eklöf
b8dd247111
meson: run generate_version.sh in a C locale
Previously, only the date command inside the script was run with
LC_TIME=C.

But there’s no reason to be that conservative; we absolutely do not
want _anything_ in that script to generate locale dependent output.
2021-08-25 19:03:32 +02:00
Daniel Eklöf
427e0ce418
Merge branch 'zero-width-exposables-regressions' 2021-08-25 18:48:21 +02:00
Daniel Eklöf
7ca22a6dab
bar: don’t adjust spacing for left/center/right widths if all exposables are zero-width 2021-08-25 18:48:15 +02:00
Daniel Eklöf
af0b7e57d8
particle/ramp: don’t add margins if all sub-items are zero-width
That is, if all sub-items are zero-width, make sure *we* return a zero
width.
2021-08-25 18:48:15 +02:00
Daniel Eklöf
def90edde1
particle/progress-bar: don’t add margins if all sub-items are zero-width
That is, if all sub-items are zero-width, make sure *we* return a zero
width.
2021-08-25 18:48:15 +02:00
Daniel Eklöf
dab6428859
particle/map: don’t add margins if all sub-items are zero-width
That is, if all sub-items are zero-width, make sure *we* return a zero
width.
2021-08-25 18:48:15 +02:00
Daniel Eklöf
73e1d328c3
particle/list: don’t adjust spacing if all sub-items are zero-width
That is, if all sub-items are zero-width, make sure *we* return a zero
width, instead of a negative width.
2021-08-25 18:48:15 +02:00
Daniel Eklöf
ca43eb3016
particle/dynlist: don’t adjust spacing if all sub-items are zero-width
That is, if all sub-items are zero-width, make sure *we* return a zero
width, instead of a negative width.
2021-08-25 18:48:15 +02:00
Daniel Eklöf
0abc0f37dd
Merge branch 'river-rename-per-output-to-all-monitors' 2021-08-25 18:47:48 +02:00
Daniel Eklöf
103c3102a9
module/river: rename the ‘per-output’ option to ‘all-monitors’
This also inverts its meaning.
2021-08-25 18:47:33 +02:00
Daniel Eklöf
621f0e18e6
Merge branch 'foreign-toplevel' 2021-08-25 18:46:35 +02:00
Daniel Eklöf
9681e0aabe
module/foreign-toplevel: require version 3 of wl-output interface
The bar itself already does this, and doing so means we can always use
wl_output_release() (instead of wl_output_destroy()).
2021-08-25 18:46:19 +02:00
Daniel Eklöf
589a6f528a
module/foreign-toplevel: track outputs each toplevel is mapped on
* 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.
2021-08-25 18:46:19 +02:00
Daniel Eklöf
01c6fc5f52
changelog: foreign-toplevel module 2021-08-25 18:46:19 +02:00
Daniel Eklöf
fe6cc43ad8
doc: river: provide -> provides 2021-08-25 18:46:19 +02:00
Daniel Eklöf
2173e0dc4d
doc: add man page for the new foreign-toplevel module 2021-08-25 18:46:19 +02:00
Daniel Eklöf
560d7464b4
module/foreign-toplevel: initial support
* ‘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}"}}
2021-08-25 18:46:18 +02:00
Nulo
eb94c8cceb
Add layer option
Only applies to Wayland and the default is still bottom.
2021-08-25 18:42:46 +02:00
Daniel Eklöf
7e7c011126
module/river: use wl_output_release() instead of wl_output_destroy() 2021-08-25 09:45:08 +02:00
Daniel Eklöf
0963afd282
example/conf: alsa: use the new ‘online’ tag 2021-08-24 16:57:22 +02:00
Daniel Eklöf
36de95cc2a
Merge branch 'alsa-inotify' 2021-08-23 18:34:18 +02:00
Daniel Eklöf
a5be550964
module/alsa: free channel list on each connect attempt
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.
2021-08-21 15:26:53 +02:00
Daniel Eklöf
360e1fbada
module/alsa: don’t re-create the /dev/snd inotify watcher after each connect failure
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.
2021-08-21 11:08:45 +02:00
Daniel Eklöf
5af070ee1d
log: LOG_ERRNO: include numeric value of errno 2021-08-21 11:08:06 +02:00
Daniel Eklöf
25c20e5534
module/alsa: use inotify on /dev/snd instead of a poll timeout
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.
2021-08-21 10:52:12 +02:00
Daniel Eklöf
db12ceb026
module/alsa: volume/muted: default to “unset”; use first available channel 2021-08-20 21:41:21 +02:00
Daniel Eklöf
ae7d54fb80
module/alsa: add ‘volume’ and ‘muted’ options
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.
2021-08-20 20:24:44 +02:00
Daniel Eklöf
591cae4c6d
Merge branch 'alsa-handle-device-disconnect'
Closes #59
Closes #61
Closes #86
2021-08-19 19:31:28 +02:00
Daniel Eklöf
be6e714eb0
module/alsa: handle ALSA device disappearing
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 #59
Closes #61
Closes #86
2021-08-19 19:26:40 +02:00
Daniel Eklöf
8b6b82f1e5
module/river: add support for river-status v2 (‘urgent’ views) 2021-08-19 19:25:18 +02:00
Daniel Eklöf
b00954045b
Merge branch 'log-level'
Closes #84
2021-08-15 16:45:02 +02:00
Daniel Eklöf
495a4c8fb1
log: remove unused include “debug.h” 2021-08-15 16:34:46 +02:00
Daniel Eklöf
be10465a3b
main: add -d,--log-level=info|warning|error|none
Closes #84
2021-08-15 11:43:49 +02:00
Daniel Eklöf
7d3851046e
log: pull in log.{c,h} from foot 2021-08-15 11:41:12 +02:00
Daniel Eklöf
58a52512dd
changelog: slight rewording 2021-08-12 19:31:22 +02:00
Nulo
910522262f
Only add spacing if the module is not empty
If the module is empty (width is 0) no spacing will be rendered for it.

This makes modules that auto-hide (for example, network modules for interfaces not used all of the time) occupy no space in the bar.
2021-08-12 19:29:07 +02:00
Daniel Eklöf
315044d342
Merge branch 'river-per-output' 2021-08-09 19:56:57 +02:00