Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.44k stars 695 forks source link

On-click not working for workspaces in hyprland #3206

Open Kommynct opened 5 months ago

Kommynct commented 5 months ago
    "hyprland/workspaces": {
        "enable-bar-scroll": true,
        "disable-scroll-wraparound": true,
        "all-outputs": false,
        "show-special": true,
        "format": "{name}",
        "smooth-scrolling-threshold": "4",
        "on-click": "activate && hyprctl monitors -j | jaq -r '.[] | select(.focused == true) | .specialWorkspace.name' | sd 'special:' '' | xargs -I [] hyprctl dispatch togglespecialworkspace []",
        "format-icons": {
            "1": "1",
            "2": "2",
            "3": "3",
            "4": "4",
            "5": "5",
            "6": "6",
            "7": "7",
            "8": "8",
            "9": "9",
            "10": "10",
        }
    },

the on-click here should close the special workspace if it's open and another workspace has been clicked on, it however, does nothing, i've tried it with also replacing the activate && with just the part after, and that also just normally activates on-click.

zjeffer commented 5 months ago

I'm not sure on-click works in hyprland/workspaces. Click events are handled by each individual workspace button:

https://github.com/Alexays/Waybar/blob/e627879b1656ec7352e6382f80ee16d90b377aaf/src/modules/hyprland/workspaces.cpp#L866-L867

Kommynct commented 5 months ago

https://github.com/Alexays/Waybar/wiki/Module:-Workspaces#example-for-hyprland

It's in the examples

zjeffer commented 5 months ago

Ah I see. I think on-click maybe doesn't allow you to execute commands as if it's a shell? "activate" isn't a shell command, but seems to be a built-in module command.

Kommynct commented 5 months ago

It definitely seems that way, but that doesn't seem to be how on-click works elsewhere, should definitely be fixed