Commit graph

1557 commits

Author SHA1 Message Date
Daniel Eklöf
3c3a881638
ci (gitlab): add flex+bison 2022-12-11 18:32:52 +01:00
Leonardo Gibrowski Faé
4a41d4296a
Implement '&&' and '||' operators on map
'-' is a valid character for tags.

Commit 03e1c7d (module/network: Add link stats, 2022-04-30) introduced
two new tags for the network module: `ul-speed` and `dl-speed`. These
use the `-` character, that was previously never used in any tag.

We had two options: either change those tags to use `_` instead, or just
accept `-`s as a valid character. Going forward, I can see many people
deciding to name their tags with `-` instead of `_`, so I believe it is
better to just accept it once and for all.

Note that `-` cannot be used as the first character of a tag (e.g.
`-tag1`) since the `-` has a special meaning in `.yml` files. I don't
believe this will happen often, however, and should be easy to both
detect and correct if it does.
2022-12-10 22:53:30 -03:00
Daniel Eklöf
463b39b56d
changelog: line-wrap long line 2022-12-09 15:25:29 +01:00
Leonardo Gibrowski Faé
87854fa101
float tag: let user specify number of decimals
Closes #200
2022-12-09 15:24:59 +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
Peter Rice
6ed576c719
particle/on-click: support next/previous buttons 2022-10-04 21:14:29 +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
Horus
6427e8213c Merge pull request 'doc: string particle’s “max” uses Unicode … now' (#220) from midgard/yambar:doc-unicode-ellipsis into master
Reviewed-on: https://codeberg.org/dnkl/yambar/pulls/220
2022-09-01 14:42:28 +02:00
Midgard
aa09d88d8e
doc: string particle’s “max” uses Unicode … now
And fix a typo in the yambar-particles file.
2022-09-01 12:18:49 +02:00
Daniel Eklöf
2759ba6349
module/network: generate nl80211 sequence number from /dev/urandom 2022-08-28 20:19:22 +02:00
Daniel Eklöf
4257c80eee
ci (sr.ht): pull directly from git.sr.ht 2022-08-23 16:42:56 +02:00
Leonardo Gibrowski Faé
084a9021b9
fix configurations in example scripts
We forgot to update the configurations in the example scripts to the new
map syntax based on conditions. This fixes that.

Related to #201
2022-07-22 10:11:25 +02:00
Baptiste Daroussin
b331473a6b
meson: add missing dependencies on wayland_client 2022-07-02 23:21:38 +02:00
Baptiste Daroussin
d15d1f58f7
meson: declare CFLAGS dependencies for xcb-stuff
on FreeBSD we need append to the lookup path a non default path to
find headers
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
hiog
cb47c53de4 Update 'examples/configurations/laptop.conf' 2022-06-16 11:29:04 +02:00
Daniel Eklöf
605a6a9ede
particle/string: don’t try to call c32len() on a NULL string 2022-06-13 12:07:24 +02:00
Daniel Eklöf
1b03bd6bc0
particle/string: simplify; no need to call c32len(wtext) twice 2022-06-13 12:06:59 +02:00
Daniel Eklöf
36a4250a96
changelog: i3: newly created, unfocused, workspaces are considered non-empty 2022-06-11 12:00:16 +02: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
9353aa14fe
bar: set clip region before calling the particles’ expose() methods
This ensures particles that are “too wide” doesn’t try to render
outside the bar, possibly overrunning both margins and borders. Or
worse, crashes yambar.

Closes #198
2022-06-05 00:33:30 +02:00
Daniel Eklöf
a8994b9268
tag: for now, always use 2 decimals for floats
In the future, we’ll want to add a way to specify the number of
decimals, as part of the formatter.
2022-06-03 19:43:28 +02:00
Daniel Eklöf
8a8a40bfb5
changelog: sway-xkb: don’t crash on “added” event for already tracked device 2022-06-03 19:37:57 +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
Daniel Eklöf
ca077447c2
module/network: tx/rx-bitrate is now in bits/s instead of Mb/s 2022-06-02 22:25:53 +02:00
Daniel Eklöf
d9d5671e04
doc: tags: fix divisors for kb/mb/gb and kib/mib/gib
They were inversed: kb/mb/gb uses 1000^n, while kib/mib/gib uses
1024^n.
2022-06-02 22:21:09 +02:00
Daniel Eklöf
de4814d16e
tag: use as_float() when kb/mb/gb formatting a float tag value 2022-06-02 21:33:04 +02:00
Daniel Eklöf
c738f1c63d
module/river: add support for the ‘mode’ event
Seat status v3 adds a new ‘mode’ event, that informs us of the current
mode (as set by e.g. ‘riverctl enter-mode passthrough’)

The mode is exposed as a tag (named “mode”) on river’s “title”
particle:

  - river:
      title:
        map:
          default: {empty: {}}
          conditions:
            mode == passthrough:
              string: {text: " {mode} ", deco: {background: {color: ff0000ff}}}
2022-06-02 17:24:42 +02:00
Daniel Eklöf
a3a0334069
changelog: dwl-tags updates 2022-04-24 22:10:57 +02:00
Daniel Eklöf
5fc092a874
examples: dwl-tags: adapt parsing of output to recent DWL changes(?)
Closes #178
2022-04-24 22:10:49 +02:00
Daniel Eklöf
acc20913ef
Merge branch 'conditions-on-tag'
Closes #137
2022-04-24 21:07:33 +02:00
Leonardo Gibrowski Faé
3b5845370c doc: explain that order in map conditions matter 2022-04-24 15:47:53 -03:00
Leonardo Gibrowski Faé
82a3b2ae11 Updates CHANGELOG.md and changes map.c formatting 2022-04-24 11:21:40 -03:00
Leonardo Gibrowski Faé
0d878e8b5c Trimming outer '"' when parsing the values. 2022-04-23 17:13:24 -03:00
Leonardo Gibrowski Faé
4c4a20d835 Updated docs to comply with new map syntax 2022-04-23 17:13:24 -03:00
Leonardo Gibrowski Faé
2b103b7acd Implement conditions on tag
A condition is formed by:
    <tag> <op> <value>

<tag> is the normal yambar tag. <op> is one of '==', '!=', '<', '<=', '>', or
'>='. <value> is what you wish to compare it to.

'boolean' tags must be used directly. They falsehood is matched with '~':

    <tag>
    ~<tag>

Finally, to match an empty string, one must use ' "" ':
    <tag> <op> ""
2022-04-23 17:13:24 -03:00
Daniel Eklöf
4496d82cfb
changelog: hyperlink lists under their corresponding sub-section 2022-04-23 11:14:50 +02:00