Hyprland/workspaces: add feature for hiding persistent workspaces that lie past furthest active/non-empty workspace #2617
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hard to really describe, so I've included a video to demonstrate. I have workspaces 1-10 both setup as persistent and for pruning.
output.mp4
Basically, you can specify persistent workspaces that become hidden if they lie past the furthest workspace on the bar, besides special workspaces, that is active or non-empty. This allows for having a bar such as mine that isn't numbered, but still lets me know what number any given workspace is, without having to display all workspaces.
With regards to the implementation, I'm not sure if I've really done it the most efficient way, so a look over by someone more experienced would be appreciated. I have a loop that loops through the workspaces from the end to the beginning to find the furthest workspace that is active/non-empty, but I feel there's surely a better way to implement that.
It currently only works on update, and not on startup. To temporarily remedy this, I have called update on init, but I plan to get it working properly on startup. I've had a quick go at it and couldn't seem to get it down, so ideas on that would be appreciated.
Lastly, not entirely sure how the configuration should go in terms of naming and actual values. The way its set up now,
prune-past-persistence-point
lets you specify workspace IDs that are already set as persistent to be pruned if past the furthest active/non-empty workspace. I also added another config option,exclude-persistence-point
, that allow you to specify workspace IDs that will be ignored when determining the furthest active/non-empty workspace. I use this specifically to have workspace ID 21 for music with a seperate icon. Since it has a seperate icon, I don't need to see all the prior workspaces, because I know the workspace with the music icon is workspace ID 21. Not sure if this is the best way to go about it however, so any ideas with this are also welcome.