Commit Graph

323 Commits

Author SHA1 Message Date
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
Alex
e30fba0b8f chore: 0.9.22 2023-08-16 13:34:05 +02:00
Alex
e90c66a102 chore: 0.9.21 2023-08-14 15:33:52 +02:00
Tuur Vanhoutte
2f04a49129 Merge branch 'Alexays:master' into master 2023-07-23 14:30:14 +02:00
Alexis Rouillard
430f0e5d65 Merge pull request #2333 from LukashonakV/cava_man
cava man page
2023-07-19 21:47:33 +02:00
Viktar Lukashonak
4dff1d4b2b cava man page
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-07-19 20:44:52 +03:00
Alexis Rouillard
56df72f61c Merge pull request #2328 from LukashonakV/ISSUE_2281
cava bump
2023-07-18 16:59:38 +02:00
Viktar Lukashonak
8fdd456fa9 cava bump
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-07-18 17:51:23 +03:00
Alex
3ecd4030e3 chore: v0.9.20 2023-07-18 08:29:32 +02:00
zjeffer
c85738574c Use C++20 by default 2023-07-16 16:00:26 +02:00
MisterPine
00e143d47e Introducce AAppIconLabel class
Implemented for hyprland
2023-07-10 22:50:58 +02:00
Alex
d8a808f76c chore: 0.9.19 2023-07-04 23:03:50 +02:00
André Aparício
a1cd0acac5 Fix random segfault on GTK icon functions
The segfaults were happening on GTK icon theme functions, which are
called via the C++ interface functions such as Gtk::IconTheme::has_icon.

There are multiple modules and threads using this functions on the default
icon theme by calling Gtk::IconTheme::get_default(), which returns the same
object for all callers, and was causing concurrent access to the same internal
data structures on the GTK lib. Even a seemingly read-only function such as
has_icon can cause writes due to the internal icon cache being updated.

To avoid this issues, a program wide global mutex must be used to ensure
a single thread is accessing the default icon theme instance.

This commit implements wrappers for the existing IconTheme function calls,
ensuring the global lock is held while calling the underling GTK functions.
2023-07-03 22:32:24 +01:00
Alexis Rouillard
85854c71d6 Merge pull request #2219 from xytovl/wake_threads_on_resume
Wake all sleeping threads when leaving suspend
2023-07-01 11:02:13 +02:00
dmitry
0b602632f2 return catch2 2023-07-01 02:23:37 +03:00
dmitry
33236c222f save 2023-06-28 02:52:01 +03:00
Patrick Nicolas
3c9cbc99d7 Wake all sleeping threads when leaving suspend
std::condition_variable::wait_for does not count time spent in sleep
mode, resulting in longer than expected waits.
2023-06-07 10:17:42 +02:00
Alex
47193a3d2f chore: v0.9.18 2023-05-29 09:25:01 +02:00
Viktar Lukashonak
e253c34cd4 cava bump
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-04-28 13:38:35 +03:00
Alex
33d1ee413f fix: typo 2023-04-17 09:07:59 +02:00
Alex
272d672953 fix: add missing man 2023-04-17 09:03:01 +02:00
Alex
8be889c5aa Merge pull request #2103 from xdavidel/dwl-module
Add DWL tags module
2023-04-17 09:01:00 +02:00
Alex
8aafe817bf Merge pull request #2102 from LukashonakV/Cava 2023-04-16 18:06:53 +02:00
Viktar Lukashonak
a5607b66ca Cava module
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-04-15 02:36:15 +03:00
David Delarosa
4dff1b91fe Merge branch 'Alexays:master' into dwl-module 2023-04-13 17:18:27 +03:00
Denis Drakhnia
18a2b90fc0 fix: generate wireplumber module man page 2023-04-11 08:17:45 +03:00
David Delarosa
60cdf10e64 Add DWL tags module 2023-04-11 04:50:21 +03:00
TheRealLorenz
63525ec956 Rename function name 2023-03-25 17:33:01 +01:00
Alexander Courtis
5e4a47c0a8 Merge branch 'master' into add-river-layout 2023-02-11 13:22:46 +11:00
Alexander Courtis
757a450324 add river/layout 2023-01-31 16:34:38 +11:00
Alex
69b95e6d71 Merge pull request #1959 from alebastr/gcc-13 2023-01-23 09:18:13 +01:00
asas1asas200
0ca1c3957a docs(image): add image doc in meson and fix title 2023-01-22 20:16:46 +08:00
Aleksei Bavshin
93e340a081 feat(clock): support chrono Time Zone extensions.
Use chrono Calendars and Time Zones (P0355R7, P1466R3) when available
instead of the `date` library.
Verified with a patched build of a recent GCC 13 snapshot.
2023-01-21 02:18:44 -08:00
Aleksei Bavshin
43d52c59d9 test: fix build with Catch2 v2.x
Use smaller includes for Catch2 v3.
2023-01-20 22:49:59 -08:00
Alex
f0bead34d4 chore: 0.9.17 2023-01-11 11:39:30 +01:00
Alex
86850f5c7a Merge pull request #1520 from robertgzr/mpris-module 2023-01-06 22:35:24 +01:00
Robert Günzler
0bc5314e08 Add mpris module
Uses libplayerctl to use the MPRIS dbus protocol to query, listen and
control media players.

Signed-off-by: Robert Günzler <r@gnzler.io>
2023-01-06 20:55:31 +01:00
Enes Hecan
4d59de42af Implement hyprland submap module 2022-12-21 01:45:57 +01:00
Alex
80b2b29a77 Merge pull request #1397 from JakeStanger/feat/image-module
Resolves https://github.com/Alexays/Waybar/issues/1191
2022-11-24 20:40:56 +01:00
Alex
9eb6c4e296 chore: v0.9.16 2022-11-24 20:34:12 +01:00
Simon Plakolb
235861fd3d button: Remove AButton class 2022-11-24 13:08:16 +01:00
Sasha Moak
c2f98d07ef feat: wireplumber support
Adds basic support for showing volume via wireplumber. Allows specifying
the node-id or falling back to the default Audio/Sink node id if node-id
is not set. If tooltip on hover is enabled, will show `{node_name}` by
default otherwise `tooltip-format`.

Format replacements:

`{volume}` - Volume in percentage
`{node_name}` - The node's nickname (`node.nick` property)
2022-11-16 23:23:07 -08:00
Alex
eb705533b5 feat: jsoncpp wrap 2022-11-03 14:08:22 +01:00
Jan Palus
73495df377 build: require jsoncpp >= 1.9.2
with #1719 Waybar started using Json::Value.as() available since jsoncpp
1.9.2.
2022-11-03 10:59:03 +01:00
Alex
fd417c0805 chore: 0.9.15 2022-11-03 09:43:05 +01:00
Alex
f330e51472 fix: typo 2022-10-20 10:57:27 +02:00
Alex
411c6f4b4b chore: update catch 2022-10-20 10:56:47 +02:00
Alex
e8e8ccb6cf Merge pull request #1661 from asas1asas200/zeng-feat-improve_keyboard 2022-10-20 10:50:35 +02:00
herlev
54e04b5a30 Refactor rewriteTitle 2022-10-19 13:25:08 +02:00
Loïc Bartoletti
830c5cd5d0 FreeBSD: Add support to battery
This commit aims to propose a FreeBSD to gain battery support using sysctl on hw.acpi.battery.*
2022-10-18 19:30:04 +02:00