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

"selection cancelled" when I trigger slurp by clicking on a button with my mouse #146

Open
andyongith opened this issue Nov 10, 2023 · 1 comment · May be fixed by #149
Open

"selection cancelled" when I trigger slurp by clicking on a button with my mouse #146

andyongith opened this issue Nov 10, 2023 · 1 comment · May be fixed by #149

Comments

@andyongith
Copy link

Little Context...

  • I've made a button(here's the problem) in my Waybar which on-click supposed to take screenshot using slurp and grim
  • I've a key binding(no problem here) in my Hyprland which also takes screenshot using slurp and grim

What I faced?

When I use the key binding(i.e. using keyboard to trigger slurp and using mouse to drag) to take the screenshot, it works perfectly fine BUT
when I click(using the mouse obviously) on the button on Waybar, it just flashes and disappear. I checked the console and it gave an output selection cancelled HOWEVER
I fixed the issue by triggering slurp with "on-click-release" instead of "on-click"

What I think is the problem?

In my guess slurp goes through 3 actions,

  • Triggering slurp command
  • Mouse click to start dragging
  • Mouse release to end dragging

Here, when I click the Screenshot-button(triggered 1st action), I already got my mouse in clicked state after that I release(triggered 3rd action) my mouse(thinking to start dragging), it just disappears and sends the selection cancelled as stdout because the last action has already been triggered without the 2nd action.

Possible fix

Don't cancel the selection on mouse-release if mouse-click hasn't been triggered yet, instead allow it to start dragging again.

tmccombs added a commit to tmccombs/slurp that referenced this issue Dec 29, 2023
@tmccombs tmccombs linked a pull request Dec 29, 2023 that will close this issue
tmccombs added a commit to tmccombs/slurp that referenced this issue Dec 29, 2023
@tmccombs
Copy link
Collaborator

What is your waybar configuration? I'm not able to reproduce on sway with the following waybar configuration:

    "custom/slurptest": {
        "format": "slurp",
        "on-click": "slurp >> /tmp/slurptest"
    },

Maybe there is some difference between sway and hyprland in sending button events?

I think that https://github.com/emersion/slurp/pull/149/commits would fix it, but since I can't reproduce, I'm not entirely sure.

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 a pull request may close this issue.

2 participants