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

[hyprland/workspaces] Implement workspace taskbars #3868

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

pol-rivero
Copy link

@pol-rivero pol-rivero commented Jan 4, 2025

Summary

This PR expands the functionality of hyprland/workspaces to make it behave more like the wlr/taskbar module. See #2656 for a high-level description.

A full fix of #2656 would require porting those changes to the sway/workspaces module as well. I don't use Sway and I'm not familiar on how it works, but if anyone is interested in giving it a go in a separate PR feel free to ping me and I'll do my best to help.

Config changes

Adds the following changes to the hyprland/workspaces config:

"hyprland/workspaces": {
    // EXISTING SETTINGS
    "format": "{icon}: {windows}", // Used even if "workspace-taskbar.enable" is true
    "format-window-separator": "", // Will be ignored if "workspace-taskbar.enable" is true
    "window-rewrite-default": "",  // Will be ignored if "workspace-taskbar.enable" is true
    "window-rewrite": {},          // Will be ignored if "workspace-taskbar.enable" is true
    // NEW SETTINGS
    "workspace-taskbar": {
        // Enable the workspace taskbar. Default: false
        "enable": true,
        // Format of the windows in the taskbar. Default: "{icon}". Allowed variables: {icon}, {title}
        "format": "{icon} {title:.20}",
        // Icon size in pixels. Default: 16
        "icon-size": 16,
        // Either the name of an installed icon theme or an array of themes (ordered by priority). If not set, the default icon theme is used.
        "icon-theme": "some_icon_theme",
        // Orientation of the taskbar (see screenshots below). Default: "horizontal".
        "orientation": "horizontal"
    }
}

Notice how workspace-taskbar.enable defaults to false, so existing configs shouldn't be affected by these changes without opting in.

What's missing

I'm mainly waiting for your feedback on the config json names and structure. Once that's done I will update the wiki with the finalized spec.

Screenshots

Default CSS, old config file (defaults to old, text-based icons)

image

"hyprland/workspaces": {
    "format": "{icon}: {windows}",
    "format-window-separator": ",",
    "window-rewrite-default": "?",
    "window-rewrite": {
        "terminator": "",
        "code": "󰨞"
    }
},

Default CSS, new config file (default format is just the icon)

image

"hyprland/workspaces": {
    "format": "{icon}: {windows}",
    "workspace-taskbar": {
        "enable": true
    }
},

Default CSS, windows with first 10 chars of title and bigger icon

image

"hyprland/workspaces": {
    "format": "{icon}: {windows}",
    "workspace-taskbar": {
        "enable": true,
        "format": "{icon} {title:.10}",
        "icon-size": 18
    }
},

Tooltip shows full window title. Clicking focuses that specific window

image

  • Note: The screenshot doesn't show my cursor, which was hovering the "Comparing" window.

Allows an arbitrary format

image

"hyprland/workspaces": {
    "format": "[{icon}] (( {windows} ))",
    "workspace-taskbar": {
        "enable": true,
        "format": " [{title:.5} | {icon}] "
    }
},

My setup with custom CSS

image

  • Background indicates selected workspace

Same CSS as above, vertical orientation

image

"hyprland/workspaces": {
    "format": "{icon}: {windows}",
    "window-rewrite": {
        "terminator": "",
        "code": "󰨞"
    },
    "workspace-taskbar": {
        "enable": true,
        "format": "{icon} {title:.20}",
        "icon-size": 18,
        "orientation": "vertical"
    }
},

Add a list of window titles and icons to each workspace (like wlr/taskbar but grouped by workspace).

Only implemented on hyprland for now.
Use format from config instead of hardcoding
- orientation
- icon-size
- icon-theme
This seems to be an old bug that has been made visible with the new workspace taskbars feature.
Sometimes, when closing a window and re-opening a window of the same program, hyprland reuses the window address. Since m_orphanWindowMap was not being cleaned up on window close, the new window would not be updated properly.
Fix another older bug where the title of a window will not be updated after moving it to another monitor.
In onWindowMoved, when moving an orphan window to the display of the current bar, that window should no longer be an orphan.
Use a vector instead of a map for for storing the workspace windows.
This orders the windows by the time they were added to the workspace, instead of sorting by address (which is effectively a random order). The new ordering seems to match the wlr/taskbar module
Windows were not being shown or updated unless the window-rewrite config were present.
- Add missing CSS class to manpage
- Fix rare segfault when address is not found (seems to only happen when compiled for production)
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