Commit Graph

44 Commits

Author SHA1 Message Date
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
dpayne d7ed4f1fa8 Adding css reloader 2024-01-21 18:23:46 -08: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
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 14f626d422
Add recursive config includes 2021-06-21 19:05:01 +02: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
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 e5684c6127
Separated name and description setup and moved bar creation to done callback. 2020-12-25 23:03:01 +00:00
Andreas Backx 0233e0eeec
Added waybar_output.identifier support.
Resolves #602.
2020-12-25 20:54:38 +00:00
Aleksei Bavshin f97de599dd
refactor: header cleanup
Replace a couple of header includes with forward declarations.
2020-10-28 08:08:03 -07:00
Renee D'Netto 943b6bc51b Implement support for reloading of config files.
Fixes #759.
2020-08-28 22:34:24 +10:00
Aleksei Bavshin f80270519b
refactor(client): use std::list<waybar_output> to store outputs
std::unique_ptr is not required here as the only benefit it gives is
stability of address on vector resize and it's easy to invalidate it
accidentaly. std::list provides the same guarantee of stable addresses
of the elements and correct destruction while avoiding smart pointer
overhead.

Also fixes #554, caused by incorrect usage of std::remove_if.
2020-01-14 07:27:08 -08:00
Aleksei Bavshin d1637d34cf
refactor: fetch outputs from Gtk::Display instead of wl_registry.
gtk-layer-shell wants Gdk::Monitor instead of wl_output;
change code to deal with Gdk objects and slightly simplify it.
Requires gtkmm 3.22.0+ (first release with Gdk::Monitor support).
2019-12-27 16:42:12 -08:00
Alex ffadd5c1a7 refactor: avoid useless class vars 2019-05-24 09:49:09 +02:00
Alex 79a5e9ecee feat: multiple bar with same process 2019-04-25 13:25:06 +02:00
Alex 311c34ecbc feat(Bar): handle widget size changes 2019-04-24 12:37:24 +02:00
Alex 171ecd53aa refactor(Bar): roundtrip before setup widgets 2019-04-19 11:56:40 +02:00
Alex 6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Alex 807ef32357 refactor: format && better output management 2019-04-18 17:47:40 +02:00
Alex d05b8398fa fix: prefer to hold running even when no window is open 2019-04-15 11:42:16 +02:00
Jonas d708ce2be9 Add idle inhibitor module 2019-02-22 16:55:46 +01:00
Alexis b554094c7e feat: args && class id 2018-12-18 17:30:54 +01:00
Alexis 087de4e956 refactor(client): lambda to method 2018-11-24 11:04:56 +01:00
Alexis 0eee8eade7
feat(WIP): tray
feat(wip): tray

feat(wip): tray

feat(WIP): gdbus

feat(WIP): tray
2018-09-02 17:29:16 +02:00
Alex 6705134034
Handle screens disconnection (#29) 2018-08-19 13:39:57 +02:00
Alex 6635548d3e
Style code (#25) 2018-08-16 14:29:41 +02:00
Alexis 9b75302d22 refactor(client): cleanup 2018-08-15 17:31:45 +02:00
Alexis d1d51b76aa fix(client): try to fix #20 2018-08-15 01:53:43 +02:00
Alexis 01894f18cd chore: clean headers 2018-08-12 20:25:19 +02:00
Alexis 6ff296a4b0 refactor(bar): prefer standard unique_ptr 2018-08-11 12:49:28 +02:00
Alexis 424ebb3c9b feat(workspace): only show workspaces which are on same output as bar 2018-08-11 00:32:59 +02:00
Alexis c792871f6e feat(bar): choose height from config file 2018-08-10 18:46:31 +02:00
Alexis 23f48cb8b7 refactor: prefer static methods 2018-08-09 20:22:01 +02:00
Thomas Plaçais 6f9fb72cdf Add different default paths for config and css files 2018-08-09 14:20:22 +02:00
Alexis 39a0ae04a8 feat: basic config file 2018-08-09 12:05:48 +02:00
Alexis c1e2735314 feat: add idle protocol to avoid update workspace when idle 2018-08-09 01:10:07 +02:00
Alexis fcb6a9aa8b feat: init repo 2018-08-08 23:54:58 +02:00