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

Double click moves the mouse to the center #77

Closed
cpiber opened this issue Nov 20, 2024 · 16 comments
Closed

Double click moves the mouse to the center #77

cpiber opened this issue Nov 20, 2024 · 16 comments

Comments

@cpiber
Copy link
Contributor

cpiber commented Nov 20, 2024

This is a really weird issue, if I double click a window, and that double click causes a selection to be made (possibly related to primary selection/clipboard), then the mouse cursor is moved to the center of that window. This only happens with hyprscroller; importantly, it only happens when the scroller layout is active, master layout with hyprscroller loaded does not cause the problem.

I'll try to bisect when this started later

Edit: Also interesting, in XWayland applications, selection does not cause thus, but instead pressing Ctrl+C to copy does, so I think it's fairly likely to be related to the clipboard

@dawsers
Copy link
Owner

dawsers commented Nov 20, 2024

It doesn't seem to happen to me.

  • I open a terminal
  • I do ls -l
  • I double click on some word, and the cursor stays there

I think I am going to need a minimal config where you can reproduce the problem, with your clipboard manager choice etc. Maybe it opens some window?

@cpiber
Copy link
Contributor Author

cpiber commented Nov 20, 2024

I noticed at first due to double-click in Firefox. Will try to reduce later, interesting

@dawsers
Copy link
Owner

dawsers commented Nov 20, 2024

I can double-click normally in Firefox too, and it selects the current word. It could be a combination of mouse/clipboard configuration. I don't use any fancy clipboard manager, and my mouse config is just input:follow_mouse = 1

So a wild guess is you use some clipboard manager that creates a window (even if invisible) when you copy something, and then closes it. At close, hyprscroller will try to go to the active window in that workspace, and center the cursor.

@cpiber
Copy link
Contributor Author

cpiber commented Nov 20, 2024

I think I'm going crazy. Went home, after boot it doesn't happen anymore. Maybe due to a driver bug? At home I use an eGPU, while I'm away discrete Intel Iris... Closing for now, I'll reopen if it becomes a problem again.

@cpiber cpiber closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2024
@dawsers
Copy link
Owner

dawsers commented Nov 20, 2024

OK, reopen the issue if you see it again tomorrow.

The way things work right now, it could happen if there is a tiled (not floating) window that gets created and is maybe hidden from view. When it closes or changes focus, you could find an unexpected warp. It would be hard to debug without an application that does such a thing, and that's why I was expecting you might be using something like that, clipboard manager maybe because you said it happens when copying text.

I was about to add some cursor_warpoption like you suggested the other day, but I will wait until we see another case where things work in an unexpected way.

@cpiber
Copy link
Contributor Author

cpiber commented Nov 20, 2024

You were right, it started happening again, after I opened CopyQ for the first time (it was running all the time though). It stopped happening as soon as I quit it. I would appreciate an option to disable focus switching entirely, I can open a PR if you want.

@dawsers
Copy link
Owner

dawsers commented Nov 20, 2024

I will add the option, don't worry about a PR. But now that we know an application that does that, I am going to debug it and try to fix the behavior if it is indeed what I thought.

@dawsers dawsers reopened this Nov 20, 2024
@cpiber
Copy link
Contributor Author

cpiber commented Nov 20, 2024

Thank you very much

@dawsers
Copy link
Owner

dawsers commented Nov 20, 2024

I have installed CopyQ and I cannot reproduce the issue. I have tried changing most suspect options in its configuration, but I still cannot reproduce the problem. If you feel like it, export your configuration (with commands etc.) from the Preferences menu, Reset it, test again and then import the saved config again if you don't see any difference. I would really like to know what option is causing this problem.

Anyway, now I am going to add warp_cursor or something like that so you can have that option.

@dawsers
Copy link
Owner

dawsers commented Nov 20, 2024

Actually, I see there is a cursor:no_warps option in Hyprland, and hyprscroller respects it (I am simply calling CCompositor::warpCursorTo(), and it checks that option). So if you set that to true (the default is false), the cursor won't warp in most cases. Please, try that. It is always better not to duplicate options if possible.

@cpiber
Copy link
Contributor Author

cpiber commented Nov 21, 2024

I have installed CopyQ and I cannot reproduce the issue.

I also cannot reliably reproduce it, it just starts at some point. It seems like there's always copying in an xwayland window involved though. Also, since I'm on Ubuntu my CopyQ is somewhat old (7.1.0), so that may also be related. Thank you and sorry for spending so much time.

Actually, I see there is a cursor:no_warps option in Hyprland

Good to know, I haven't seen that option. It's not quite what I want, because it also does not move the cursor in response to keybinds (e.g. switching monitor), but I can live with it and it fixes this problem. Thank you

Edit: It looks like just the option "Run automatic commands on selection" is enough to trigger it, even when no automatic commands are defined. It still warps in xwayland on copy for some reason, but at least not on double click anymore

@cpiber cpiber closed this as completed Nov 21, 2024
@dawsers
Copy link
Owner

dawsers commented Nov 21, 2024

I will try to compile version 7.1.0 of CopyQ later today to see if I can find out what's happening.

I used CopyQ in the past, but I removed it for two reasons. The first one was dependencies. On Arch, it requires some KDE stuff. The second and more important one is Wayland doesn't have support for a nice interaction of out-of-app menus floating at the cursor, much needed for dictionaries or this kind of applications, so they open in another independent window. That is not pretty when using a tiling layout. For that reason, I moved to cliphist, which I use with rofi (the Wayland version). In case you want to have a look at it:

exec-once = wl-paste --type text --watch cliphist store #Stores only text data
exec-once = wl-paste --type image --watch cliphist store #Stores only image data

# cliphist
bind = $mainMod, V, exec, cliphist list | rofi -dmenu | cliphist decode | wl-copy
bind = $mainMod SHIFT, V, exec, rofi -modi clipboard:/home/dawsers/.config/rofi/cliphist-rofi-img -show clipboard -show-icons

@cpiber
Copy link
Contributor Author

cpiber commented Nov 21, 2024

No, don't, doesn't matter, I also updated to the latest from Github and it didn't change anything

I also tried cb, but that constantly opens windows, which does not work at all with my setup, I'll have a look at cliphist, thanks

@BinaryInk
Copy link
Contributor

You could also give clipse a shot, in the event you don't use Rofi.

I have a tuiTool tag that I use to pop up kitty with clipse (and other TUIs) in the center of my screen. Haven't had any issues with what you're describing nor copying from/to XWayland (sans 1Password, but I believe that's a different issue entirely as it predates my use of clipse).

@cpiber
Copy link
Contributor Author

cpiber commented Nov 21, 2024

Yep, I settled on clipse :)

I had a command in CopyQ to copy to xwayland (wl-paste | xclip -sel clip), which I have now bound to a keyboard shortcut, since certain applications (like VirtualBox) don't quite like the shared clipboard

@dawsers
Copy link
Owner

dawsers commented Nov 21, 2024

Thumbs up for clipse, I didn't know it. I have converted too.

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

No branches or pull requests

3 participants