Commit Graph

1935 Commits

Author SHA1 Message Date
Matthias Richter
af3c868a5b Catch exception on erroneous rules
std::regex and std::regex_replace may throw an std::regex_error if the
expression or replacement contain errors.

Log this error and carry on with the next rule, so that the title is
shown even if the config contains errors.
2021-04-21 12:24:47 +02:00
Matthias Richter
b16c8972c7 Add option to rewrite sway/window title
Rewrites window title according to config option "rewrite".
"rewrite" is an object where keys are regular expressions and values are
rewrite rules if the expression matches. Rules may contain references to
captures of the expression. Regex and replacement follow ECMA-script
rules. If no regex matches, the title is left unchanged.

example:
"sway/window": {
  "rewrite": {
    "(.*) - Mozilla Firefox": " $1",
    "(.*) - zsh": " $1",
  }
}
2021-04-21 12:24:47 +02:00
Alex
1c9b62de07
Merge pull request #1076 from Scrumplex/add-mpd-volume-status
Implement MPD volume status format template
2021-04-20 09:38:19 +02:00
Sefa Eyeoglu
fc89b01ba6
feat: implement mpd volume format template
Allow the user to show the current volume from MPD status via the
`format` and/or `tooltip-format` configuration options.

The values are provided by libmpdclient and are integers, generally
between 0-100 (without %). Values above 100 are also possible, as mpd
output plugins like `pulse` support volumes above 100%.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2021-04-20 08:35:47 +02:00
Alex
70e67c5daa
Merge pull request #1074 from Anakael/feature/taskbar-ignore-list
[wlr/taskbar] Add ignore-list param
2021-04-18 20:02:14 +02:00
dmitry
5ad3b6018a Remove exceed protected 2021-04-18 21:37:58 +03:00
dmitry
ba278985e8 Add ignore-list param to wlr/taskbar 2021-04-18 21:34:29 +03:00
Alex
5300461c79 chore: v0.9.7 2021-04-15 21:17:54 +02:00
Alex
d0f60c47bf
Merge pull request #1070 from jgmdev/cpumodulefix
[Module CPU] fix crash due to empty frequencies.
2021-04-15 21:17:00 +02:00
Alex
07f2470e36
Merge pull request #974 from kamushadenes/patch-1
Improve Pulseaudio sink/source separation
2021-04-15 21:09:35 +02:00
jgmdev
f8f1e791a3 [Module CPU] fix crash due to empty frequencies.
On some systems (eg: ARM) the supported frequencies of the CPU are not
properly reported by /proc/cpuinfo so if that fails try to retrieve them
from /sys/devices/system/cpu/cpufreq/policy[0-9]/cpuinfo_[max|min]_freq.
2021-04-15 14:30:29 -04:00
Alex
729a4fe37e chore: v0.9.6 2021-04-15 16:09:45 +02:00
Alex
97e4b53cf3
Merge pull request #1061 from akheron/multi-battery-status
Use the correct battery status when multiple batteries are present
2021-03-28 19:35:51 +02:00
Petri Lehtinen
c850212288 Use the correct battery status when multiple batteries are present 2021-03-28 20:07:35 +03:00
Alex
600afaf530
Merge pull request #1037 from Moonlight-Angel/cpu-frequency
Add cpu min/max/avg frequencies
2021-03-25 12:09:42 +01:00
Alex
c21dc681c9
Merge pull request #1052 from Logarithmus/fix-sway-language-manpage
meson.build: add missing waybar-sway-language manpage
2021-03-23 14:57:06 +01:00
Artur Sinila
f4ad5d36ec meson.build: add missing waybar-sway-language manpage 2021-03-23 16:51:08 +03:00
Alex
f627fe3a39
Merge pull request #1051 from lunik1/disk-css
Add default styling for disk module
2021-03-23 12:31:52 +01:00
Alex
7b6dc33824
Merge pull request #1056 from martin2250/patch-1
Add style for battery state "plugged"
2021-03-23 12:30:50 +01:00
Martin Pittermann
b4ee994515
Add style for battery state "plugged" 2021-03-23 00:26:45 +01:00
Alex
b1dd62078f
Merge pull request #1002 from nullobsi/master
add length limits for MPD module tags
2021-03-15 09:15:09 +01:00
nullobsi
bf3efdb89c
Merge branch 'master' into master 2021-03-14 21:34:25 -07:00
lunik1
354de5f13f
style: add styling to disk module 2021-03-13 15:17:11 +00:00
Alex
b4ffb8af45
Merge pull request #1050 from cmovcc/cmovcc/load-values
Fix: CPU load values
2021-03-13 16:11:39 +01:00
Antonin Reitz
a49b12b66b Fix CPU load values 2021-03-12 20:58:51 +01:00
nullobsi
1573e1eb97
change variable instead of substr(len) 2021-02-26 13:29:58 -08:00
nullobsi
9b9daaee6f
Merge branch 'master' into master 2021-02-26 13:22:34 -08:00
Genesis
99643ba2e6
Stub parseCpuFrequencies on *BSD platforms 2021-02-25 09:14:51 +01:00
Genesis
08ea5ebe1f
Add cpu frequency 2021-02-25 09:14:51 +01:00
Alex
cb1c7ea12c
Merge pull request #1032 from matteodelabre/terminate-custom-on-exit
Terminate custom module scripts on exit
2021-02-23 09:40:05 +01:00
Alex
1026100c9d
Merge pull request #1035 from alebastr/deferred-output-removal
fix: schedule output destruction on idle callback
2021-02-23 09:39:09 +01:00
Aleksei Bavshin
943ba3a2da
fix: schedule output destruction on idle callback
Defer destruction of bars for the output to the next iteration of the
event loop to avoid deleting objects referenced by currently executed
code.
2021-02-22 18:35:09 -08:00
nullobsi
bfa9f1e69b
Merge branch 'master' into master 2021-02-22 09:34:58 -08:00
Alex
4d150e9340
Merge pull request #1036 from WhyNotHugo/systemd-reload
Configure systemd.service file to allow reloading
2021-02-19 15:21:15 +01:00
Hugo Osvaldo Barrera
2019028688 Configure systemd.service file to allow reloading
This allows `systemctl --user reload waybar` to reload waybar's config
as expected.
2021-02-19 14:33:38 +01:00
nullobsi
b4728f2e1d
Merge branch 'master' into master 2021-02-16 21:51:31 -08:00
Mattéo Delabre
d8706af2ea
Terminate custom module scripts on exit
(Fixes #358.)

Subprocesses created for custom module scripts were previously left
running when the parent Waybar process exited. This patch sets the
parent-death signal of child processes (PR_SET_PDEATHSIG on Linux,
PROC_PDEATHSIG_CTL on FreeBSD) to SIGTERM.

Caveats:

* This uses Linux-specific or FreeBSD-specific calls. I don’t know if
  this project targets other systems?
* There is a possibility that Waybar exits after calling `fork()`, but
  before calling `prctl` to set the parent-death signal. In this case,
  the child will not receive the SIGTERM signal and will continue to
  run. I did not handle this case as I consider it quite unlikely, since
  module scripts are usually launched only when Waybar starts. Please
  let me know if you think it needs to be handled.

Testing:

* With `htop` open, run Waybar v0.9.5 with a custom module that has an
  `exec` script. Terminate the Waybar process and notice that the
  script’s subprocess stays alive and is now a child of the init
  process.
* Run Waybar with this patch and follow the same steps as above. Notice
  that this time the script’s subprocess terminates when the parent
  exits.
2021-02-12 21:14:46 +01:00
Alex
08e19602f7
Merge pull request #1015 from alebastr/rfkill-events
rfkill code refactoring
2021-02-11 10:20:13 +01:00
nullobsi
b12b500bfc
Merge branch 'master' into master 2021-02-10 09:39:03 -08:00
Aleksei Bavshin
e786ea601e
fix(rfkill): handle EAGAIN correctly 2021-02-10 08:26:21 -08:00
Alex
36da8117c0
Merge pull request #1026 from euclio/idle-inhibit-fix
disable Idle Inhibitor module if unsupported
2021-02-10 10:32:09 +01:00
Aleksei Bavshin
6d5afdaa5f
fix(network): don't block the main thread on rfkill update
Moving rfkill to the main event loop had unexpected side-effects.
Notably, the network module mutex can block all the main thread events
for several seconds while the network worker thread is sleeping.

Instead of waiting for the mutex let's hope that the worker thread
succeeds and schedule timer thread wakeup just in case.
2021-02-09 21:27:22 -08:00
Aleksei Bavshin
52dd3d2446
refactor(bluetooth): remove interval and timer thread
The timer thread was always reading the same value from Rfkill state.
2021-02-09 21:27:21 -08:00
Aleksei Bavshin
ecc32ddd18
refactor(bluetooth): remove Bluetooth::status_
The string was always overwritten in `update()`; don't need to store
temporary value in the class.
2021-02-09 21:27:20 -08:00
Aleksei Bavshin
38c29fc242
refactor(rfkill): poll rfkill events from Glib main loop
Open rfkill device only once per module.
Remove rfkill threads and use `Glib::signal_io` as a more efficient way
to poll the rfkill device.
Handle runtime errors from rfkill and stop polling of the device instead
of crashing waybar.
2021-02-09 21:27:19 -08:00
Aleksei Bavshin
40f4dc9ecf
fix(rfkill): accept events larger than v1 event size
Kernel 5.11 added one more field to the `struct rfkill_event` and broke
unnecessarily strict check in `rfkill.cpp`. According to `linux/rfkill.h`,
we must accept events at least as large as v1 event size and should be
prepared to get additional fields at the end of a v1 event structure.
2021-02-09 21:27:18 -08:00
Andy Russell
95a6689077
disable Idle Inhibitor module if unsupported 2021-02-09 18:37:13 -05:00
Alex
c5f875dc5f
Merge pull request #1027 from alebastr/output-fixes
Fix more issues with duplicated bars
2021-02-09 11:17:16 +01:00
Aleksei Bavshin
89b5e819a3
fix(client): improve guard from repeated xdg_output.done events
Multiple .done events may arrive in batch. In this case libwayland would
queue xdg_output.destroy and dispatch all pending events, triggering
this callback several times for the same output.

Delete xdg_output pointer immediately on the first event and use the
value as a guard for reentering.
2021-02-08 23:25:58 -08:00
Aleksei Bavshin
6585381230
fix(client): remove unnecessary wl_output_roundtrip
At this point we're not awaiting any protocol events and flushing
wayland queue makes little sense. As #1019 shows, it may be even harmful
as an extra roundtrip could process wl_output disappearance and delete
output object right from under our code.
2021-02-08 22:30:01 -08:00