Commit Graph

31 Commits

Author SHA1 Message Date
Tamino Bauknecht 68dfd6aa3a
scope_guard/modules: Rename scope_guard to ScopeGuard
Using pascal case for the class name keeps it more consistent with the
majority of the other class names.
2023-10-24 17:51:38 +02: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 a0b63d6b1e
modules: use scope_exit for deletion to make code more robust 2023-10-21 11:51:18 +02:00
PucklaJ 70bc318a01 Fix bluetooth module still being visible if format is empty 2023-08-16 16:30:59 +02:00
PucklaJ 22817089db Add no-controller format to bluetooth module 2023-08-16 15:34:06 +02: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
Simon Plakolb 5e9bbe5c76 modules: Revert button to label 2022-11-24 13:08:16 +01:00
Alex 2fec1d4907 fix: typo 2022-10-27 09:14:07 +02:00
Alex be28ee3d7e fix(#1707): hide module when no controller found 2022-10-27 09:00:31 +02:00
Simon Plakolb 2b735f44bc modules: Set tooltip on button
Mouse-over tooltips set on the label only appear once the mouse hovers
over exactly the label. Other apps (e.g. firefox) show the tooltip once
the pointer hovers the button. Not solely its label. With this commit we
get the same behaviour.
2022-10-12 10:25:30 +02:00
Simon Plakolb 8fa5d9b838 modules: Set style-context on button
Fixes issue where the class parameters in style.css would have no
effect.

The CSS now references the GtkButton instead of the GtkLabel. Removing
all style-classes from the custom module GtkButton however removes
any properties set via style.css. Thus, the default classes 'flat' and
'text-button' are added on every update of these modules.
2022-10-12 10:25:30 +02:00
Simon Plakolb b8322c4b4b button: Add AButton class
The AButton class is designed as full a substitute to ALabel. The
GtkButton attribute 'button_' is initialized with a label. This
label can the be referenced by the subsequent inheritors of AButton
instead of the GtkLabel attribute 'label_' of ALabel.
For convenience a GtkLabel* 'label_' attribute is added to AButton.

If the button cannot be clicked it is disabled, effectively acting
like its label predecessor.

GtkButton seems to catch one-click mouse events regardless of the
flags set on it. Therefore, 'signal_pressed' is connected to a
function creating a fake GdkEventButton* and calling 'handleToggle'
(for details on this possible bug in GTK see:
https://stackoverflow.com/questions/45334911 )

In accordance with other GtkButtons (i.e. the sway/workspace ones)
set_relief(Gtk::RELIEF_NONE) is called on the 'button_' instance.
2022-10-12 10:25:29 +02:00
Daan Goossens 6857691679 style(bluetooth): apply project style 2022-05-28 12:58:37 +02:00
Daan Goossens a475be7cf7 feat(bluetooth): add format-icons 2022-05-28 12:35:33 +02:00
Daan Goossens 00c11c64ca fix(bluetooth): tooltip-format-connected-battery 2022-05-28 12:33:47 +02:00
Daan Goossens e235f48245 feat: hide module if empty 2022-05-07 13:42:27 +02:00
Daan Goossens 3043d42a89 style: apply projects clang-format 2022-05-06 17:01:43 +02:00
Daan Goossens 954bed3f5e refactor: adapter renamed to controller
Since it is also called controller in bluetoothctl
2022-05-06 16:37:48 +02:00
Daan Goossens 13df878bc3 refactor: logic for enumerating devices in tooltip 2022-05-06 16:37:40 +02:00
Daan Goossens 794610a1ca feat: display all connected devices in tooltip 2022-05-04 19:27:39 +02:00
Daan Goossens 638b4e6573 feat: extend bluetooth module 2022-05-02 18:11:21 +02:00
Tobias Wölfel e8b022c096 Add disabled bluetooth style
Allow to set a different style if the bluetooth adapter is disabled.
2022-04-12 10:31:20 +02:00
Alex 71d7596b6f
fix: bluetooth status tooltip 2021-04-30 14:23:49 +02:00
Aleksei Bavshin 52dd3d2446
refactor(bluetooth): remove `interval` and timer thread
The timer thread was always reading the same value from Rfkill state.
2021-02-09 21:27:21 -08:00
Aleksei Bavshin ecc32ddd18
refactor(bluetooth): remove Bluetooth::status_
The string was always overwritten in `update()`; don't need to store
temporary value in the class.
2021-02-09 21:27:20 -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
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 626af1ddc1 add rudimentary bluetooth module functionality 2020-01-21 17:04:54 +01:00