peterfajdiga / karousel

Scrollable tiling Kwin script
GNU General Public License v3.0
255 stars 5 forks source link

[Bug] Cannot click small targets on inactive slightly-offscreen windows #65

Open rrastgoufard opened 2 days ago

rrastgoufard commented 2 days ago

Hey! Love this project and have been using it extensively on multiple devices for the past few months. Really, truly love everything here.

I've been finding myself wanting to click on buttons on inactive slightly-offscreen windows. What happens is that the window will gain focus immediately upon mouse press, then the window will move, and then the mouse release will no longer be on the button, causing the action to have not worked.

Attached is a screenshot of two firefox windows. The one on the left has focus currently, and I want to click the close tab button on the window on the right. (The mouse cursor is hovering over it in the screenshot.) In this layout, that close button cannot be clicked.

Screenshot_20241003_152034

This happens both on X11 with a mouse and on Wayland with a touchscreen. For the focus mode, I am using click-to-focus and not focus-follows-mouse.

peterfajdiga commented 1 day ago

Hi, thanks for the report! This is something that annoys me as well, but there's no nice way to solve it.

I wish I could check the state of the mouse button and wait for release before scrolling to the newly focused window, but the Kwin Scripting API doesn't provide this.

One solution that I see is that I could add a delay after a window is focused, before scrolling to it. This could help in some cases, but not all (depending on how long the user takes between pressing and releasing the mouse button). But this delay would also apply when changing focus with the keyboard, and that's something I don't find acceptable.

rrastgoufard commented 1 day ago

Is it possible to determine whether a focus change was triggered via a shortcut as opposed to other means? If so, that would help greatly, as we could add the delay only in cases when no shortcut was triggered.

peterfajdiga commented 1 day ago

Nope, except Karousel's own shortcuts. But like I said, this solution wouldn't be bulletproof anyway, because the amount of delay would be just a guess.

rrastgoufard commented 1 day ago

Wait, I almost never use shortcuts other than karousel's own for changing focus. We're talking about things like alt-tab, right?

I would love a configurable delay (that could be set from 0ms to 1000ms or something, with default set to 0ms) in the script settings that only applies when focus changes due to non-karousel shortcuts. When a karousel shortcut is invoked, no delay! :)

You're right that this isn't bulletproof, but I think it would almost entirely solve my issues without negatively affecting the current behavior at all because we set the default to be 0ms.

What do you think?