domferr / tilingshell

Extend Gnome Shell with advanced tiling window management. Supports multiple monitors, Windows 11 Snap Assistant, Fancy Zones, customised tiling layouts and more.
https://extensions.gnome.org/extension/7065/tiling-shell/
GNU General Public License v2.0
519 stars 10 forks source link

[Feature Request] Snap Assistant not showing on touch devices #82

Closed palexdev closed 2 months ago

palexdev commented 2 months ago

Describe the bug The Snap Assistant popup does not show (not properly at least) when using touchscreens

To Reproduce 1) You need a touchscreen 2) Drag a window 3) Observe that the Snap Assistant popup is not shown properly

Screenshots https://github.com/domferr/tilingshell/assets/16880178/b0553d1e-e4e3-458a-aee8-6e1dd43650db

Information (please complete the following):

Additional context The device I'm experiencing the issue on is an Android tablet that I modded to use Linux. I have a bluetooth keyboard, and as you can see in the video (when the cursor appears I'm using the keyboard's trackpad) it works properly with it. Let me know if you need logs or anything else and how to collect them

domferr commented 2 months ago

Hey @palexdev thank you for sharing this! I didn't test Tiling Shell on touch devices, but thanks to you we can assume that it does not work ahaha. I'm looking to add this feature! Hope to give you an update soon :partying_face:

palexdev commented 2 months ago

Thank you very much @domferr your awesome extension is the last piece to complete my setup, looking forward to it 😄

domferr commented 2 months ago

Hey @palexdev I'm writing to give you a quick update. I hoped to implement this in few days and after some research it turned out that GNOME doesn't provide to extensions a way to know the touch position while moving the window. I'm looking into ask them :wink: and I'll tell you whether this is doable or not!

palexdev commented 2 months ago

@domferr Thanks for the update 👍🏻 May I ask a question, how does it work?

Like, I don't understand why there's a difference between moue and touch gestures (in the context of tilingshell of course) and how does it affect the Snap Assistant.

In my head the system works as follows: 1) Detect window drag 2) Display the Snap Assistant on the window's monitor (or all monitors). The popup's position does not depend on the event or window position, but rather on the monitor's geometry 3) Detect window on one of the layouts and position on drop

Of course I know it's much more complicated, but I'm curious to know what is happening behind the scenes

domferr commented 2 months ago

Yeah, and I use the mouse pointer position to show or hide the snap assistant and to detect which snap assistant's tile is hovered by the mouse.

The problem here is that GNOME provides a way to know at any time the mouse pointer position, but touch events don't move the mouse pointer and GNOME doesn't provide a way to know the last touch position.

I have tried to listen to touch events: they get fired correctly but as soon as you start grabbing a window the touch events are got by the window and not propagated to anything else

The window position is itself a good thing to use to understand whether or not the snap assistant is shown, but it's not useful to solve the second problem 😕

However...I have a workaround in mind, which is complicated but at least we have a solution:

That won't work well when the window is moved to the edges, since my assumption may be wrong

palexdev commented 2 months ago

Ah yes I see the problem now

It's a bit sad considering that GNOME is one of the best environments when it comes to touch support. Edit: yet, proper touch support in Linux has still a long way to go. I recently had to ditch both VSCode and Zed in favor of Sublime Text because the latter works a little better on touchscreens, but many things still don't work (e.g. long press to open context menus)

The workaround could work in theory. I don't know the behavior at the edges, but I think the major issue is going to be precision. Still better than nothing though

domferr commented 2 months ago

Hey @palexdev I've got very good news for you :smile:

I implemented my workaround and it seems to work on my touch device! Please consider it is a rough version, test it for a while if you can and let me know of any bug or missing features!

- GNOME 42, 43 and 44: GNOME.42-44.tilingshell@ferrarodomenico.com.zip - GNOME 45 and 46: tilingshell@ferrarodomenico.com.zip Edit: this version is now outdated, there is a new one with bugfixes below.


If you don't know how to install, here it is a little guide for you. You need to perform the following steps: overwrite the files into .local/share/gnome-shell/extensions/tilingshell@ferrarodomenico.com with the ones in the archive I shared, then log out and log in (or restart the system).

domferr commented 2 months ago

Another update, with bugs fixed. It seems to work, but some everyday testing is still needed. I'll leave here the updated version, with touch support!

domferr commented 2 months ago

Touch support is now available on Tiling Shell! :star:

palexdev commented 2 months ago

@domferr hello, sorry for not reporting back sooner, it's been a very busy week The new version indeed fixes the snap assistant, but it's still buggy on my device Here's a video: https://github.com/user-attachments/assets/99b62405-5e55-414d-9a41-f70bf53954f1

As you can see, two issues: 1) Precision at edges is not great (I can live with that tbh) 2) The snap assistant does not place windows as intended, this is a major issue

domferr commented 2 months ago

Hey thank you for the video. I'm curious: does it happen with apps that need on-screen keyboard only?

Can you confirm that the highlighted tile of the snap assistant is the right one (the one under your finger)?

domferr commented 2 months ago

A quick update: it seems a bug of the latest version (#99).

I'm publishing a bugfix for that which will solve yours as well