Skip to content

workspace widget improvements for hyprland#2683

Merged
ItsLemmy merged 2 commits into
noctalia-dev:v5from
ElJeffe:v5
May 15, 2026
Merged

workspace widget improvements for hyprland#2683
ItsLemmy merged 2 commits into
noctalia-dev:v5from
ElJeffe:v5

Conversation

@ElJeffe
Copy link
Copy Markdown

@ElJeffe ElJeffe commented May 14, 2026

Pull Request

workspace widget improvements for hyprland:

  • Mark special workspaces and hide them in the workspaces widget
  • always use the id to identify a workspace

Motivation

  1. special workspaces (unique to hyprland?) should not be shown in the workspaces widget
  2. the workspaces switching of hyprland did not always use the id, but sometimes the name. If two workspaces were names the same, or in other border cases, switching workspaces with the workspaces widget did not work

Type of Change

Mark the relevant option with an "x".

  • [ x] Bug fix
  • New feature
  • Breaking change
  • Refactoring

Related Issue

  • Closes #(issue number) (if any)

Testing

Describe how you tested your changes and mark the relevant items.

  • Tested on niri
  • [ x] Tested on Hyprland
  • Tested on sway
  • Tested with different bar positions and density settings
  • Tested at different interface scaling values
  • [ x] Tested with multiple monitors (if applicable)

Screenshots / Videos

If applicable, include screenshots or videos to help illustrate your changes.

Checklist

  • [ x] Code follows project style guidelines
  • [ x] Self-reviewed my code
  • [ x] No new warnings or errors
  • Documentation or comments updated (if relevant)

Additional Notes

Add any additional context or follow-up notes for reviewers.

@ItsLemmy
Copy link
Copy Markdown
Collaborator

I'm worried about the display side filtering of the special workspace(s), this bring a de-synchronization between the data (m_cachedState / m_items) some code down the line will potentially use the cached state and it will create bugs.

ex: Changing workspace with the mouse-wheel while take into account the special one.
The special / hidden workspace will still be considered in the layout computation, so it will add unnecessary spacing the workspace widget.

So I'd recommend filtering the special workspace at the source : In the backend, don't emit special workspaces from all() / forOutput() at all (they're not useful to any consumer today it seems)

Jef Steelant added 2 commits May 15, 2026 12:21
the code used to identify workspaces by name if the name was set. This
poses a problem if the name of the workspace was empty, or if two
workspaces have the same name. This refactoring will always use the
reported workspace id to identify workspaces when possible.
special workspaces (id < 0) are not returned for all() and forOutput()
calls, thus they will not be shown in the workspaces widget
@ElJeffe
Copy link
Copy Markdown
Author

ElJeffe commented May 15, 2026

the workspaces are now not returned on all() and forOutput() (695281a)
I also cleaned up the workspace ids, the id should be the identifier, but the code seemed to prefer the name of the workspace, which could give unexpected behaviour when:

  • two workspaces have the same name
  • a workspace has no name
  • a workspace changed name from its id to a real name ("1" -> "workspacename")

@ItsLemmy
Copy link
Copy Markdown
Collaborator

Thanks again for the PR, I'm merging it.

You may wanna double check the "workspacev2" implementation, from Hyprland's wiki the args seems to be {id},{name} and you seem to parse args[1] (the name) as an integer. This would silently fail for any non numeric workspace name.

@ItsLemmy ItsLemmy merged commit 729b4ae into noctalia-dev:v5 May 15, 2026
2 checks passed
@ElJeffe
Copy link
Copy Markdown
Author

ElJeffe commented May 15, 2026

Thanks again for the PR, I'm merging it.

You may wanna double check the "workspacev2" implementation, from Hyprland's wiki the args seems to be {id},{name} and you seem to parse args[1] (the name) as an integer. This would silently fail for any non numeric workspace name.

you are correct. fixed in #2692

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