Skip to content

hyprland/submap: allow pango markup. #4040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 22, 2025

Conversation

coreydoughty
Copy link
Contributor

It would be nice to allow simple pango markup in "format": "{}", of the "hyprland/submap" module from the hyprland.conf file.

Example hyprland.conf:

...
$submapName = Note:  <b>S</b> <i>some app</i> <b>O</b> <i>other app</i>
bind = $mainMod, A, submap, $submapName
submap = $submapName
bind = , s, exec, someapp
bind = , o, exec, otherapp
bind = , escape, submap, reset
submap = reset
...

I was able to get this to work by editing the code in src/modules/hyprland/submap.cpp and changing lines 71-72 from

auto submapName = ev.substr(ev.find_last_of('>') + 1);
submapName = waybar::util::sanitize_string(submapName);

to

auto submapName = ev.substr(ev.find_first_of('>') + 2 );

Without these edits or something similar the original code cuts/removes everything from before the last > plus one character. This works without the pango markup due to the submap string starting with submap >> . With the pango markup it jumps to the last > in the string.

Also the sanitize_string function converts the > and < to entities. There may be a better way to escape the string than using the sanitize_string function. Removing the line worked for me for now.

Tested on 0.12.0

@coreydoughty coreydoughty changed the title hyprland/submap allow pango markup. hyprland/submap: allow pango markup. Apr 10, 2025
@Alexays Alexays merged commit 249b452 into Alexays:master Jun 22, 2025
@Alexays
Copy link
Owner

Alexays commented Jun 22, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants