Commit Graph

138 Commits

Author SHA1 Message Date
Aleksei Bavshin f885baba61
fix(clock): remove literal operator with reserved name
```
../include/util/date.hpp:34:26: warning: literal operator suffixes not preceded by ‘_’ are reserved for future standardization [-Wliteral-suffix]
   34 | constexpr decltype(auto) operator""d(unsigned long long d) noexcept {
```
2024-02-19 21:56:47 -08:00
Aleksei Bavshin 543290ab07
fix: `-Wnon-virtual-dtor` warning in CssReloadHelper
```
../include/util/css_reload_helper.hpp:15:7: warning: 'class waybar::CssReloadHelper' has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
```
2024-02-17 21:43:10 -08:00
Alexis Rouillard 1dce607c42
Merge pull request #2852 from dpayne/add_css_reload
Adding css reloader
2024-01-29 22:44:29 +01:00
dpayne 10cb4180f6 * Fixing clang tidy comments
* Fixing missing includes
* Fixing formatting
2024-01-28 14:44:25 -08:00
Alexis Rouillard 5534fc48b1
Merge pull request #2496 from zjeffer/tests/json
Fix JSON parsing with hexadecimal characters
2024-01-28 23:38:54 +01:00
Jay-716 14d168c254
pulseaudio: extract context connecting into `connectContext()` 2024-01-27 23:47:39 +08:00
dpayne f7eca99496 Using Gio::FileMonitor for watching style changes 2024-01-21 20:49:13 -08:00
dpayne d7ed4f1fa8 Adding css reloader 2024-01-21 18:23:46 -08:00
zjeffer 8f5d0098d6 Fixed json parsing with hexadecimal characters
* replace \x with \u00 to follow JSON spec
* fixes #2475 and #2495
* added unit tests for json parsing
2024-01-14 14:06:06 +01:00
Jo De Boeck 0ea5143493 Pass WAYBAR_OUTPUT_NAME environment variable to custom exec scripts
Signed-off-by: Jo De Boeck <deboeck.jo@gmail.com>
2023-12-19 22:54:12 +02:00
Viktar Lukashonak 86a38980e4
c++20. clock chrono API. STL + format
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-11-10 17:57:26 +03:00
Alexis Rouillard e24adbc3c2
Merge pull request #2612 from ErikReider/privacy-module
Add Privacy Module
2023-11-06 09:42:35 +01:00
Alex e7c2e90236 Revert "custom: reap zombie processes on termination"
This reverts commit 1c1a39f597.
2023-11-03 14:06:50 +01:00
André Silva 1c1a39f597
custom: reap zombie processes on termination 2023-11-02 01:57:55 +00:00
Erik Reider 49caa4bf31 Add the PrivacyNodeInfo object as pw_proxy data 2023-10-31 11:38:01 +01:00
Erik Reider c60a8e9836 free pipewire listeners on proxy destruction 2023-10-31 08:52:54 +01:00
Erik Reider d32da917e4 Added tooltips 2023-10-29 00:17:53 +02:00
Erik Reider 4a4c888d7d Fixed linter complaining 2023-10-27 00:01:40 +02:00
Erik Reider f7224d8459 Initial implementation 2023-10-26 23:22:02 +02:00
Tamino Bauknecht 68dfd6aa3a
scope_guard/modules: Rename scope_guard to ScopeGuard
Using pascal case for the class name keeps it more consistent with the
majority of the other class names.
2023-10-24 17:51:38 +02:00
Tamino Bauknecht dd1de3efbf
Revert "Revert "Fix potential memory leaks""
This reverts commit 2d33c20231 and
reapplies various patches for memory leaks.
The reason for the revert was a bug for a maximum duration interval
which caused sleep_for() to cause unpredictable behavior.
2023-10-24 17:51:38 +02:00
Tamino Bauknecht 521dac8086
sleeper_thread: Make sleep_for more robust
In the previous fix for a passed max duration, the assumption was made
that at maximum one second will pass between the duration assignment and
the std::condition_variable::sleep_for() call.
This implementation makes the behavior more predictable by using
sleep_until() instead to emulate the sleep_for() behavior.
2023-10-24 17:51:34 +02:00
Tamino Bauknecht ad7d4eb07d
sleeper_thread: Allow sleep_for with max duration
The standard library has the implicit requirement that for
std::condition_variable::sleep_for() the duration must not cause an
overflow if added to the current time.
This commit will reduce the duration accordingly to fit into the
duration type.
2023-10-24 17:44:35 +02:00
Alexis Rouillard 2d33c20231
Revert "Fix potential memory leaks" 2023-10-22 09:44:46 +02:00
Alexis Rouillard 06f4028697
Merge pull request #2588 from taminob/bugfix/fix-custom-module-signal-without-interval
Custom module: Allow signal without interrupt
2023-10-21 14:09:12 +02:00
Tamino Bauknecht 8c57756556
util: add scope_guard
This custom small implementation avoids adding an extra dependency like
Boost.ScopeExit
2023-10-21 11:50:06 +02:00
Tamino Bauknecht b8afde043c
sleeper_thread: allow interrupting sleep()
This keeps the function consistent with sleep_until() and sleep_for()
which both can be interrupted.
This is relevant to allow an update via a "signal" without an "interval"
in a custom module.
2023-10-20 23:57:54 +02:00
Brenno Lemos ecbcf242d5 feat: allow unmuting by moving the pulseaudio slider 2023-10-15 17:52:12 -03:00
Brenno Lemos 11d7ca1d73 feat: backlight slider 2023-10-15 17:52:12 -03:00
Brenno Lemos c3779dd16e refactor: move backlight backend out of backlight module 2023-10-15 17:52:12 -03:00
Brenno Lemos 442a4b0da0 feat: pulseaudio slider module 2023-10-15 17:52:12 -03:00
Brenno Lemos c9e129cda2 feat: allow setting volume directly 2023-10-15 17:52:12 -03:00
Brenno Lemos 64d7fae03a refactor: move pulseaudio handling to separate class 2023-10-15 17:52:12 -03:00
Brenno Lemos c59264d6b4 fix: clang < 16 can't emplace back struct with no constructor 2023-10-12 17:30:32 -03:00
Brenno Lemos 387e54498e docs: document new regex collection class 2023-10-09 14:46:57 -03:00
Brenno Lemos 8d057e6f96 refactor: separate regex rule matching and caching in separate class 2023-10-09 13:53:00 -03:00
Brenno Lemos adbc9d95de feat: optional default icon for 0-match classes
Co-authored-by: Gabriel Fox <Inbox@GabrielFox.Dev>
2023-09-22 19:16:59 -03:00
Evan Overman 7c28ffc856
add indefinite `sleep()` function to `SleeperThread` 2023-09-18 14:55:50 -07:00
Alexis Rouillard fc67558717
Merge branch 'master' into darkmode 2023-09-11 09:25:45 +02:00
Austin Horstman 79cf33b9f1
refactor: enumparser create implementation file 2023-09-09 17:59:40 -05:00
Austin Horstman b8630968b2
refactor: move capitalize string helper 2023-09-09 13:23:17 -05:00
Austin Horstman 2fee12d930
fix: enumparser capitalize everything to avoid issues 2023-09-09 12:14:52 -05:00
Austin Horstman 3ae2fe3272
refactor: PR review cleanup 2023-09-09 12:08:30 -05:00
Austin Horstman 2b8c92e8fd
refactor: enum utility allow overriding 2023-09-09 11:18:12 -05:00
Austin Horstman 8ce64ea784
refactor: make parsing sort-by more lenient 2023-09-09 10:04:49 -05:00
Austin Horstman 8ea2626de8
refactor: sort-by enum hyprland 2023-09-09 10:04:48 -05:00
Calvin Lee 09873f0ed9 search for dark or light mode stylesheet
summary:
-------
This commit adds xdg-desktop-portal support to waybar. If a portal
supporting `org.freedesktop.portal.Settings` exists, then it will be
queried for the current colorscheme. This colorscheme will then be used
to prefer a `style-light.css` or `style-dark.css` over the basic
`style.css`.

technical details:
-----------------
Appearance is provided by several libraries, such as libhandy (mobile)
and libadwaita. However, waybar links to neither of these libraries. As
the amount of code required to communicate with xdg-desktop portal as a
client is rather minimal, I believe doing so is better than linking to
an additional library.

The Gio library for communicating with dbus is rather messy, Instead of
the `Portal` class containing a `Gio::Dbus::Proxy`, it extends it which
simplifies signal handling.

`Portal` then exposes its own signal, which can be listened to by waybar
to update CSS.

For a reference implementation, please see another one of my projects:
https://github.com/4e554c4c/darkman.nvim/blob/main/portal.go

test plan:
---------
If no desktop portal which provides `Settings` exists, then waybar
continues with the log line
```
[2023-09-06 14:14:37.754] [info] Unable to receive desktop appearance: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
```

Furthermore, if `style-light.css` or `style-dark.css` do not exist, then
`style.css` will still be searched for.

Waybar has been tested with both light and dark startup. E.g. if the
appearance is dark on startup the log lines
```
[2023-09-06 14:27:45.379] [info] Discovered appearance 'dark'
[2023-09-06 14:27:45.379] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/style-dark.css
[2023-09-06 14:27:45.379] [debug] Found config file: $XDG_CONFIG_HOME/waybar/style-dark.css
[2023-09-06 14:27:45.379] [info] Using CSS file /home/pounce/.config/waybar/style-dark.css
```
will be observed.
If the color then changes to light during the operation of waybar, it
will change css files:
```
[2023-09-06 14:28:17.173] [info] Received new appearance 'dark'
[2023-09-06 14:28:17.173] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/style-light.css
[2023-09-06 14:28:17.173] [debug] Found config file: $XDG_CONFIG_HOME/waybar/style-light.css
[2023-09-06 14:28:17.173] [info] Using CSS file /home/pounce/.config/waybar/style-light.css
```

Finally, tested resetting waybar and toggling style (works, and style is
only changed once).

fixes: Alexays/Waybar#1973
2023-09-06 15:19:56 +00:00
Jan Palus c8237437d2
Explicitly cast ustring to string when passing to fmt
don't rely on implicit conversion which is no longer present in fmt
10.1.0

Fixes #2403
2023-08-15 20:57:07 +02:00
Patrick Nicolas f62b3d0e9d Ensure signal is disconnected in destructor 2023-07-16 23:29:28 +02:00
Alex 6c196b8f8d fix: lint 2023-07-04 22:35:27 +02:00