Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplication of "special:" in special workspace name #5729

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

Agent00Ming
Copy link
Contributor

@Agent00Ming Agent00Ming commented Apr 24, 2024

modified:   src/desktop/Workspace.cpp

Describe your PR, what does it fix/add?

Tokens for special workspaces have a duplicated special: string causing them to not spawn the windows properly.
(i.e. a special workspace called terminal would show up as special:special:terminal in the log)
Fixes #5726's special workspace spawning problems

Special workspaces always have a name that either: defaults to special when not specified on creation or must have special: prepended to their name when setting workspace rules.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

I don't know where else this getConfigName() function is called so I don't know if it breaks something else.
Did a search through the project and it seems that KeybindManager.cpp is the only place where it is called as is. From my testing, movetoworkspace and its variants are all fine, togglespecialworkspace is also fine and workspace does not apply to special workspaces.

Is it ready for merging, or does it need work?

Ready for merging

	modified:   src/desktop/Workspace.cpp
@Agent00Ming
Copy link
Contributor Author

Agent00Ming commented Apr 24, 2024

Addendum: lines 256..271 of MiscFunctions.cpp:

int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
    int result = WORKSPACE_INVALID;
    if (in.starts_with("special")) {
        outName = "special";

        if (in.length() > 8) {
            const auto NAME = in.substr(8);

            const auto WS = g_pCompositor->getWorkspaceByName("special:" + NAME);

            outName = "special:" + NAME;

            return WS ? WS->m_iID : g_pCompositor->getNewSpecialID();
        }

        return SPECIAL_WORKSPACE_START;

this is where the logic of resolving workspace names/IDs resides and where the other instance of special: is prepended to a special workspace's name

This is to fix the edge cases with the previous commit without breaking
user configs.

	modified:   src/helpers/MiscFunctions.cpp
@vaxerski vaxerski merged commit 81bb4eb into hyprwm:main Apr 24, 2024
10 checks passed
@Agent00Ming Agent00Ming deleted the specialduplication branch April 24, 2024 20:23
gulafaran pushed a commit to gulafaran/Hyprland that referenced this pull request Apr 26, 2024
…yprwm#5729)

* Fix duplication of "special:" in special workspace name
	modified:   src/desktop/Workspace.cpp

* Track default special workspace name as special:special
This is to fix the edge cases with the previous commit without breaking
user configs.

	modified:   src/helpers/MiscFunctions.cpp

---------

Co-authored-by: Agent_00Ming <agent00ming9366@gmail.com>
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.

Special workspace focus issues when misc:initial_workspace_tracking is enabled
2 participants