Commit Graph

39 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
4cadae83b3 Improve comments for cached signal values
Clarify that -1 indicates signal-based refresh is disabled

Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
2026-02-04 08:54:14 +00:00
copilot-swe-agent[bot]
c34b1b6a19 Fix unhandled JSON exception in signal handlers
Cache signal value during module construction to avoid accessing JSON config
in signal handler context. This prevents crashes when signal field is missing
or not an integer type.

- Custom module: Cache signal_ value in constructor
- Image module: Cache signal_ value in constructor
- Both modules: Use cached value in refresh() method

Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
2026-02-04 08:53:47 +00:00
Lars-Ragnar A. Haugen
a453ea3c70 fix(#3210): tooltip-format on custom modules not working in some cases (#3213) 2024-05-06 10:47:52 +02:00
Jo De Boeck
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
Evan Overman
bf371f70d1 add waitingWorker() to Custom 2023-09-18 14:56:14 -07:00
Viktar Lukashonak
61a6c00c02 Happy clang 2023-03-02 16:57:32 +03:00
Simon Plakolb
5e9bbe5c76 modules: Revert button to label 2022-11-24 13:08:16 +01: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
Bao Trinh
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
Alex
f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Tamir Zahavi-Brunner
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
Alex
fcf2d18a01 refactor: destroy threads first 2019-05-29 17:53:22 +02:00
Alex
9e1200ae32 refactor: also pass id to custom modules 2019-05-22 12:20:13 +02:00
Lucas Lazare
51be97f9aa Adding spdlog 2019-05-18 19:44:45 -04:00
Alex
ff28de0482 feat(custom): update on click/scroll 2019-05-18 16:07:55 +02:00
Alex
90d89fe974 refactor: kill custom modules scripts en destroy 2019-04-23 15:56:38 +02:00
Alex
6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Alex
6aee51479d feat: ability to add multiple classes 2019-04-15 10:18:27 +02:00
hoellen
38fa7ceab1 add signalhandler for module update 2019-03-18 18:46:44 +01:00
Robinhuett
39bf403505 feat(custom): Add field for additional data to json 2019-02-25 22:04:09 +01:00
Alexis
399f61df98 refactor: proper modules destruction 2019-01-13 22:22:22 +01:00
Robinhuett
4698c9d2cf chore(custom): Change int conversion 2018-12-26 11:35:58 +01:00
Robinhuett
11c98f13e3 feat(custom): Add format-icons to custom module
This commit allows custom modules (json only) to set a percentage. This can be displayed either by using {percentage} or by using {icon} with format-icons set.
2018-12-26 03:52:05 +01:00
Alexis
b554094c7e feat: args && class id 2018-12-18 17:30:54 +01:00
Alexis
1b13f9e38c fix(custom): close endless scripts 2018-12-08 12:58:47 +01:00
Robinhuett
e23fbd0add Added return-type json to custom module 2018-11-01 00:40:44 +01:00
Robinhuett
341d3300fa Custom modules can control tooltip and CSS class 2018-10-30 21:28:31 +01:00
Alexis
00959c7d65 feat(Custom): handle continuous script 2018-09-18 23:15:37 +02:00
Alexis
de5df09fcd fix(Custom): loop script block main loop 2018-09-05 19:20:19 +02:00
Alexis
0dba3abc1d fix(custom): do not take the custom module ref 2018-08-21 10:50:09 +02:00
Alex
49232eed8d Clean (#31) 2018-08-20 14:50:45 +02:00
Alexis
ce50a627be refactor: move command execution into their own file 2018-08-18 17:54:20 +02:00
Alexis
b794ca63d1 feat(custom): exec-if 2018-08-18 17:27:40 +02:00
Alexis
27dfffa4e3 refactor: style issue 2018-08-18 15:05:18 +02:00
Alexis
b1fd4d7b82 feat(modules): generic label module to allow max-length on all labels 2018-08-18 11:43:48 +02:00
Alex
6635548d3e Style code (#25) 2018-08-16 14:29:41 +02:00
Alexis
01894f18cd chore: clean headers 2018-08-12 20:25:19 +02:00
Alexis
2512d51564 fix(gtk): use idle to avoid mutex 2018-08-10 23:21:21 +02:00
Alexis
e16cce646b feat: add custom module to allow execution of external script 2018-08-10 16:26:46 +02:00