Commit graph

293 commits

Author SHA1 Message Date
Daniel Eklöf
264c051232
module/script: fix typo in memcmp()
Patch by Jan Beich
2021-02-10 16:15:49 +01:00
Daniel Eklöf
4f70346601
module/battery: re-open /sys/class/power_supply/<battery>/ every update 2021-01-14 11:08:57 +01:00
Daniel Eklöf
cfeb5260dd
module/battery: re-open files on every update
Closes #25
2021-01-14 11:08:57 +01:00
Daniel Eklöf
5bfa104935
module/i3: separate numerical workspace names from non-numerical
When sorting workspaces in ascending order, put numerical
workspaces *after* non-numerical ones.

When sorting in descending order, put numerical workspaces *before*
non-numerical.

In both cases, sort numerical workspaces using a numerical comparison,
rather that doing a lexicographical sorting.

Closes #30
2021-01-04 20:16:30 +01:00
Daniel Eklöf
e85e3e8ced
module/mpd: increase tag count in tag set
96d2d057e0
added a new tag, ‘volume’, but didn’t bump the tag count.

This meant the last tag in the set, ‘elapsed’ was never seen by
anybody, and not free:d when the tag set was free:d.
2021-01-04 20:01:46 +01:00
Daniel Eklöf
3da796810b
module/i3: take lock while updating ‘mode’ 2020-12-12 22:42:19 +01:00
Daniel Eklöf
d9496152e3
module/i3: add new tag ‘mode’
This tag is a string: the name of the currently active mode
2020-12-12 22:42:17 +01:00
Daniel Eklöf
20df360937
module/i3: add option ‘sort’
Possible values: none, ascending, descending. Sorts the workspace list
accordingly. The default value is ‘none’.
2020-12-08 19:03:30 +01:00
Daniel Eklöf
d5fc1074d8
module/i3: revert to old behavior of not sorting workspaces
Sorting workspaces needs a config option.
2020-12-03 19:07:41 +01:00
Daniel Eklöf
678d82e4d4
module/i3: use a tllist for workspaces instead of a dynamic array 2020-12-03 18:31:42 +01:00
optimus-prime
96d2d057e0 module/mpd: add volume tag 2020-12-03 00:43:47 +05:30
Daniel Eklöf
4a9f550069
module/battery: don’t crash if we fail to read from ‘status’ 2020-11-25 20:41:44 +01:00
Daniel Eklöf
f438ad9b44
module/script: send SIGINT, SIGTERM, SIGKILL, until child has died 2020-11-25 20:41:10 +01:00
Daniel Eklöf
ba54e709ee
module/script: no need to handle SIGCHLD
Assume that a closed pipe means the child died. Even if it hasn’t, we
can’t read anymore from it. We’ll end up killing it anyway before
returning from run().
2020-11-25 20:41:10 +01:00
Daniel Eklöf
e0169d38f3
module/script: don’t re-direct stderr to /dev/null 2020-11-25 20:41:10 +01:00
Daniel Eklöf
aa34925f54
module/script: close all unrelated FDs
While most FDs are CLOEXEC, not all are. For example, other script
modules’ re-direction pipes.
2020-11-25 20:41:10 +01:00
Daniel Eklöf
31f6a4a6a0
module/script: don’t re-close comm-pipe on failure 2020-11-25 20:41:10 +01:00
Daniel Eklöf
fef40d18e1
module/sway-xkb: fix name of .so file, fixes load failures when built as shared module 2020-11-25 20:41:09 +01:00
Daniel Eklöf
074af015fb
module/river: exclude seats while river is starting up
This is mainly to fix a race when river is *not* running; sometimes we
ended up allocating particles for N seats in content(), but then when
iterating the seats, run() had destroyed all, or some of the seats,
causing us to feed NULL pointers to dynlist, which crashed.
2020-11-25 20:41:09 +01:00
Daniel Eklöf
74754b0ab9
module/script: improved verification of tag type parameters and tag values
* Verify int/float/bool values are that, and nothing else
* Verify tag ranges are integers
* Verify a range tag value is inside its range
* Don’t allow anything but false|true for booleans
2020-11-25 20:41:09 +01:00
Daniel Eklöf
f0a34d0055
module/script: parse booleans correctly
User is expected to send ‘false’ or ‘true’. But we were parsing the
value using `strtol()`. This caused all bools to be false, since
`strtol()` would always return 0.
2020-11-25 20:36:46 +01:00
Daniel Eklöf
2bb70c6fcb
module/script: require ‘path’ to be an absolute path 2020-11-25 20:36:46 +01:00
Daniel Eklöf
5c9030129d
module/script: use NULL terminated ‘value’ when converting to int/bool/float 2020-11-25 20:36:46 +01:00
Daniel Eklöf
37447cd955
module/script: initialize string tags from our NULL-terminated ‘value’
`_value` is a pointer into the receive buffer, and may not be NULL
terminated, and may also contain data belonging to the next tag.
2020-11-25 20:36:46 +01:00
Daniel Eklöf
9945fce2d2
module/script: explicitly ignore return value of write(3) 2020-11-25 20:36:45 +01:00
Daniel Eklöf
7f1ffd126b
module/script: close script communication pipe FD on error 2020-11-25 20:36:45 +01:00
Daniel Eklöf
fb0d443e1d
module/script: plug memory leak: free ‘tags’ array 2020-11-25 20:36:45 +01:00
Daniel Eklöf
73407853e4
module/script: can’t use logical OR when building a base 10 number 2020-11-25 20:36:45 +01:00
Daniel Eklöf
08bac77907
module/script: script arguments
Add new config attribute, ‘args’. This is a list of strings, that will
be passed as arguments to the script.
2020-11-25 20:36:45 +01:00
Daniel Eklöf
8702378c74
module/script: restore signal handlers and mask in child process
This fixes the issue where `killpg()` didn’t manage to kill the
sub-process tree.
2020-11-25 20:36:45 +01:00
Daniel Eklöf
c911d20e73
module/script: add debug logging of raw received data 2020-11-25 20:36:45 +01:00
Daniel Eklöf
f2814f786e
module/script: copy ‘value’ to a NULL-terminated string
This ensures e.g. strtol() doesn’t parse data beyond current
tag/value.
2020-11-25 20:36:45 +01:00
Daniel Eklöf
430e505bd2
module/script: remove debug output that wasn’t actually using LOG_DBG() 2020-11-25 20:36:44 +01:00
Daniel Eklöf
fbaa208768
module/script: disable debug output 2020-11-25 20:36:44 +01:00
Daniel Eklöf
80d0025e64
module/script: drop setsid() call 2020-11-25 20:36:44 +01:00
Daniel Eklöf
19fe2f5a6f
module/script: wip: new plugin, reads data from a user provided script/binary
This module exec’s a script (or binary), specified by the ‘path’
attribute in the configuration.

It then reads tags from the script’s stdout.

The format of the output is:

  tag|type|value
  tag|type|value
  <empty line>

I.e. the script writes N tags followed by an empty  line. This
constitutes a transaction.

When a new transaction is received, its tags replaces *all* previous
tags.
2020-11-25 20:36:44 +01:00
Daniel Eklöf
cadf227bc6
module/battery: doh! fix spelling of ‘status’ 2020-11-14 23:03:11 +01:00
Daniel Eklöf
c0c5df0f6a
module/battery: map “Not charging” to STATE_DISCHARGING 2020-11-14 23:02:18 +01:00
Daniel Eklöf
8a7e07af28
module/mpd: don’t overload enum mpd_state
We overloaded enum mpd_state to add an “offline” state. Don’t do
this. We can detect the offline state by checking if our connection
object is NULL.

Closes #16
2020-11-09 20:27:42 +01:00
Daniel Eklöf
d645aff48e
module/clock: silence compiler warning: ensure timeout_ms is initialized 2020-09-24 17:47:20 +02:00
Daniel Eklöf
e25c42dc87
module/river: meson: explicitly add wl_proto_src + wl_proto_headers to sources
The ‘river’ module depends on generated protocol sources. These are
normally provided, indirectly, by the Wayland bar backend. But when
building plugins as shared modules, the plugins no longer depend on
the bar, and thus ‘river’ fails to build.

Fix this by doing two things:

* **Remove** the ‘river’ protocol from the ‘generic’ Wayland protocols
* Explicitly add both the generic and the ‘river’ specific protocols
  to the ‘river’ module.
2020-09-24 17:30:18 +02:00
Daniel Eklöf
0cde404d2a
module/clock: detect when we need to update every second
Closes #12
2020-09-24 16:01:18 +02:00
Daniel Eklöf
318965b715
module/clock: internally use either minutes or seconds granularity 2020-09-24 14:32:39 +02:00
Daniel Eklöf
db53cf9245
module/alsa+backlight: round() percentage values
Closes #10
2020-09-24 13:57:05 +02:00
Daniel Eklöf
85ae4cca37
module/alsa: add ‘percent’ tag - volume level as a percentage
Fixes part of #10
2020-09-24 13:54:41 +02:00
Daniel Eklöf
06c2a69120
moduel/river: at startup, don't instantiate seat-status before binding outputs 2020-07-24 17:44:35 +02:00
Daniel Eklöf
7b2d524598
moduel/river: wip: new module; 'tags' status on Wayland compositor 'river' 2020-07-23 19:00:42 +02:00
Daniel Eklöf
6433373f93
module/i3-common: fix compilation warning with asan 2020-07-07 14:06:29 +02:00
Daniel Eklöf
cc8a54a0de
Merge branch 'battery-charge-current'
Closes #6
2020-06-22 10:58:34 +02:00
Daniel Eklöf
19d91dbb44
module/battery: estimate remaining time from charge+current
Time remaining is now taken from 'time_to_empty_now' if available. If
not, use 'energy' + 'power' if available, and if those does not exist,
use 'charge' + 'current'.

If neither exists, hardcode to 99:00.
2020-06-21 20:44:34 +02:00