roosta / i3wsr

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

number / name separator for polybar strip_wsnumbers #33

Closed acidkewpie closed 1 year ago

acidkewpie commented 1 year ago

Is there an opportunity to specify a specific separator between the workspace number and name? Your code cuts the old ws name at the first space, and adds whatever afterwards, but given polybars strip_wsnumber requires "number:name" and most i3 examples use a colon too, I would rather split it at the colon instead, or instead just take the workspace number, ignoring the name, add a separator and then the new titles afterwards.

From playing around this evening, I see a few ... quirks... this would also benefit?

1) In order to safely get a colon in there I appear to need to add it to the workspace name in my config:

set $ws1 "1:"

This is potentially fine, but feels like a hack to me in some sense. If you optionally took the num value, instead of splitting the name, then that ws name doesn't need this "safe" formatting to survive. I appreciate the benefits though of the whitespace in your "1:[Q]" style examples though, would be nice to have either approach a) possible and b) documented, rather than the current version not really being explained, and confusing me for one :)

2) If i (ignorantly?) use

i3-msg "workspace number 2"

To change to workspace 2, regardless of the workspace name it "works" however it also seems to change the workspace name that i3wsr processes. I don't think this is fundamentally i3wsr's responsibility, but based on my uses, it'd be a lot cleaner for a slightly stupid user across the board.

roosta commented 1 year ago

Hi, seems there are improvements that could be done when it comes to workspace numbers and separators and how i3wsr targets workspace. Splitting on whitespace might not be the most robost system. I guess I landed on it cause it works for my usecase, detailed in the readme example, but I can look into improving this when I get the chance. There are other quirks with i3wsr when assigning to workspace similar to what you describe so I've had it on the radar, but it can be made to work with the right config.

roosta commented 1 year ago

In an ongoing effort to close issues, I've pushed a commit to the develop branch that I do believe solves the issue you describe.

There is a new option called --split-at=":" and a config option under general

[general]
split_at = ":"

The default is the old behavior. I've updated the readme with more detailed explanations, let me know if anything is still unclear?

The last issue you describe, using i3-msg workspace 1 works for me regardless of split_at char, and I am unable to reproduce the issue on my end.

Not sure you still use i3 or i3wsr, if you do let me know if this works as you expected.

roosta commented 1 year ago

Closing this due to lacking interest, the develop branch contains the changes described and will be merged to main when some other issues are resolved