Commit graph

464 commits

Author SHA1 Message Date
Daniel Eklöf
63c9c90a61
module/disk-io: rename ‘interval’ to ‘poll-interval’ 2022-12-18 10:38:56 +01:00
Daniel Eklöf
710cede371
module/pipewire: disable debug logging 2022-12-17 18:26:31 +01:00
Daniel Eklöf
ede6a541e1
modules: meson: add missing ‘m’ (math) dependency
The following modules used functions from the ‘m’ (math)
library (e.g. round()), but didn’t explicitly link against it. This
caused build failures when no other plugin that _did_ link against ‘m’
was enabled.

* cpu
* mem
* pulse
* pipewire
* foreign-toplevel

Closes #239
2022-12-17 18:26:25 +01:00
Daniel Eklöf
b195bc4dcb
module/cpu: make ‘content’ particle a template
Before this patch, the cpu module instantiated a single particle (the
‘content’ particle), with one tag ("cpu") representing the total CPU
usage, and then one tag (cpuN) for each core.

This makes it cumbersome to configure, since you need to explicitly
reference each cpuN tag to get per-core usage.

This patch rewrites this, so that ‘content’ is now a template. It’s
instantiated once to represent the total CPU usage, and then once for
each core.

Each instance has a "cpu" tag, representing the CPU usage of that
core (or total usage). It also has an "id" tag. The ID is 0..n for
actual cores, and -1 for total usage.

This means you can do something like this in your config:

- cpu:
    content:
      map:
        conditions:
          id < 0: {string: {text: "Total: {cpu}%"}}
          id >= 0: {string: {text: "Core #{id}: {cpu}%"}}

Closes #207
2022-12-14 12:06:00 +01:00
Daniel Eklöf
3ca274759a
module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
Daniel Eklöf
95b1f5f261
modules: meson: regression: it’s ‘libudev’, not ‘udev’ 2022-12-14 11:01:05 +01:00
Daniel Eklöf
9ef6d73663
meson: make ‘foreign-toplevel’ plugin compile time optional 2022-12-14 10:08:48 +01:00
Daniel Eklöf
56b0047004
meson: make ‘river’ plugin compile time optional 2022-12-14 10:05:23 +01:00
Daniel Eklöf
1a81255579
meson: make ‘xwindow’ plugin compile time optional 2022-12-14 10:02:13 +01:00
Daniel Eklöf
a14d38b0cb
meson: make ‘xkb’ plugin compile time optional 2022-12-14 09:58:45 +01:00
Daniel Eklöf
b6450446a8
meson: make ‘sway-xkb’ plugin compile time optional 2022-12-14 09:53:24 +01:00
Daniel Eklöf
0cf0d64970
meson: pipewire-specific ‘json’ dependency 2022-12-14 09:50:22 +01:00
Daniel Eklöf
ec9ed66b6b
meson: make ‘script’ plugin compile time optional 2022-12-14 09:48:50 +01:00
Daniel Eklöf
eb26f64ea7
meson: make ‘removables’ plugin compile time optional 2022-12-14 09:46:08 +01:00
Daniel Eklöf
b901ac50ee
meson: make ‘network’ plugin compile time optional 2022-12-14 09:43:14 +01:00
Daniel Eklöf
8d5e8b5f20
meson: make ‘label’ plugin compile time optional 2022-12-14 09:41:44 +01:00
Daniel Eklöf
f54f583be1
meson: make ‘i3’ plugin compile time optional 2022-12-14 09:39:47 +01:00
Daniel Eklöf
85d55905f9
meson: make ‘mem’ plugin compile time optional 2022-12-14 09:36:48 +01:00
Daniel Eklöf
659b282445
meson: make ‘disk-io’ plugin compile time optional 2022-12-14 09:36:45 +01:00
Daniel Eklöf
b23365ccac
meson: make ‘cpu’ plugin compile time optional 2022-12-14 09:32:04 +01:00
Daniel Eklöf
25e123fbe6
meson: make ‘clock’ plugin compile time optional 2022-12-14 09:32:04 +01:00
Daniel Eklöf
aeef3eca0e
meson: make ‘battery’ plugin compile time optional 2022-12-14 09:32:04 +01:00
Daniel Eklöf
881359183f
meson: make ‘backlight’ plugin compile time optional 2022-12-13 16:47:48 +01:00
Daniel Eklöf
4c1398f1a5
meson: make ‘alsa’ plugin compile time optional 2022-12-13 16:41:50 +01:00
Timur Celik
24a3b90a01
modules: Implement workspace move event
Implementing the move event required to pass the IPC socket to
`i3_ipc_callback_t`, because we won't get notified about any visibility
changes of other workspaces.  That's why we query all workspaces again
after a focused workspace was moved.
2022-12-13 16:21:55 +01:00
Timur Celik
8f89545b32
modules: Warn for all unknown workspace events 2022-12-13 16:19:11 +01:00
Timur Celik
bbd2394601
modules: Implement workspace rename event
A renamed workspace caused yambar to abort in a failed assertion,
because workspace lookup was done by name and the `rename` event was not
implemented.  To resolve this issue this patch implements the `rename`
event and as a necessity changes workspace_lookup() to use ids instead
of names.
2022-12-13 16:16:16 +01:00
Ogromny
f5cfc103d0
modules/dwl: new module 2022-12-13 15:56:16 +01:00
Ogromny
19a9f099e2 modules/pipewire: new module 2022-12-13 10:16:58 +01:00
Willem van de Krol
dcf21f0b06 modules: add pulse
The pulse module shows information about PulseAudio sinks and sources.
2022-12-12 18:51:28 +01:00
Daniel Eklöf
8deac539ef
module/river: new workaround for river issue 69
River seat status events are not fired if the river interface is bound
before the output globals are (despite
zriver_status_manager_v1_get_river_seat_status() not taking an output
as argument). See https://github.com/riverwm/river/issues/69 for
details.

Up until now, we had a workaround for this, where we deferred binding
the seat status interface until after all globals have been processed.

This did not help with runtime changes. For example, if a monitor is
turned off/on (with e.g. wlr-randr), all future river seat status
output events were lost, since the new output global was being
bound *after* the river seat status object.

This patch implements a new workaround, where we re-bind the river
seat status interface every time an output global is added.
2022-10-27 15:59:32 +02:00
Daniel Eklöf
794b1ed633
module/river: fix broken debug log 2022-10-27 15:59:09 +02:00
Daniel Eklöf
8f1a123de2
module/network: only log SSID when different from current one
This prevents log spamming with poll-interval set

Closes #232
2022-10-16 16:17:08 +02:00
Daniel Eklöf
028011a816
module/sway-xkb: don’t add the “same” device multiple times
Not sure if Sway bug or not, but we’ve seen Sway presenting multiple
input devices with the exact same ID (and nothing else differentiating
them).

This caused a crash in the sway-xkb module, since we didn’t check if
we were already tracking the device, and thus bumped the
“num_existing_inputs” variable multiple times for the same input
object.

This lead to a content() returning an array with uninitialized
elements, and thus a crash.

Closes #229
2022-10-04 21:16:56 +02:00
Daniel Eklöf
8d5deda4e4
module/river: fix “use of uninitialized variable” warning
There were “goto err” statements before “unlock_at_exit” had been
initialized.
2022-10-03 09:52:44 +02:00
Daniel Eklöf
4143099e94
module/network: resurrect SSID
Recent kernels, or possibly updated wireless drivers, no longer
provide the SSID in `NL80211_CMD_NEW_STATION` responses.

For yambar, this meant the SSID was always missing.

This patch fixes this, by also issuing a NL80211_CMD_GET_SCAN
command. The response to this (NL80211_CMD_SCAN_RESULTS) _may_ return
many access points. Pick out the one that we’re associated with, and
inspect its BSS_INFORMATION_ELEMENTS. This is a raw data structure
containing, among other things, the SSID.

I haven’t been able to find any documentation of the format, but could
glean enough from
https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/tree/scan.c#n2313
to be able to parse out the SSID.

Note that we get a “device or resource busy” error if we try to issue
both the NL80211_CMD_GET_STATION and the NL80211_CMD_GET_SCAN commands
at the same time. Therefore, we issue the GET_SCAN command after
completing the GET_STATION command.

Closes #226
2022-09-10 13:46:34 +02:00
Midgard
d1a8029e6c
module/mpd: add “file” tag 2022-09-03 12:12:11 +02:00
Daniel Eklöf
5da1cd4a38
module/script: process *all* transactions received in a single read()
When the script module received multiple transactions in a single
batch, only the first were processed. This lead to multiple,
unprocessed transactions stacking up in the receive buffer. Every time
a new transaction was received, we popped the oldest transaction from
the buffer, but never actually getting to the last one. This is
perceived as "lag" by the user, where the bar displays outdated
information.

Closes #221
2022-09-03 12:09:30 +02:00
Daniel Eklöf
d002919bad
module/network: generate nl80211 sequence number from /dev/urandom 2022-09-03 12:05:58 +02:00
Daniel Eklöf
2759ba6349
module/network: generate nl80211 sequence number from /dev/urandom 2022-08-28 20:19:22 +02:00
Baptiste Daroussin
b331473a6b
meson: add missing dependencies on wayland_client 2022-07-02 23:21:38 +02:00
Baptiste Daroussin
138db05d70
portability: remove unused header 2022-07-02 23:21:37 +02:00
Baptiste Daroussin
dd1280f49d
portability: add missing header for signal related functions 2022-07-02 23:21:28 +02:00
Baptiste Daroussin
8d91cbd8a3 modules: use portable function to count cpus 2022-06-23 14:11:07 +02:00
Daniel Eklöf
6c10eb2153
module/alsa: use channel’s dB range instead of raw volume, if available
For channels that have a defined dB range, use that instead of the raw
volume range when calculating the volume percent.

Also use the same logic as alsamixer when calculating the percent from
the dB values: assume a linear scale if the dB range is “small
enough”, and otherwise normalize it against a logarithmic scale.

With this, yambar’s “percent” value matches alsamixer’s exactly.

The ‘volume’ tag remains unchanged - it always reflects the raw volume
values.

Instead, we add a new tag ‘dB’, that reflects the dB values.

Closes #202
2022-06-21 19:49:06 +02:00
Leonardo Gibrowski Faé
a0c07d7836
modules: creates disk-io-module
This creates the disk-io-module, which displays io information read from
`/proc/diskstats`. Details on `diskstats` can be found on:
https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats
2022-06-17 12:04:13 -03:00
Daniel Eklöf
b0e132beaf
module/i3: if a new workspace is created, but unfocused, assume it’s not empty
If a window is created on an unfocused workspace, yambar did not
update the empty tag correctly. At least not for persistent
workspaces.

This is because yambar relies on focus events to determine a
workspace's "empty" state. Since the new window, on the new workspace,
isn't focused, there's no focus event, and yambar thinks the workspace
is still empty.

This patch changes the logic slightly; a new workspace is considered
non-empty if it isn't focused (and has a non-zero node count).

Closes #191
2022-06-11 11:59:41 +02:00
Johannes
03e1c7dc13 module/network: Add link stats
Exports two new tags from network module, `ul-speed` and `dl-speed`.
Because these work through polling, poll-interval must be set.
Otherwise, these two tags always will be 0.
2022-06-06 15:11:24 +02:00
Daniel Eklöf
eb5cb9869c
module/network: log signal strength and TX/RX bitrates at debug level 2022-06-06 14:30:22 +02:00
Daniel Eklöf
f4ceaaad52
module/sway-xkb: handle device being added again
If a device is removed while the computer is hibernating, and then
reconnected after waking it up, Sway sends an “added” event without
first sending a “removed” event.

Yambar used to assert that an “added” event didn’t refer to an already
tracked device.

This patch changes this, and simply ignores duplicate “added” events.

Closes #177
2022-06-03 19:37:52 +02:00