Abstract mouse/window/keyboard interfaces #829
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TLDR
With my recent discovery that I can poll the mouse location and interact with windows easily (on gnome shell at least) it opens the path toward (hopefully) easily port AutoKey over to full support on Wayland with minimal to no loss of major features
STATUS
Abstracted Window interface, working with AutoKey gnome shell extension to get autokey working on Wayland/gnome distros (Ubuntu 22.04 for ex).
The longer term plan is to have things setup internally so that we can easily add additional interfaces for different display servers and different desktop environments.
https://github.com/sebastiansam55/autokey-gnome-extension
This GNOME shell extension is a fork of one that provides a number of dbus methods that allow us to interact with windows under wayland. We can get the active window information and move/resize/close/maximize/minimize.
It will also allow us to poll the location of the mouse pointer, with this we can use uinput to move the mouse in x y until it is approximately in the correct location. TBD How hard that will actually be to make look smooth/fast.
Unfortunately Wayland does not allow the pointer to be warped.
TODO
Add additional dbus functions to extension for mouse interactionsWayland does not allow anything other than polling locationSomething needs to be done about the Button and Key classes in model. They need to be abstracted in someway that will allow
Key.LEFT
to correspond to the correct scan code/key code per the active keyboard system.New
uinput events
For hotkeys, under uinput we should be able to capture any event, so everything from foot peddles to mouse buttons, gamepads and keyboards we should be able to record and listen for as an event for a hotkey. Very cool.
left/right modifiers
I am also going to strive to bring left and right differention to both the hotkey modifiers and the keyboard send system, have to either bring support for that to x11 keyboard or make it backwards compatible. Setting the generic version to left makes the most sense.
IE: For x11 there is currently only
Key.SHIFT
with no diffentiotion between left/right. For uinput I'll be trying to set it to respect allKey.LSHIFT
Key.RSHIFT
andKey.SHIFT
. the last would be sent as left shiftinternal changes
Mouse, Keyboard, window interfaces are all going to be separated out to be independent of each other, with this done it will be easier to implement support for Wayland.
Scenarios:
GNOME/Wayland
KDE/wayland
[GNOME / KDE]/x11
CHANGES
window
is going to change scripting API wise, will be breaking change, ultimately it's my fault for not being forward looking when adding those methods, they were tightly specific to x11mouse
will likely evolve, right now there's really only move and click but you don't send a click or don't send a move if you don't want to do both, would like to split those out