hyprland-community / hyprland-autoname-workspaces

Hyprland autoname workspaces 🪟 [maintainers=@cyrinux,@maximbaz]
ISC License
192 stars 8 forks source link

support regex substitution #69

Closed hotburger closed 1 year ago

hotburger commented 1 year ago

Titles can be very long. I would like to be able to use regex capture groups and substitution to shorten them.

For example: foot with a title of: emerge: (13 of 20) dev-lang/rust-1.69.0-r1 Compile: and with config:

[title."(?i)foot"]
"emerge: (.+?/.+?)-.*" = "$1"

should display (13 of 20) dev-lang/rust

cyrinux commented 1 year ago

Hi, thanks for the idea. Interesting, I will study this after the new incoming release. 🍰

cyrinux commented 1 year ago

@hotburger you can already try the main branch if you want, the feature is merge.

I would be glade to know if it is what you expected. 😉

I will do a release when the hyprland-rs release will be done.

hotburger commented 1 year ago

Thanks for your work, I really appreciate it. The substitution works, but looking at the debug logs the title is only being updated when the window is focused. Is this a limitation of the IPC?

cyrinux commented 1 year ago

Ho, yes, we update on some events, the one you trigger is "add_active_window_change_handler", but there is no "title change", or "add_inactive_window_change_handler" event for the moment afaik. I will study this.

cyrinux commented 1 year ago

I can reproduce your test, I can't find an event in hyprland codebase for this for the moment, this will need to be first implement here.

cyrinux commented 1 year ago

I will be able to patch after those PR get validated and merged:

https://github.com/hyprland-community/hyprland-rs/pull/56 https://github.com/hyprwm/Hyprland/pull/2419