initial refactor of Interactions.qml to add better support for touch screen gestures #114

Merged
zach merged 10 commits from feat/improved-gestures into main 2026-06-01 19:18:54 +02:00
Owner

This reworks the way Interactions.qml works under the hood, changed from using a single large MouseArea to multiple DragHandler and HoverHandler types. Shouldn't break any current functionality.

  • Added a two-finger gesture from the right-side border and swiping inwards to open the sidebar with a drag range of x < -20
  • Added two single-finger gestures from left- and right-side borders and swiping inwards to change the currently focused workspace to a relative of -1 and +1 respectively, depending on active workspaces on attached monitors.

I will most likely add configuration options for customizing both the gesture actions and drag thresholds.

Known issue:

Currently if a workspace is focused but there isn't a toplevel window which is focused, the gestures will not work correctly due to the input handler dropping inputs when the centroid point leaves the border bounds. This is unfortunately a Qt/Quickshell bug that would require ugly workarounds to fix.

This reworks the way Interactions.qml works under the hood, changed from using a single large `MouseArea` to multiple `DragHandler` and `HoverHandler` types. Shouldn't break any current functionality. - Added a two-finger gesture from the right-side border and swiping inwards to open the sidebar with a drag range of `x < -20` - Added two single-finger gestures from left- and right-side borders and swiping inwards to change the currently focused workspace to a relative of `-1` and `+1` respectively, depending on active workspaces on attached monitors. I will most likely add configuration options for customizing both the gesture actions and drag thresholds. ### Known issue: Currently if a workspace is focused but there isn't a toplevel window which is focused, the gestures will not work correctly due to the input handler dropping inputs when the `centroid` point leaves the border bounds. This is unfortunately a Qt/Quickshell bug that would require ugly workarounds to fix.
zach added 1 commit 2026-05-31 14:05:25 +02:00
initial refactor of Interactions.qml to add better support for touch screen gestures
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 11s
Python / lint-format (pull_request) Successful in 19s
Python / test (pull_request) Successful in 51s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m5s
e06fd71f11
zach requested review from AramJonghu 2026-05-31 14:05:25 +02:00
zach requested review from Inorishio 2026-05-31 14:05:25 +02:00
zach added 1 commit 2026-05-31 14:16:42 +02:00
remove leftover test timer and import
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 11s
Python / lint-format (pull_request) Successful in 19s
Python / test (pull_request) Successful in 58s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m4s
c267dfb0c2
zach added 1 commit 2026-05-31 14:32:43 +02:00
allow pointer takeover by anything, restrict takeover from items
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 12s
Python / lint-format (pull_request) Successful in 23s
Python / test (pull_request) Successful in 41s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m2s
cf22b41f07
AramJonghu approved these changes 2026-05-31 17:18:30 +02:00
Dismissed
AramJonghu left a comment
Collaborator

It works well. The only part that is a bit iffy is doing the two finger gesture, especially with a thin border. It was my suggestion to do two fingers, feels a bit bad. Another suggestion could be:

The notification center can be opened from the bar button itself. The only semi-conflict would be that swiping down now opens the settings window, which does not hide the nc-button, so that is fine for now.

Overall, I approve.

It works well. The only part that is a bit iffy is doing the two finger gesture, especially with a thin border. It was my suggestion to do two fingers, feels a bit bad. Another suggestion could be: The notification center can be opened from the bar button itself. The only semi-conflict would be that swiping down now opens the settings window, which does not hide the nc-button, so that is fine for now. Overall, I approve.
@@ -87,3 +84,2 @@
target: null
if (pressed && dragStart.y < bar.implicitHeight) {
if (dragY > 20)
Collaborator

Could this value also be a variable that takes a percentage of horizontal pixels on the display (or size of display eg a 14 inch display vs 24 inch).

Could this value also be a variable that takes a percentage of horizontal pixels on the display (or size of display eg a 14 inch display vs 24 inch).
Author
Owner

Was it intentional to make this comment on line 89? Because then I don't really know what you mean, since that is deleted code.

Was it intentional to make this comment on line 89? Because then I don't really know what you mean, since that is deleted code.
Collaborator

Ah, yea you are right. Sunlight made it hard to see when I made the comment. Line 93 seems like the added relevant code.

I meant; how many pixels are needed in a swipe motion before it is recognized (if it is 20px)? My original comment speaks on that.

Ah, yea you are right. Sunlight made it hard to see when I made the comment. Line 93 seems like the added relevant code. I meant; how many pixels are needed in a swipe motion before it is recognized (if it is 20px)? My original comment speaks on that.
Collaborator

To add to this, I reread the original post. My question stands if this could be dynamic depending on display size for example.

To add to this, I reread the original post. My question stands if this could be dynamic depending on display size for example.
AramJonghu marked this conversation as resolved
Author
Owner

Does it work better with larger borders? Maybe 4 or 6? The issue is mainly that it shouldn't have exclusive control over too much of the borders of the screen, and unfortunately Quickshell has no way of passing pointer events to windows. Otherwise I could've had larger activation borders without using more space.

Does it work better with larger borders? Maybe 4 or 6? The issue is mainly that it shouldn't have exclusive control over too much of the borders of the screen, and unfortunately Quickshell has no way of passing pointer events to windows. Otherwise I could've had larger activation borders without using more space.
Collaborator

Yes, it is better with larger borders. That makes me unsure what way would be a passable way of changing workspaces and share that space with the nc. Perhaps there is no good way at this moment.

Yes, it is better with larger borders. That makes me unsure what way would be a passable way of changing workspaces and share that space with the nc. Perhaps there is no good way at this moment.
Collaborator

Currently, a single swipe can move more than one workspace. In some cases, it moves up to 10 workspaces to one direction. Are there guardrails on how many workspaces a single swipe can move?

I also realized, what would happen if user has an external display. That display is on workspace 2. If user would swipe to workspace 2, it would do the movement to the external display? Or would it skip external display and move to the next free/empty workspace?

Currently, a single swipe can move more than one workspace. In some cases, it moves up to 10 workspaces to one direction. Are there guardrails on how many workspaces a single swipe can move? I also realized, what would happen if user has an external display. That display is on workspace 2. If user would swipe to workspace 2, it would do the movement to the external display? Or would it skip external display and move to the next free/empty workspace?
AramJonghu dismissed AramJonghu's review 2026-05-31 19:10:18 +02:00
Reason:

Found bug.

Author
Owner

I will look into adding logic to prevent more than one workspace switch.

The original post mentions that it focuses relative -1 and +1 workspace on the current monitor, meaning it will swap from workspace 1 to workspace 3 if workspace 2 is occupied by a different monitor.

I will look into adding logic to prevent more than one workspace switch. The original post mentions that it focuses relative `-1` and `+1` workspace on the current monitor, meaning it will swap from workspace 1 to workspace 3 if workspace 2 is occupied by a different monitor.
zach added 1 commit 2026-05-31 22:08:10 +02:00
Merge branch 'main' into feat/improved-gestures
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 14s
Python / lint-format (pull_request) Successful in 20s
Python / test (pull_request) Successful in 51s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m4s
8f381fa8f0
Author
Owner

what way would be a passable way of changing workspaces and share that space with the nc. Perhaps there is no good way at this moment.

I could make it so that changing workspaces is the lower-half, while opening sidebar is upper?

> what way would be a passable way of changing workspaces and share that space with the nc. Perhaps there is no good way at this moment. I could make it so that changing workspaces is the lower-half, while opening sidebar is upper?
zach added 1 commit 2026-05-31 22:30:26 +02:00
fix drag gestures firing more than once from one drag
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 11s
Python / lint-format (pull_request) Successful in 20s
Python / test (pull_request) Successful in 47s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m2s
db6051457f
zach added 1 commit 2026-05-31 22:45:36 +02:00
remove redundant logging
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 11s
Python / lint-format (pull_request) Successful in 22s
Python / test (pull_request) Successful in 43s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m2s
1e1c90a0c5
Collaborator

The workspace swipe skipping workspaces has been resolved in db6051457f.

Found a new minor bug, but somewhat tedious bug with the two finger swipe to reveal the nc. This could be resolved with the change you suggested with the upper vs lower solution. I will write it in more detail if the bug persists.

The workspace swipe skipping workspaces has been resolved in [db6051457f](https://git.zach-dev.cc/zach/z-bar-qt/commit/db6051457f154f330cff7bfa58abcd779eebd078). Found a new minor bug, but somewhat tedious bug with the two finger swipe to reveal the nc. This could be resolved with the change you suggested with the upper vs lower solution. I will write it in more detail if the bug persists.
zach added 1 commit 2026-05-31 23:05:36 +02:00
remove multi-touch handlers, single point for sidebar
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 12s
Python / lint-format (pull_request) Successful in 21s
Python / test (pull_request) Successful in 50s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m1s
6926880074
Collaborator

6926880074 resolved multi-touch. May be merged in my book. New issue to create a settings window for configuration.

[6926880074](https://git.zach-dev.cc/zach/z-bar-qt/commit/6926880074dab7bf63b92e4c2a6d5bdc66e8577b) resolved multi-touch. May be merged in my book. New issue to create a settings window for configuration.
zach added 1 commit 2026-06-01 12:13:34 +02:00
Merge branch 'main' into feat/improved-gestures
Python / lint-format (pull_request) Successful in 22s
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 27s
Python / test (pull_request) Successful in 50s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m2s
0820c8e023
AramJonghu approved these changes 2026-06-01 12:53:55 +02:00
AramJonghu added 1 commit 2026-06-01 15:05:04 +02:00
Merge branch 'main' into feat/improved-gestures
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 12s
Python / lint-format (pull_request) Successful in 18s
Python / test (pull_request) Successful in 47s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m6s
17e600e78e
Collaborator

Apologies for the dependency spam. Was testing something, but it did not do what I expected.

Apologies for the dependency spam. Was testing something, but it did not do what I expected.
Inorishio approved these changes 2026-06-01 18:55:52 +02:00
Inorishio left a comment
Collaborator

Everything works as intended.
Merge is approved.

Discussion point/idea for the future:
Would it not be easiest to slide left and right with one finger on the bottom border instead of the left and right sides. That would open up the possibility of having painting, nc, osd etc be specifically accessible from their perspective sides.

Everything works as intended. Merge is approved. Discussion point/idea for the future: Would it not be easiest to slide left and right with one finger on the bottom border instead of the left and right sides. That would open up the possibility of having painting, nc, osd etc be specifically accessible from their perspective sides.
zach added 1 commit 2026-06-01 19:01:13 +02:00
Merge branch 'main' into feat/improved-gestures
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 13s
Python / lint-format (pull_request) Successful in 25s
Python / test (pull_request) Successful in 51s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m3s
9e3cad6dbd
Author
Owner

I think we can absolutely add gestures for all parts of the UI, but I also think they're not mutually exclusive. For example we can make it so opening the drawing popout will activate with a gesture from the middle of the left edge, while the lower part of the left edge swaps workspaces, and then something else above, etc.

Maybe once I figure out a good way to handle multi-touch gestures we can make even more advanced gesture configurations.

I think we can absolutely add gestures for all parts of the UI, but I also think they're not mutually exclusive. For example we can make it so opening the drawing popout will activate with a gesture from the middle of the left edge, while the lower part of the left edge swaps workspaces, and then something else above, etc. Maybe once I figure out a good way to handle multi-touch gestures we can make even more advanced gesture configurations.
zach merged commit 807b2525b7 into main 2026-06-01 19:18:54 +02:00
zach deleted branch feat/improved-gestures 2026-06-01 19:18:59 +02:00
Sign in to join this conversation.