Commit graph

455 commits

Author SHA1 Message Date
QuincePie
a467f56677
i3: Handle FALLBACK output for workspaces.
sway moves the workspace to fallback_output when there is no output. For example: when all the screens are off. This commit adds an ignore for the fallback output.
2024-05-20 07:44:50 +02:00
Delgan
b3313cefc6 Fix remaining typos in the codebase (and update CI checks) 2024-05-02 16:28:51 +00:00
Birger Schacht
3a7455913f
fix: typo
Probaly -> Probably
2024-04-30 08:56:18 +02:00
Sertonix
547cef5afb network: fix missing break in switch statement
This can cause the first character of the string to be read as an iface state.

Fixes https://codeberg.org/dnkl/yambar/issues/377
2024-04-22 16:23:16 +02:00
Delgan
b85ba99980 Apply "clang-format" preferences globally 2024-04-07 10:05:10 +02:00
Delgan
da19c09122 Add missing "dynlist" dependency to network module 2024-04-01 08:53:50 +00:00
Sertonix
c44c66c83f
network: use dynlist instead of fixed name
Closes #271
Closes #265
Closes #71
2024-04-01 08:34:18 +02:00
Haden Collins
89ae7bd743
Handle reload workspace events from sway correctly
Closes #361
2024-03-14 16:14:53 -05:00
Daniel Eklöf
f2d25c8341
script: fix buffer resize bug
If the amount of data coming in is more than we can hold in our
buffer, we resized the buffer by doubling its size. However, there
were two(!) issues here:

* If this was the first resize, the buffer size was set to 1024. This
  may not be enough (i.e. there may be more than 1024 bytes to process).
* In all other cases, the buffer size was doubled. However, there is
  still no guarantee the buffer is large enough.

Fix by looping until the buffer *is* large enough.
2024-02-05 12:52:40 +01:00
Delgan
aeeef4f236
Fix "mem" values updated while it should not
Closes #352
2024-02-05 12:49:26 +01:00
Delgan
195ac5d1cd
Fix incorrect empty/title state of i3 workspaces 2024-02-05 12:45:02 +01:00
Delgan
e1f78a16ab
Add new "quality" tag to "network" module 2024-01-04 13:44:54 +01:00
Daniel Eklöf
9365580539
module: battery: style 2024-01-03 15:30:03 +01:00
Jordan Isaacs
a943def94e
battery scale and discharge smoothing 2024-01-03 15:22:12 +01:00
Daniel Eklöf
8e4d7f04e4
module/script: path: expand ‘~’ to the user’s $HOME directory
Closes #307
2023-07-11 12:38:44 +02:00
Daniel Eklöf
f948b9f8f9
module/battery: regression: allow poll-interval == 0
The regression was introduced after 1.9.0, hence no changelog entry.
2023-07-09 11:18:33 +02:00
Daniel Eklöf
6220a07aaf
module/battery: debug log when updating due to udev notification 2023-07-09 11:18:33 +02:00
Daniel Eklöf
a342e036ad
module/battery: don’t reset poll timeout on irrelevant udev notifications
We may receive udev notifications for the power-supply subsystem, that
aren’t for us.

Before this patch, this would result in a new poll() call, with
timeout being set to m->poll_interval again. That is, the poll timeout
was being reset.

In theory, this means we could end up in a situation where the battery
status is never updated.

This patch fixes it by tracking how much time is left of the poll
interval. The interval is reset either when the timeout has occurred,
or when we receive an udev notification that _is_ for us.

Hopefully closes #305
2023-07-09 11:18:30 +02:00
David Bimmler
b694fc1583 battery: also show time_to_full
The kernel also provides time_to_full, also in seconds, so let's use
that too. Both time_to_empty and time_to_full have 0 as their default
value, hence only consider them for the estimate if they are
positive (instead of non-negative).

Signed-off-by: David Bimmler <git@d4ve.email>
2023-07-07 17:32:41 +02:00
David Bimmler
08f5f444eb battery: correct time_to_empty calculation
The kernel docs state that time_to_empty contains the estimation of
remaining time in seconds. Hence, calculate estimate minutes and hours
from that in a more correct way.

Signed-off-by: David Bimmler <git@d4ve.email>
2023-07-07 17:32:41 +02:00
tiosgz
5e3859f218 module/network: allow poll-interval == 0
Apparently the possibility to disable it was missed when the interval
was migrated to use milliseconds.
2023-04-08 20:06:07 +00:00
Yutaro Ohno
963b9d47ee modules/dwl: handle the appid status
dwl added an "appid" field as output status [1]. We currently don't
handle this field, and thus output warnings that say "UNKNOWN action".

Handle the "appid" field correctly and expose a value of this field to
users. Also, suppress the warnings.

Link: 7f9a212476 [1]
2023-03-26 16:08:55 +09:00
Armin Fisslthaler
f21db9caca i3: add "native" sway/i3 sort mode
This adds a sort mode for workspaces which corresponds to the default
behavior in sway/i3.
2023-03-24 17:48:26 +01:00
Oleg Hahm
8ccd79ad08 modules/network: do not use IPv6 link-local
Probably you don't want to see your IPv6 link-local address but rather a
global one.
2023-03-08 18:41:20 +01:00
Daniel Eklöf
d1776714ed
Merge branch 'pipewire-roundf'
Closes #262
2023-01-21 15:50:22 +01:00
Leonardo Hernández Hernández
5da51210de
module/dwl: allow specify the name of tags 2023-01-16 19:53:21 -06:00
Ogromny
bdbcc0100a modules/pipewire: change type of volume from uint8 to uint16 2023-01-16 10:29:16 +01:00
Ogromny
10fde4dd0a modules/pipewire: use roundf instead of ceilf for more accuracy 2023-01-16 10:29:16 +01:00
Daniel Eklöf
134ae847dc
module/river: add support for ‘layout’ events 2023-01-12 18:15:16 +01:00
Daniel Eklöf
f75168796a
module/pipewire: handle failures when trying to connect to pipewire
* Replace asserts() with error logs
* Handle not being connected in content()
* Return from run() with an error
2023-01-02 14:08:21 +01:00
Daniel Eklöf
73ccafdade
module/i3: fix regression in handling of persistent workspaces
bbd2394601 added support for ‘rename’
and ‘move’ events. In order to do that, it changed how workspace
events are matched against our internal workspace list: from string
comparing the workspace name, to checking i3/sway’s workspace ID
parameter.

This introduced a regression in our handling of persistent
workspaces. A persistent workspace is one that isn’t removed from the
bar when it’s deleted (empty, and switched away from) by i3/sway.

This concept doesn’t exist in i3/sway, but is something we’ve
added. Put simple, the way we do this is be keeping the workspace in
our list, even when i3/sway tells us it has been deleted.

However, at this point the workspace doesn’t have an ID anymore. And
the same is true at startup; when we initialize the persistent
workspaces, we only have their names. Not their IDs (since the
workspaces don’t actually exist yet).

To this the regression, we need to:

a) fallback to looking up workspaces by name. That is, if we fail to
  find one with a matching ID, try again using the workspace name. For
  _this_ to match, we also required the matched workspace to be a
  persistent workspace, with an ID < 0 (which essentially means the
  workspace doesn’t exist yet).

b) reset the ID to -1 when a persistent workspace is "deleted".

Closes #253
2022-12-28 15:21:46 +01:00
Leonardo Hernández Hernández
02d281df58
module/dwl: correctly handle the title
Uupdate the title when process a new batch of info instead of call
strtok_r and looping until `string` is NULL.

This fixes an issue where only the last part of the title was kept.
2022-12-28 15:19:11 +01:00
Daniel Eklöf
e4edbd26c6
modules: change min poll interval from 500ms to 250ms 2022-12-27 13:20:31 +01:00
Daniel Eklöf
310c07b03d
module/battery: using a static buffer in readline_from_fd() isn’t thread safe 2022-12-27 13:17:06 +01:00
Daniel Eklöf
c4f820e486
module/script: poll-interval: convert value from ‘seconds’ to ‘milliseconds’ 2022-12-22 12:06:25 +01:00
Daniel Eklöf
500b051fe4
module/network: poll-interval: convert value from ‘seconds’ to ‘milliseconds’ 2022-12-22 12:06:15 +01:00
Daniel Eklöf
8fbbce10a5
module/battery: poll-interval: convert value from ‘seconds’ to ‘milliseconds’ 2022-12-22 11:59:02 +01:00
Daniel Eklöf
ac8e45c331
module/mem: cleanup poll-interval
* man page: spell out ‘milliseconds’
* use a ‘static const’ variable for min_poll_interval, instead of a
  macro
2022-12-22 11:47:44 +01:00
Daniel Eklöf
a18296a179
module/disk-io: cleanup poll-interval
* man page: spell out ‘milliseconds’
* use a ‘static const’ variable for min_poll_interval, instead of a
  macro
2022-12-22 11:47:44 +01:00
Daniel Eklöf
1f25978eb4
module/cpu: cleanup poll-interval
* man page: spell out ‘milliseconds’
* use a ‘static const’ variable for min_poll_interval, instead of a
  macro
2022-12-22 11:46:00 +01:00
Daniel Eklöf
cb8acf261a
module/mem: rename ‘interval’ to ‘poll-interval’ 2022-12-18 16:51:41 +01:00
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