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

[FEATURE REQUEST] wlr/taskbar let the cursor over the icon #3837

Open
adocampo opened this issue Dec 19, 2024 · 1 comment
Open

[FEATURE REQUEST] wlr/taskbar let the cursor over the icon #3837

adocampo opened this issue Dec 19, 2024 · 1 comment

Comments

@adocampo
Copy link

I had to install the module wlr/taskbar because some times my wife sits on my computer and she can't even figure how to open anything. So I've used to use that module myself.

I find annoying to click in the icon and the cursor disappearing from there and placing itself in the middle of the clicked application. I know this is a normal behavior in hypraland (and perhaps others), but feels unnatural when clicking on a taskbar item.

I see in the waybar-wlr-taskbar man page there are just some click actions, like activate, close, maximize, etc... I would love to see an option let the cursor just there, where I just clicked above that icon.

I've been playing with hyprctl cursorpos to obtain the coordinates and screen of the cursor, and hyprctl dispatch movecursor to move the cursor where I want, so if in the wlr-taskbar would be an action "execute_command" and we would be able to run our custom command on-click, on-click-middle, and on-click-right, we would be able not just to do exactly that, but extend functionality of the events way a lot more.

What dou you think, devs?

@RobertMueller2
Copy link
Contributor

RobertMueller2 commented Dec 20, 2024

Some background info: right now, the action handling in wlr/taskbar is slightly broken, because the on-clicks are evaluated both by wlr-taskbar on the individual buttons and AModule on the whole module. PR #3240 would fix that. If it's merged, you could theoretically do something like

{
    "layer": "top", // Waybar at top layer
    "position": "top", // Waybar position (top|bottom|left|right)
    "height" : 50,
    "modules-center": ["wlr/taskbar"],
    "wlr/taskbar": {
      "format": "{icon}",
      "icon-size": 24,
      "all-outputs": false,
      "actions" : {
          "on-click": "activate",
          "on-click-middle": "maximize",
          "on-click-right": "close",
      },
     "on-click": "module-wide-action.sh",
      "on-click-middle": "module-wide-action.sh",
      "on-click-right": "module-wide-action.sh",
    },
}

and both the wlr window action and the script should be executed. In order to actually move the cursor back, this is no option, because you can't run a script before and after and generally it'd probably race anyway.

I suppose it would be nice to create a followup PR to allow custom commands to be run INSTEAD of the window action, and then the user can do whatever they want, e.g. run hyprctl to retrieve cursor position, activate or close a window and then move the cursor back to the original position. But I think this is still not going to work. wlr/taskbar is using wlr foreign toplevel handles, see https://wayland.app/protocols/wlr-foreign-toplevel-management-unstable-v1 . AFAIK, this handle does not translate into anything you can use with hyprctl (or swaymsg, for that matter).

BTW, on sway, the cursor does NOT jump to the window in question. And the protocol does not say anything about cursor handling for the individual actions. Best suggestion I can offer is to ask the Hyprland people why it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants