Skip to content

Commit

Permalink
Cleanup some of the documentation for the Mouse action
Browse files Browse the repository at this point in the history
  • Loading branch information
drmfinlay committed Sep 12, 2022
1 parent 6c5128e commit d2c4c73
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions dragonfly/actions/action_mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,31 +146,31 @@
Specifies how long to pause *after* clicking the button; same as above.
Mouse across platforms
Mouse caveats
............................................................................
To use this class on X11/Linux, the
`xdotool <https://www.semicomplete.com/projects/xdotool/>`__ program should
be installed and the ``DISPLAY`` environment variable set.
Please note that there are some platforms which do not support emulating
every mouse button listed above. If an unsupported mouse button (*keyname*)
is specified and the :class:`Mouse` action executed, an error is raised. For
instance, scrolling the mouse wheel horizontally (e.g. *wheelleft*) is not,
by default, a supported operation on X11::
is specified and the :class:`Mouse` action executed, an error is raised::
ValueError: Unsupported mouse button event: four
ValueError: Unsupported scroll event: wheelleft
On MacOS, double-click and triple-click can only be simulated via *repeat*::
Fortunately, this particular problem can be fixed by installing the *pynput*
library::
# Perform a double-click.
Mouse("left:2").execute()
pip install pynput
# Perform a triple-click.
Mouse("left:3").execute()
On MacOS, however, Dragonfly cannot be used to scroll horizontally.
# The following commented Mouse actions, for double-click and
# triple-click respectively, will not work properly on macOS:
#Mouse("left, left").execute()
#Mouse("left, left, left").execute()
For technical reasons, Dragonfly does not support sending mouse events this
way in Wayland sessions. The Wayland user is therefore recommended to switch
to X11.
For technical reasons, Dragonfly cannot support simulation of mouse events
in Wayland sessions. Wayland users are therefore recommended to switch to
X11, Windows or macOS.
Mouse class reference
Expand Down
2 changes: 1 addition & 1 deletion dragonfly/actions/mouse/_xdotool.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def execute(self, window):
# Raise an error for unsupported buttons.
if isinstance(button, str):
event_type_s = "button" if event_type == 0 else "scroll"
raise ValueError("Unsupported %s event: %s"
raise ValueError("Unsupported mouse %s event: %s"
% (event_type_s, button))

# Handle click events.
Expand Down

0 comments on commit d2c4c73

Please sign in to comment.