Skip to content

Fix Hyprland workspace handling: ignore special workspaces#47

Open
EdwinLeeford wants to merge 1 commit into
MaxVerevkin:masterfrom
EdwinLeeford:hyprland-fix-special-workspaces
Open

Fix Hyprland workspace handling: ignore special workspaces#47
EdwinLeeford wants to merge 1 commit into
MaxVerevkin:masterfrom
EdwinLeeford:hyprland-fix-special-workspaces

Conversation

@EdwinLeeford

Copy link
Copy Markdown

A simple patch that resolves the Issue #46 in the Hyprland workspace module when special workspaces, which use negative IDs are present.

  • Changed u32 to i32 for workspace IDs across all WM backends
  • Hyprland-specific logic updated to ignore special workspaces

@Computerdores Computerdores left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as special workspaces go this works perfectly!

However, Hyprland also supports named workspaces which have negative IDs as well. This leads to them also being ignored under this PR. However, because they behave like regular workspaces they should, imo, not be ignored.

Since the name of special workspaces always starts with special:, we can instead filter on that (see my suggested change).

self.workspaces
.iter()
.filter(|ws| ws.monitor == output.name)
.filter(|ws| ws.monitor == output.name && ws.id >= 0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.filter(|ws| ws.monitor == output.name && ws.id >= 0)
.filter(|ws| ws.monitor == output.name && !ws.name.starts_with("special:"))

(One minor issue: Hyprland allows the names of named workspaces to start with special: so these will still be filtered out. However, Hyprland does not expose the information whether a workspace is special in any other manner, so I don't think there is an alternative here)

Atemu added a commit to Atemu/i3bar-river that referenced this pull request Jul 23, 2025
Hyprland's special workspaces have negative indices which would cause
i3bar-river to irrecoverably display an error.

I built this before I looked whether someone else already did this and found MaxVerevkin#47.

I think I like not filtering out workspaces at all to be the better option
because this way the special workspace is shown in front of the other workspaces
but only when it's activated which I find quite intuitive; it's special
afterall.

This behaviour is infinitely better than irrecoverably soft-crashing either way.
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