Commit Graph

36 Commits

Author SHA1 Message Date
Bartel Sielski bd8b215416 upower: Add 'low' and 'critical' CSS classes
Add secondary CSS class based on the 'warning_level' field reported by UPower
over D-Bus.  This makes it possible to add custom styling when the battery is
near empty.
2024-03-18 20:36:46 +01:00
czadowanie 2334faa7fd upower: show-icon config option 2023-11-28 19:39:08 +01: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
Alexis Rouillard 2d33c20231
Revert "Fix potential memory leaks" 2023-10-22 09:44:46 +02:00
Tamino Bauknecht ae748b2644
modules+util: fix actual (potential) memory leaks 2023-10-21 11:51:33 +02:00
Alex 5319cb6e10 fix: upower hidded on start 2023-10-17 20:12:24 +02: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
Viktar Lukashonak 17af49d421
Upower native-path filter
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-06-09 18:22:24 +03:00
Aleksei Bavshin ea17a66dfc
fix: compilation errors with cpp_std=c++20
There were two main issues with fmtlib and C++20 mode:

 - `fmt::format` defaults to compile-time argument checking and requires
   using `fmt::runtime(format_string)` to bypass that.
 - `std::format` implementation introduces conflicting declarations and
   we have to specify the namespace for all `format`/`format_to` calls.
2023-01-20 22:50:02 -08:00
Alex e63e3a0ca9
Update upower.cpp 2022-11-25 09:03:27 +01:00
Keloran 3acd31c3e9
syntax issue 2022-11-21 09:48:41 +00:00
Keloran 456e06c4b5
exact opposite, lol 2022-11-21 09:46:57 +00:00
Keloran a2751cfcd6
alt text readded 2022-11-18 14:25:16 +00:00
Keloran 00a2ebf00d
added onclick to upower 2022-11-18 13:09:38 +00:00
Alex f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Erik Reider a7ed1ed570 Don't call dp.emit() when UPower service active status changes 2022-03-25 17:35:37 +01:00
Erik Reider e0f0931e2d Hide module if UPower service isn't running 2022-03-25 17:27:36 +01:00
Erik Reider 0140606226 Fixed segfault on upower service restart 2022-03-25 16:57:25 +01:00
Erik Reider d1d73b5003 Added missing "fulL" and "empty" CSS classes 2022-03-25 14:57:04 +01:00
Erik Reider 2ca4dcac49 Set box widget name to "upower" 2022-03-25 14:52:12 +01:00
Erik Reider 84dc82e1c1 Added tooltip-padding 2022-03-21 13:50:46 +01:00
Erik Reider e06316c80b Only set label text if string doesn't only contain spaces 2022-03-20 00:36:53 +01:00
Erik Reider 7b071567ea Removed goto in update method 2022-03-20 00:36:13 +01:00
Erik Reider 2633ff3fb9 Fixed time_left string not being set properly 2022-03-19 23:10:15 +01:00
Erik Reider 0764e9ad6e Added format and format-alt config properties 2022-03-19 21:15:48 +01:00
Erik Reider 05effad18b Added CSS status classes 2022-03-19 19:22:00 +01:00
Erik Reider 7fac2afb85 Added custom tooltip with device icon, device name and battery status 2022-03-19 17:09:55 +01:00
Erik Reider 4196e0d5d1 Unref all devices on destruct 2022-03-19 11:35:13 +01:00
Erik Reider 14a2a7027f Moved upower into its own directory 2022-03-19 11:34:34 +01:00
Erik Reider 6eb187a23e Moved upower.*pp out of the upower directories 2022-03-15 23:00:09 +01:00
Erik Reider 9b9e42fc5f use device variable instead of getting the device from the map 2022-03-15 22:50:11 +01:00
Erik Reider d47073ef13 Reload all devices after wake from suspend 2022-03-15 22:49:40 +01:00
Erik Reider 5396ffb71f Added "icon-size" and "hide-if-empty" config options 2022-03-15 20:22:32 +01:00
Erik Reider 5e9faeb2d0 Now shows the percentage and the correct icon 2022-03-15 20:22:04 +01:00
Erik Reider 4ee81c8dea Added all callbacks 2022-03-15 17:54:06 +01:00