Commit Graph
101 Commits
Author SHA1 Message Date
Alex 517f45b01a Merge remote-tracking branch 'origin/master' into idle_inhibitor-activity-detection
# Conflicts:
#	include/client.hpp
2026-07-03 22:38:28 +02:00
Alexis Rouillard f57decf81c Merge pull request #4984 from Mervius/master
Fix timeout created by most recent gtk-layer-shell release when creating bars for multiple monitors.
2026-07-03 21:43:08 +02:00
Alexis Rouillard a02f943d8d Merge branch 'master' into fix-appearance-change-css-watching 2026-07-03 21:30:52 +02:00
Mervius e2d608e7fd Check if output still is in outputs before doing anything with it 2026-04-15 10:59:03 -05:00
Mervius d9b5d24284 Check if output still is in outputs before doing anything with it 2026-04-15 10:55:49 -05:00
Mervius 8b5b1eebbf Check if output still is in outputs before doing anything with it 2026-04-15 10:35:26 -05:00
Mervius efd245b552 Fix timeout with multiple monitors 2026-04-10 11:42:23 -05:00
Keepo 937ef176ff fix: memory issues & duplicate file loads. 2026-03-28 22:53:01 -04:00
Keepo 3b512d1a2c feat(client): add support for 8-bit hex color codes in CSS
This allows users to use #RRGGBBAA format in their style.css.
The client now detects 8-bit hex codes, transforms them into
GTK-compatible rgba() syntax, and loads the modified data
into the CSS provider.

- Added utility to detect 8-bit hex patterns.
- Added transformation logic to convert hex alpha to decimal.
- Intercepted CSS loading in Client::setupCss to handle the conversion.
2026-03-28 21:11:15 -04:00
Visal Vijay 1aa32def3b fix: prevent resource leak when rebinding Wayland globals 2026-03-22 15:41:50 +05:30
BBaoVanC 55fa8cf185 Make CssReloadHelper watch CSS new style on appearance change
If you have reload_style_on_change enabled, and use dynamic appearance
styling (style-dark.css and style-light.css), then changing the
appearance doesn't update the files that are being watched for reload.

Add a method to CssReloadHelper to change the CSS file being watched,
and also provide the CSS file as a parameter to the callback so setupCss
can be called on the right file when the file watcher triggers.
2026-02-21 21:42:34 -06:00
Alex 47fb21a2c1 chore: upgrade to clang-format@21 2026-02-04 09:24:14 +01:00
Will Wernert a9ef11a2b3 fix: prevent duplicate layer surfaces on monitor hotplug
The monitor signal handlers (signal_monitor_added, signal_monitor_removed)
were never disconnected during SIGUSR2 reload. Each reload accumulated
additional handlers, causing multiple layer surfaces to be created when
monitors were hotplugged.

This fix:
- Stores signal connections as class members
- Disconnects them before reconnecting in bindInterfaces()
- Clears stale outputs_ on reload
2025-12-17 22:17:35 -05:00
guttermonk 19afad8675 updated client to bind version 2 of the ext-idle-notifier protocol 2025-10-17 21:21:48 -05:00
guttermonk 173e7306d0 fix using the ext-idle-notify-v1 protocol 2025-10-17 19:42:53 -05:00
NicolasBuchin 9d37dedb57 fix: resolve memory leak by removing old CSS provider before reloading styles 2025-10-16 10:04:12 +02:00
Nick Raffaele 19360462ba respect gtk color schema variant for gtk css variable 2025-07-12 09:45:14 -07:00
peelz bd28bb959f fix: use spdlog in zxdg_output_v1_listener callbacks 2025-06-13 22:57:31 -04:00
peelz f4496c9648 fix: length_error thrown in handleOutputDescription 2025-06-13 22:51:03 -04:00
Austin Horstman 47d7324a19 client: clang-format 2024-07-15 09:02:27 -05:00
Yao Zi 7725f6ed5a Fix build with fmt11
Since fmt 11.0.0, formatter:format() is required to be const.Mark
affected functions as const to stay compatible with fmt 11.

Signed-off-by: Yao Zi <ziyao@disroot.org>
2024-07-08 20:28:26 +00:00
Austin Horstman 14c3235c12 src: clang-tidy 2024-07-02 10:38:58 -05:00
Aleksei Bavshin 9a21884272 feat!: drop RawSurfaceImpl with direct use of wlr-layer-shell
BREAKING CHANGE: gtk-layer-shell is now required and unconditionally
used. The corresponding config option is removed.

As a part of preparation for future versions of GTK, remove an ability
to use wlr-layer-shell directly. The APIs it required were dropped in
GTK4, and with the menus/tooltips positioning issue being practically
unsolvable it doesn't make sense to keep maintaining the code.
2024-02-17 11:23:17 -08:00
Alex f1016322b9 fix: tpyo 2024-01-31 22:59:09 +01:00
Alex 6dcae2cade fix: reload style 2024-01-31 22:57:20 +01:00
dpayne 20fa578b12 Adding config option to enable reloading style on file change 2024-01-21 21:02:01 -08:00
dpayne d7ed4f1fa8 Adding css reloader 2024-01-21 18:23:46 -08:00
Erik Reider f7224d8459 Initial implementation 2023-10-26 23:22:02 +02:00
Calvin Lee 9bb2c01a44 clean up client.cpp 2023-09-07 13:43:59 +00: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
Aleksei Bavshin 24a8332b62 fix: adapt to fmt 9.0.0 breaking changes 2022-07-13 22:36:32 -07:00
Alex f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Aleksei Bavshin 452dcaa5d3 feat(client): store bar_id argument 2021-11-19 20:28:41 -08:00
Aleksei Bavshin 1f7d399b8e refactor(config): remove style handling from Config 2021-09-15 21:34:53 +07:00
Aleksei Bavshin 4fff2eaaa0 refactor(client): change config visibility to public 2021-09-15 21:34:10 +07:00
Aleksei Bavshin b377520a38 refactor(client): extract config handling into a new class 2021-09-14 13:15:54 +07:00
tiosgz 78aaa5c1b4 Do not fail to parse a multi-bar config 2021-07-10 20:22:37 +00:00
Oskar Carl e62b634f72 Workaround for circular imports 2021-06-21 19:29:09 +02:00
Oskar Carl e8278431d2 Proper formatting 2021-06-21 19:05:01 +02:00
Oskar Carl 14f626d422 Add recursive config includes 2021-06-21 19:05:01 +02:00
Yonatan Avhar 99918205ed Correct .json to .jsonc 2021-05-21 17:53:43 +03:00
Yonatan Avhar c65ec9e14f Add options to use a .json extension for the config filename 2021-05-21 15:54:48 +03: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
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
Aleksei Bavshin 7fa1c11833 fix(client): unsubscribe after receiving xdg_output.done event
Ignore any further xdg_output events. Name and description are constant
for the lifetime of wl_output in xdg-output-unstable-v1 version 2 and we
don't need other properties.

Fixes #990.
2021-01-21 08:35:38 -08:00
Aleksei Bavshin ab0f2c13af fix(client): attach styles only once
Gdk >= 3.10 has only one GdkScreen. No need to reattach styles on every
output change.
2021-01-21 08:32:44 -08:00
Alex a2d98ddde8 Merge pull request #842 from rdnetto/config-reloading
Implement support for reloading of config files.
2021-01-18 12:06:25 +01:00
Andreas Backx 3fbbbf8541 Removed redundant log line. 2020-12-25 23:31:29 +00:00
Andreas Backx e5684c6127 Separated name and description setup and moved bar creation to done callback. 2020-12-25 23:03:01 +00:00