roosta / i3wsr

Change i3-wm workspace names based on content
MIT License
178 stars 14 forks source link

Using aliases to edit, not overwrite, names #30

Open xathon opened 2 years ago

xathon commented 2 years ago

I have a program with a pretty long name, that I often have running in multiple instances. I'd like to be able to alias this in a way that, for example, Window Title - Superlong Programname becomes Window Title - SLP. Currently I can only find the option to have it appear as SLP, without catching the rest of the name of the window.

roosta commented 2 years ago

I'm not sure I understand the problem. Couldn't you just setup an alias for the whole thing window title - Super long Programname

If you mean that i3wsr should preserve parts of the title, how do you suppose that would work?

xathon commented 2 years ago

Yeah, sorry for not being clear. The Window Title part is dynamic, so it could be foobar - Superlong Programname, qwerty - Superlong Programname etc., and I'd like to catch only the Superlong Programname part. The aliases, if I understand correctly, currently work like this - if one alias matches the class/instance/name of the window, it replaces the whole name with the value entered as alias. From how the readme looks like, I'd expect to have quoted strings I understand that this might be a breaking change, but would it be possible to have at least the option to only have it replace the part of the property that the regex string matches? Like this:

# If the window title is 'New Tab - Google-chrome-unstable'
"^Google-chrome-unstable$" = "Chrome-dev" # doesn't match
"Google-chrome-unstable$" = "Chrome-dev" # new title is New Tab - Chrome-dev
".*Google-chrome-unstable" = "Chrome-dev" # new title is Chrome-dev
roosta commented 2 years ago

OK, I understand better now. I can create an option to enable replacing only the matched part of the regex. I'll address this and some other stuff when I get the chance. I'm a bit bogged down with projects ATM, but I plan on doing some serious work on i3wsr when things slow down a bit.