Commit Graph

36 Commits

Author SHA1 Message Date
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 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
Brenno Lemos b9d5912a4f feat: rewrite window classes
feat: cache window class rewrite resolution

Co-authored-by: Gabriel Fox <Inbox@GabrielFox.Dev>
2023-09-22 19:16:53 -03: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
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 Beich 1fb2b8efd5 fix(util): don't abort modules from SleeperThread after 3c9cbc99d7
[warning] module sway/workspaces: Disabling module "sway/workspaces", Unable to connect to the SYSTEM Bus!...
[warning] module sway/mode: Disabling module "sway/mode", Unable to connect to the SYSTEM Bus!...
[warning] module sway/scratchpad: Disabling module "sway/scratchpad", Unable to connect to the SYSTEM Bus!...
[warning] module custom/media: Disabling module "custom/media", Unable to connect to the SYSTEM Bus!...
[warning] module sway/window: Disabling module "sway/window", Unable to connect to the SYSTEM Bus!...
[warning] module cpu: Disabling module "cpu", Unable to connect to the SYSTEM Bus!...
[warning] module memory: Disabling module "memory", Unable to connect to the SYSTEM Bus!...
[warning] module temperature: Disabling module "temperature", Unable to connect to the SYSTEM Bus!...
[warning] module sway/language: Disabling module "sway/language", Unable to connect to the SYSTEM Bus!...
[warning] module battery: Disabling module "battery", Unable to connect to the SYSTEM Bus!...
[warning] module battery#bat2: Disabling module "battery#bat2", Unable to connect to the SYSTEM Bus!...
2023-07-05 17:47:24 +00:00
zjeffer 7ef80d563b Formatting fixes 2023-07-04 19:48:04 +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
zjeffer 25c2aaabcb Fixed build warnings 2023-07-01 10:12:24 +02: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
TheRealLorenz 63525ec956 Rename function name 2023-03-25 17:33:01 +01:00
Elyes Haouas 1af25094b7 Fix some typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-02-25 09:55:04 +01:00
herlev 54e04b5a30 Refactor rewriteTitle 2022-10-19 13:25:08 +02:00
Mika Braunschweig f86dff60e6
utils: add sanitize_str to encode '&' etc.
gtk requires some chars (<>&"') to be encoded for them to render
properly. `sanitize_str` sanitizes raw strings that have such chars and
returns a properly encoded string
2022-10-17 00:31:19 +02:00
Alex f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Aleksei Bavshin e786ea601e
fix(rfkill): handle EAGAIN correctly 2021-02-10 08:26:21 -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
nullobsi d2a1f41750
Use g_unichar_iswide to properly align calendar on CJK locales 2021-01-31 11:53:53 -08:00
Luca Weiss 98b6d7f283
Fix non-standard usage of <sys/poll.h>
Fixes the following build warning with musl libc:

In file included from ../src/util/rfkill.cpp:24:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~
2020-09-06 21:48:42 +02:00
Alex 6e7f22ac3a fix: cancel thread and fix window close 2020-05-27 09:10:38 +02:00
Marc dd7d78cd60 changes requested 2020-02-23 23:09:05 +01:00
Marc 6ae9f436a9 add copyright notice for rfkill util 2020-01-30 00:25:37 +01:00
Marc c045288ce4 add man page for bluetooth, fix bluetooth race-condition 2020-01-26 05:34:31 +01:00
Marc e3bf6b968c bluetooth module handles rfkill events instantly 2020-01-23 17:17:29 +01:00
Marc 89cb9673d4 bluetooth module working 2020-01-22 11:37:47 +01:00
Marc f0dbd8b78d properly structure rfkill util 2020-01-21 17:48:45 +01:00
Guillaume Maudoux f4d2ca2736 custom formatter for numbers in 'pow' units format 2019-09-25 12:53:06 +02:00
Guillaume Maudoux 1d39ef5c8e Add a disk module 2019-09-25 08:47:33 +02:00