Commit Graph
57 Commits
Author SHA1 Message Date
Alex 6294ed2520 fix(hyprland/language): apply the CSS class on the main thread
onEvent() runs on the Hyprland IPC listener thread and mutated the label's
style context (add/remove class) directly, racing the GTK main thread's
drawing and corrupting the heap (double free / corrupted double-linked list).
Follow the Submap pattern: onEvent only stores the layout under the mutex and
emits the dispatcher; update() swaps the CSS class on the main thread, tracking
the previously applied class.

Fixes #4665
2026-07-05 23:06:37 +02:00
Alex 5c06233340 style: clang-format the crash-fix changes 2026-07-04 03:17:33 +02:00
Alex 4eb2513cc0 fix(hyprland/language): pass named args in format-<lang> branches
The format-<short_description>[-<variant>] override branches only passed a
positional arg, so a format using {short}/{long}/{variant} threw 'argument
not found', which disabled the whole module. Now supply the same named args
as the fallback/tooltip branches. Fixes #5120.
2026-07-04 03:09:20 +02:00
AlexandClaude Opus 4.8 f72f84e011 fix: backward-compat + bug fixes and man-page build fix for 0.16.0
Post-0.15.0 review of the 0.15.0..HEAD range surfaced regressions and
bugs. This restores backward compatibility for existing configs/CSS,
fixes confirmed defects, and repairs the scdoc man-page build break on
master. Pango-markup tooltips are intentional and were kept.

Backward-compat restorations:
- AModule: honor legacy numeric Gdk::CursorType cursor values (int overload)
- memory: correct GiB divisor (was ~2.3% low); round bare {} placeholders
- wireplumber: scale max-volume into the linear domain so the cap works again
- idle_inhibitor: gate right/middle-click deactivate & scroll on dynamic-timeouts;
  accept both dynamic-timeout(s); widen timeout to double (no fractional truncation)
- custom: keep #custom-<name>.<class> CSS selectors working (classes on box_)
- image: don't wordexp-split a single path; fall back to the literal path
- niri/window: restore hide-when-empty (new show-empty opt-in); escape tooltip
- wlr/taskbar: plain-text tooltip when markup is disabled

Bug fixes:
- tray: fix use-after-free in onAdd; guard the watcher retry timeout
- hyprland: clamp max-windows iterator (OOB); drop duplicate language tooltip block
- niri/window: supply {col}/{max_col} args in the empty branch (fmt::format_error)
- mpris: escape {dynamic}/{player} tooltip; fix dangling player; albumArtist source
- mango: fix use-after-free race (dispatch under callback_mutex_)
- mpd: contain throwing checkErrors in noexcept idle paths (no std::terminate/UAF)
- keyboard_state: always render every lock label, with guarded defaults
- bluetooth: bound GATT ReadValue timeout, opt-in + services-resolved gating,
  preserve authoritative Battery1 percentage
- wireplumber: fix WpDevice reference leak / NULL handling
- battery, clock, dwl, wayfire, graph, custom_graph, transform, river: assorted
  crash/logic fixes

Man page / build:
- niri-workspaces: fix scdoc "indented by an amount greater than 1"
  (workspace-taskbar sub-options were mis-indented; breaks man-page build)
- document new show-empty (niri/window); correct network {txBitrate}/{rxBitrate}

Not compiled locally (no gtkmm on this host); C++ build relies on CI.
Man pages validated with scdoc 1.11.4.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-04 02:14:13 +02:00
Alex db4941efe7 refactor(tooltip): migrate modules to ALabel generic tooltip helper
Migrate idle_inhibitor, sway/language, sway/scratchpad,
hyprland/language and hyprland/window to the shared label/tooltip
setters. idle_inhibitor uses updateLabelAndTooltipForState; the others
keep their custom label/tooltip resolution (trim, precomputed tooltip,
rewriteString, per-lang/variant formats) and switch to the dedup-aware
setLabelMarkup/setTooltipMarkup.
2026-07-04 00:00:15 +02:00
Alexis Rouillard fffb4b3159 Merge pull request #5012 from yihangwu539-png/feat/language-tooltip
feat(language): add tooltip support with configurable tooltip-format
2026-07-03 23:00:06 +02:00
Alexis Rouillard 96696d0ec4 Merge branch 'master' into feat/language-tooltip 2026-07-03 22:22:14 +02:00
Alexis Rouillard 8ec7bd0939 Merge branch 'master' into hyprland-language-class 2026-07-03 22:22:11 +02:00
Alexis Rouillard 8b5f5b3aea Merge pull request #5155 from Alexays/fix/hyprland-language-keyboard-name-commas
fix(hyprland/language): handle commas in keyboard-name config
2026-07-03 21:23:06 +02:00
Alex 6793b97eed fix(hyprland/language): handle commas in keyboard-name config
The active-layout event payload is `KEYBOARDNAME,LAYOUT`, and kbName was
taken as everything before the first comma. Keyboard names reported by
Hyprland can themselves contain commas (e.g. some MSI keyboards), so a
`keyboard-name` configured with a comma never matched the truncated value
and the module stopped updating.

Match the configured keyboard-name as a full prefix (followed by the ','
separator) instead. Layout parsing already handles commas via the
last-comma-before-parenthesis heuristic, so only the keyboard-name filter
needed fixing.

Addresses the keyboard-name case originally reported by @tirsek in #3406.
2026-07-03 21:15:35 +02:00
Alex 6de8871882 Merge remote-tracking branch 'origin/master' into hyprland-language-tooltip
# Conflicts:
#	man/waybar-hyprland-language.5.scd
2026-07-03 21:01:53 +02:00
shiyi b28af75e62 feat(language): add tooltip support with configurable tooltip-format 2026-04-29 23:34:09 +08:00
Austin Horstman 6317022304 fix(hyprland): guard malformed module events
The language and submap modules assumed their Hyprland payload delimiters were
always present. When that assumption is violated, the old code could perform
invalid iterator math or throw while slicing the event string.

Validate the expected separators up front and bail out with a warning when the
event is malformed so the modules degrade safely instead of crashing the update
path.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-07 21:06:30 -06:00
dimti 4c12001569 do not need to remove css class from gtk label on init phase 2025-10-10 11:58:56 +03:00
dimti a36a5e89a9 Approach to dry pattern - separate remove/add css-classes logic to methods 2025-10-10 11:57:44 +03:00
dimti 2e6bf549a0 Change label css classes in initial and on event language class method. Used in getLabel - make a strange behaviour 2025-10-10 11:52:59 +03:00
dimti bdf501a8a5 make getLayout is not static and set css classes for short name keyboard layout in getLayout method 2025-10-10 11:35:47 +03:00
dimti cd820a100d also remove/add css class in onEvent method 2025-10-10 11:14:30 +03:00
dimti 192baa4556 Add css class to hyprland language module of short_name language code 2025-10-07 10:41:19 +03:00
zjeffer 5079884b78 Hyprland IPC improvements, fix tsan warning, WindowCount shouldn't create a separate IPC 2025-08-12 19:39:36 +02:00
mexanoz 7505e2c3f3 fix hyprland/language layout parsing 2025-06-27 20:54:38 +05:00
Alex ee91d18ad9 fix: lint 2025-06-22 10:01:36 +02:00
Rimsoo afeea62214 fixes #3676 including #3224 2025-04-24 23:32:47 +02:00
Rimsoo 20642f47df Fixed variant bug 2025-04-22 11:41:45 +02:00
zjeffer 5b8839ab5c Hyprland IPC improvements
Fixes IPC being blocked at shutdown
2025-02-19 20:45:47 +01:00
Victor Perez Cano 38cf981f78 fixed clang format for language.cpp 2024-10-25 18:58:55 +02:00
Victor Perez Cano 550d108a03 added tooltip-format-<short_description> on hyprland/language tooltip 2024-10-19 17:30:23 +02:00
Victor Perez Cano 696f7e1542 tooltip functionality on hyprland/language module 2024-10-18 20:41:13 +02:00
Alexis Rouillard ff0f408ab8 Merge pull request #3380 from alerque/debug-keyboard-layout
Add keyboard debug info to hyprland language module
2024-07-01 09:22:08 +02:00
Caleb Maclennan 4126502fe8 Add debug information for keyboard layout selection 2024-06-23 00:02:48 +03:00
Tuur Vanhoutte 29917fb073 Fix hyprland/language events not working with keyboard names with commas in them (#3224) 2024-05-07 08:26:05 +02:00
zjeffer 42f4386e2e fix clang-tidy errors in hyprland module 2024-02-25 12:11:22 +01:00
Austin Horstman 4cb8efbecc chore: cpplint fixes hyprland classes 2023-09-03 00:18:31 -05:00
czM1K3 b2279c9565 Differencing keyboard layout variant for hyprland/language 2023-07-17 22:20:50 +02:00
gardenapple fd7c2a2012 hyprland/language: Show language on startup 2023-06-20 00:43:33 +03:00
Alex 1445dc4151 fix: lint 2023-04-03 10:06:01 +02:00
en3wton bbcfb5e138 remove use of new on Layout 2023-03-21 19:30:35 +00:00
en3wton 4ab4ff790e add more format replacements for hyprland/language 2023-03-19 15:12:11 +00:00
Oleksandr Kulkov 220b859948 Fix kbName initialization
Second argument of substr is the length of the substring, _not_ the position. With positions, it's better to do like this.

Example:
```sh
[2023-01-29 13:08:00.927] [debug] hyprland IPC received activelayout>>ITE Tech. Inc. ITE Device(8910) Keyboard,Russian (with Ukrainian-Belorussian layout)
[2023-01-29 13:08:00.927] [debug] kbName is ITE Tech. Inc. ITE Device(8910) Keyboard,Russian (with
```

After the fix it's correct:
```sh
[2023-01-29 13:11:11.408] [debug] hyprland IPC received activelayout>>ITE Tech. Inc. ITE Device(8910) Keyboard,Russian (with Ukrainian-Belorussian layout)
[2023-01-29 13:11:11.408] [debug] kbName is ITE Tech. Inc. ITE Device(8910) Keyboard
```
2023-01-29 13:14:05 +01:00
Enes Hecan 3c8ca009ff Sanitize hyprland language string only instead of the whole format. Fixes #1940 2023-01-23 09:50:40 +01: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
Enes Hecan f724cc3f9d Fix wrong layout name in hyprland language module when a variant is used 2022-12-27 15:29:10 +01:00
Enes Hecan 4136ffaecb Minor refactorings and formatting fixes for hyprland language module 2022-12-16 10:01:58 +01:00
Enes Hecan 531bdfb8bb Fix hyprland language initialization issues 2022-12-15 01:48:14 +01:00
Oleksandr Kulkov 459541ed89 Don't search "Keyboard at" from hyprland/language
The current output form of `hyprctl devices` is like this:
```
        Keyboard at 6f80ad70:
                ITE Tech. Inc. ITE Device(8910) Keyboard
                        rules: r "", m "", l "us,ru", v "", o "grp:alt_shift_toggle"
                        active keymap: Russian
                        main: no
```

That is, `Keyboard at` goes _before_ the keyboard name, so looking for `Keyboard at` only makes it skip to the keyboard _after_ the one that the user specified.
2022-11-29 01:11:25 +01:00
Simon Plakolb 5e9bbe5c76 modules: Revert button to label 2022-11-24 13:08:16 +01:00
Jef Steelant 8f4f67f69f Do not crash when a monitor is removed 2022-11-09 09:34:19 +01:00
Alex bfa3adcfd6 Merge pull request #1120 from pinselimo/use_gtk_button_v2 2022-10-17 09:09:12 +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
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