Commit Graph

107 Commits

Author SHA1 Message Date
9750c9f149 fixup! modules/custom: Allow json fields as format specifiers 2024-04-18 23:25:08 +02:00
0ec0ea2201 modules/custom: Allow json fields as format specifiers 2024-04-18 23:25:06 +02:00
9191cae13b Merge pull request #2923 from jones-josh/custom-tooltip-format
Add check for tooltip-format for custom modules
2024-02-19 22:47:22 +01:00
9c3881f6f8 add check for tooltip-format for custom modules 2024-02-16 01:33:04 +01:00
d590d508ca feat: add module class to the root elements of the modules
Previously, the only way to select all the module labels was with the
following kind of selector:
```css
.modules-left > widget > label,
.modules-center > widget > label,
.modules-right > widget > label {
    /* ... */
}
```
(and a matching block for the `box` containers).

Now, this can be expressed as
```css
label.module, box.module {
    /* ... */
}
```
2024-02-14 22:41:13 -08:00
19bf4d0544 clang format trailing whitespace 2023-12-28 19:38:01 -08:00
6b860f8690 clang formating 2023-12-28 19:36:21 -08:00
182272b8b5 fix #2650 2023-12-28 19:30:26 -08:00
0ea5143493 Pass WAYBAR_OUTPUT_NAME environment variable to custom exec scripts
Signed-off-by: Jo De Boeck <deboeck.jo@gmail.com>
2023-12-19 22:54:12 +02:00
9012cebbf2 Happy Linter
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-10-31 23:31:58 +03:00
f511e61832 fix: custom: do not crash if input text is not valid utf-8 2023-10-31 19:41:42 +01:00
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
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
2d33c20231 Revert "Fix potential memory leaks" 2023-10-22 09:44:46 +02:00
ae748b2644 modules+util: fix actual (potential) memory leaks 2023-10-21 11:51:33 +02:00
1b98a04c93 chore: lint unrelated files so the CI passes 2023-10-02 12:33:28 -03:00
bf371f70d1 add waitingWorker() to Custom 2023-09-18 14:56:14 -07:00
918de59988 custom module: free memory returned by libc's getline 2023-03-29 21:18:13 +08:00
f4cfafd238 fix: lint 2023-01-23 09:25:02 +01:00
5182fadede Merge pull request #1944 from PolpOnline/master 2023-01-23 09:22:27 +01:00
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
a4b1b0a211 modules/custom: Added percentage rounding 2023-01-13 22:39:59 +01:00
5e9bbe5c76 modules: Revert button to label 2022-11-24 13:08:16 +01:00
ce8ae5bf17 Merge pull request #1748 from lilydjwg/fix-zombies
fixes https://github.com/Alexays/Waybar/issues/1713
2022-11-23 21:31:47 +01:00
df36ac3408 Revert "Escape text in custom module" 2022-11-02 05:59:50 +01:00
31137c30fb fix custom module leaves zombie processes behind when bars are removed
fixes #1713.
2022-10-27 18:12:14 +08:00
bfa3adcfd6 Merge pull request #1120 from pinselimo/use_gtk_button_v2 2022-10-17 09:09:12 +02:00
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
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
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
9e03bb61c7 Escape text in custom module 2022-09-16 01:19:44 +03:00
458c03bf95 retain instance name css class for custom modules
When adding a custom module with a name, e.g.:

```jsonc
{
  ...,
  "custom/foo#bar": { },
  ...
}
```

The custom module does not retain the `bar` class as it should, because
all the classes are replaced with the runtime output:

1b4a7b02f4/src/modules/custom.cpp (L141-L147)

Avoid removing the module instance name class so css class behavior is
consistent between all modules.
2022-06-13 16:10:41 -05:00
f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
abe1fa5bd4 Custom module - only call label_.set_tooltip_markup if tooltip markup has actually changed - fixes tooltips not appearing at all if a custom module is updating too frequently. 2020-10-31 12:21:51 +00:00
9e3e4368c7 custom: Add "exec-on-event" config
This config allows disabling the default behavior of re-executing the
script whenever an event that has a command set is triggered.

Fixes #841
2020-09-06 22:49:18 +03:00
ba78199dd1 custom: Fix "restart-interval"
This commit fixes the issue where the process would restart immediately
and the thread would sleep after the process has restarted, and not
before.

Fixes #621
2020-08-28 01:43:19 +03:00
e96a0bf799 refactor(custom): tooltip markup 2020-05-30 11:59:22 +02:00
3b16946c25 fix(custom): avoid hide outside update 2020-05-25 09:21:04 +02:00
7b4ded306b fix: restart-interval 2020-05-24 21:33:38 +02:00
2ffc96d0b2 fix: hide box by default 2020-05-24 19:02:52 +02:00
9b9d13ab0d feat: execNoRead 2020-05-24 18:27:21 +02:00
6b32aca094 feat: debug cmd 2020-05-22 20:57:41 +02:00
4a7dd400fe Merge branch 'master' into on-update 2020-04-12 18:32:19 +02:00
b40cdcb5bd refactor: call parent update 2020-04-12 18:30:21 +02:00
10b152ac3e fix: process last line, restart-interval 2020-03-26 09:18:47 +01:00
ff36154c4b fix: typo 2020-03-25 22:31:04 +01:00
d12ad1128e fix: man 2020-03-25 22:30:22 +01:00
cb2f5c154c feat(custon): restart_interval for continuous script 2020-03-25 22:25:30 +01:00
0f0765e517 feat(modules): call user on-update if configured 2019-12-05 14:42:36 -08:00
9dbf057f58 fix(custom): hide on empty format 2019-06-03 09:50:35 +02:00