tcorreabr / Parachute

Look at your windows and desktops from above.
GNU General Public License v3.0
356 stars 32 forks source link

Scroll to change screen improvement #18

Closed divinae closed 4 years ago

divinae commented 4 years ago

To improve screen change using touchpad scroll. It's algorithm taken from SimpleMenu (https://github.com/KDE/plasma-simplemenu)

tcorreabr commented 4 years ago

Forget about the "redo the pull request" part. I don't think it's necessary. It's my first project with the pull request workflow.

divinae commented 4 years ago

Your changes look good. It's still doesn't work perfect with touchpad - I will try to find some better solution, but you can merge this in current state :)

gobonja commented 4 years ago

With tcorreabr changes scrolling is reversed

divinae commented 4 years ago

I'm not sure why, but:

   PlasmaCore.DataSource {
        id: executable
        engine: "executable"
        connectedSources: []
        onNewData: disconnectSource(sourceName)
        function exec(cmd) {
            connectSource(cmd)
        }
    }
    WheelHandler {
        property int wheelDelta: 0

        onWheel: {
            wheelDelta += event.angleDelta.y;

            if (wheelDelta >= 120 || wheelDelta <= -120) {
                wheelDelta > 0 ? executable.exec("qdbus org.kde.KWin /KWin previousDesktop") : executable.exec("qdbus org.kde.KWin /KWin nextDesktop");
                wheelDelta = 0;
            }
        }
    }

works better. It is eliminates some accident multiple desktop changes.

tcorreabr commented 4 years ago

I came up with another solution again. It also avoids multiple desktop changes and doesn't need PlasmaCore.DataSource. Could you please review it?

    WheelHandler {
        property int wheelDelta: 0

        onWheel: wheelDelta += event.angleDelta.y;

        onActiveChanged: {
            if (active === true) return;

            if (wheelDelta >= 120 || wheelDelta <= -120) {
                wheelDelta > 0 ? workspace.currentDesktop-- : workspace.currentDesktop++;
                wheelDelta = 0;
            }
        }
    }
divinae commented 4 years ago

I like this - should I update this Pull Request with your code, or you commit is yourself?

gobonja commented 4 years ago

I just noticed that regardles of this new changes, touchpad horizontal scroll to the left changes screen, but scroll on the right does nothing. @divinae can you check if you experience this behavior?

divinae commented 4 years ago

I just noticed that regardles of this new changes, touchpad horizontal scroll to the left changes screen, but scroll on the right does nothing. @divinae can you check if you experience this behavior?

It's should work only for vertical scroll

tcorreabr commented 4 years ago

I like this - should I update this Pull Request with your code, or you commit is yourself?

I made the new commit. I think now we are ready for the pull request merge.

tcorreabr commented 4 years ago

I just noticed that regardles of this new changes, touchpad horizontal scroll to the left changes screen, but scroll on the right does nothing. @divinae can you check if you experience this behavior?

I don't use horizontal scroll on my touchpad, so I couldn't reproduce what you described. If so, maybe we can resolve this later through a new issue.