Skip to content

Conversation

@Sayrus
Copy link

@Sayrus Sayrus commented Dec 31, 2025

Partial fix for #4741 by avoiding the name altogether. It may be possible to template using quotes if the quote type isn't present in the string, for instance:

  • my workspace => "my workspace
  • my "workspace" => 'my "spacespace'
  • workspace's => "workspace's"

But that wouldn't cover all cases. It seems sway handles this a bit differently: it handles any string but will change parsing behavior if it encounters a keyword (output, prev, ...). This is difficult to copy and maintain without using their parsing logic instead of the quoting mechanism.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the sway workspaces module to prefer switching by numeric workspace ID when available, avoiding quoting/parsing issues for workspace names containing quotes.

Changes:

  • Introduces a dedicated workspace_switch_number_cmd_ format string for numeric-based workspace switching.
  • Updates the click handler in Workspaces::addButton to send either a numeric-based workspace switch command when node["num"] >= 0, or fall back to the existing name-based command when no valid number is present.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/modules/sway/workspaces.cpp Adjusts the click handler to choose between numeric and name-based workspace switch commands based on the num field, reducing quoting-related parsing issues.
include/modules/sway/workspaces.hpp Adds a new workspace_switch_number_cmd_ format string to encapsulate the numeric workspace switch syntax.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant