Commit graph

1376 commits

Author SHA1 Message Date
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
Daniel Eklöf
1206153b03
changelog: convert all issue links to reference links in ‘unreleased’ 2022-04-22 20:25:11 +02:00
Daniel Eklöf
acb8a09376
changelog: turn all issue links into markdown hyperlinks 2022-04-22 20:23:08 +02:00
Daniel Eklöf
c1e549df54
examples: config: remove duplicate volume icons 2022-04-16 11:59:10 +02:00
Daniel Eklöf
9c28d36898
changelog: cpu: don’t error out on systems with SMT disabled 2022-04-07 13:33:41 +02:00
Daniel Eklöf
62ca06eccb
module/cpu: don’t use core ID from /proc/stat as array index
/proc/stat lists CPU usage, in the form:

  cpu ...
  cpu0 ...
  cpu1 ...
  ...
  cpuN ...

where the first line is a summary line. We’ve been using the CPU
numbers from /proc/stat to index into our internal stats array.

This doesn’t work on systems where the core IDs aren’t
consecutive. Examples of such systems are SMT systems with SMT
disabled. Here, /proc/stat may look like this instead:

  cpu ...
  cpu0 ...
  cpu2 ...
  cpu4 ...
  ...

With this patch, we ignore the CPU ID from /proc/stat. Instead, we use
a simple counter that is incremented for each (valid) cpu line found
in /proc/stat. To protect against corrupt /proc/stat content, stop
parsing /proc/stat if the number of parsed CPU lines exceed what we
consider to the be total number of CPUs in the system.

Closes #172
2022-04-07 13:28:35 +02:00
Daniel Eklöf
fce2787bdf
module/cpu: use get_nprocs() to retrieve the CPU count 2022-04-07 13:21:41 +02:00
Daniel Eklöf
43de7c8da8
Merge branch 'cloexec'
Closes #169
2022-03-29 21:57:06 +02:00
Daniel Eklöf
fd014dc33b
Don’t loop 65536 FDs, trying to close them, when fork+exec:ing
All FDs should now have the CLOEXEC flag set, and thus there’s no
longer needed to manually loop “all” possible FDs and (trying to)
close them.

Note: the alsa module (alsalib, actually) is “racy” - while booting
up, it temporarily opens the asoundrc file without CLOEXEC. If
e.g. the script module starts its script inside this window, it’ll
have a leaked FD. Not much we can do about it though :/

Closes #169
2022-03-29 18:23:55 +02:00
Daniel Eklöf
068c25d8f6
module/script: open comm-pipe + /dev/null with CLOEXEC
This ensures we don’t leak FDs when exec:ing e.g. on-click
handlers.

Note that the comm-pipe FD is *supposed* to stay open when we execing
the script. This is handled by the call to dup2(), which drops the
CLOEXEC flag. Since dup2() is called after the fork, the dup:ed FD is
never visible in the “parent” yambar process.
2022-03-29 18:22:08 +02:00
Daniel Eklöf
2b6f5b1e36
module/removables: open /proc/self/mountinfo with CLOEXEC 2022-03-29 18:21:44 +02:00
Daniel Eklöf
4bb81e8940
modules: add SOCK_CLOEXEC to all socket() calls 2022-03-29 18:21:13 +02:00
Daniel Eklöf
3ff1c95208
char32: only include stdc-predef.h if it is available
Use the (relatively new) macro __has_include() to check if
stdc-predef.h exists, and only include it if it does.

If stdc-predef.h does not exist, or if the compiler does not implement
__has_include(), stdc-predef.h is *not* included.
2022-03-20 10:50:57 +01:00
Daniel Eklöf
4daa3d9904
meson: stop using deprecated functions, require meson >= 0.58
* get_pkgconfig_variable() -> get_variable()
* prog.path() -> prog.full_path()
* meson.build_root() -> meson.global_build_root()
2022-02-27 11:32:46 +01:00
Daniel Eklöf
ffccabbb13
config: add inheritable option “font-shaping”
This patch adds an inheritable option, “font-shaping”, that controls
whether a particle that renders text should enable font-shaping or
not.

The option works similar to the ‘font’ option: one can set it at the
top-level, and it gets inherited down through all modules and to their
particles.

Or, you can set it on a module and it gets inherited to all its
particles, but not to other modules’ particles.

Finally, you can set it on individual particles, in which case it only
applies to them (or “child” particles).

When font-shaping is enabled (the default), the string particle shapes
full text runs using the fcft_rasterize_text_run_utf32() API. In fcft,
this results in HarfBuzz being used to shape the string.

When disabled, the string particle instead uses the simpler
fcft_rasterize_char_utf32() API, which rasterizes individual
characters.

This gives user greater control over the font rendering. One example
is bitmap fonts, which HarfBuzz often doesn’t get right.

Closes #159
2022-02-23 18:43:13 +01:00
Leonardo Neumann
265188ca4c
char32: add missing header to work with musl 2022-02-21 02:18:54 -03:00
Daniel Eklöf
c44970717b
module/i3: workspace::focus is apparently Sway only
On i3, users are currently greeted with:

  err: modules/i3.c:94: workspace reply/event without 'name' and/or
       'output', and/or 'focus' properties

This patch makes ‘focus’ an optional attribute. When missing, we
assume a node-count of 0, which means the workspace’s ‘empty’ tag will
always be true. Document this in the i3 man page.
2022-02-15 21:14:08 +01:00
Daniel Eklöf
1ce108f24e
Merge branch 'i3-strip-workspace-numbers' 2022-02-14 18:33:59 +01:00
Daniel Eklöf
ca407cd166
module/i3: treat workspaces on the form N:name as numerical 2022-02-14 18:33:14 +01:00
Daniel Eklöf
a2cf05a64d
module/i3: add ‘strip-workspace-numbers’ option
This is a boolean option. When set, “N:” prefixes will be stripped
from the workspaces’ name tag, *after* having been sorted (if the
‘sort’ option is being used).

This makes it useful to arrange the workspaces in a fixed order, by
prefixing the names with a number in the Sway config:

  set $ws1 “1:xyz”
  set $ws2 “2:abc”

Then, in the yambar config:

  i3:
    sort: ascending
    strip-workspace-numbers: true
2022-02-11 21:44:43 +01:00
Daniel Eklöf
605490c872
overline: new decoration
Similar to the ‘underline’ decoration
2022-02-10 20:49:09 +01:00
Daniel Eklöf
6ac046dec3
config: implement font fallback
Fonts in the configuration may now be a comma separated list of
fonts (all using the fontconfig format). The first font is the primary
font, and the rest are fallback fonts that will be searched, in order.
2022-02-10 18:34:15 +01:00
Daniel Eklöf
2cfe45ee81
changelog: add new ‘unreleased’ section 2022-02-05 18:02:50 +01:00
Daniel Eklöf
1fc6e77926
Merge branch 'releases/1.8' 2022-02-05 18:02:29 +01:00
Daniel Eklöf
3cc142a273
changelog: fix 1.8.0 header 2022-02-05 18:00:01 +01:00
Daniel Eklöf
5edc226c00
meson/pkgbuild: bump version to 1.8.0 2022-02-05 17:57:40 +01:00
Daniel Eklöf
973aa929c1
changelog: prepare for 1.8.0 2022-02-05 17:57:17 +01:00
Daniel Eklöf
b8ab8669cb
Merge branch 'fcft-3' 2022-02-05 17:54:51 +01:00
Daniel Eklöf
227f9c608a
ci: use fcft master branch 2022-02-05 17:54:39 +01:00
Daniel Eklöf
ff238e62ba
fcft: adapt to API changes in fcft-3.x 2022-02-05 12:51:08 +01:00
Daniel Eklöf
4fea561c6c
log: fold long line 2022-02-05 12:50:39 +01:00
Daniel Eklöf
52e0b5f3d1
tag: fix inverted logic for KiB vs KB logic 2022-02-01 19:01:04 +01:00