Skip to content

Commit

Permalink
Clarify sections of the documentation related to X11 and Wayland
Browse files Browse the repository at this point in the history
Re: #255.
  • Loading branch information
drmfinlay committed Mar 31, 2022
1 parent aace875 commit 77df5e4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
9 changes: 4 additions & 5 deletions documentation/faq.txt
Original file line number Diff line number Diff line change
Expand Up @@ -621,13 +621,13 @@ The :code:`Window` class also requires the `wmctrl`_ program::

sudo apt install wmctrl

The keyboard/mouse input classes will only work in an X11 session. You will
get the following error if you are using `Wayland`_ or something else::
The keyboard and mouse input classes on Linux (or similar) systems will only
work in an X11 session. The following error will occur if these classes are
used under `Wayland`_::

NotImplementedError: Keyboard support is not implemented for this platform!

If you see this message, then you will probably need to `switch to X11`_ or
use something like `ydotool`_ to have keyboard/mouse input work properly.
Wayland users are recommended to `switch to X11`_.

If you are using X11 and still see this message, then it means that the
:code:`DISPLAY` environment variable checked by Dragonfly internally is not
Expand Down Expand Up @@ -682,4 +682,3 @@ touch:
.. _switch to X11: https://askubuntu.com/questions/961304/how-do-you-switch-from-wayland-back-to-xorg-in-ubuntu-17-10
.. _wmctrl: https://www.freedesktop.org/wiki/Software/wmctrl/
.. _xdotool: https://www.semicomplete.com/projects/xdotool
.. _ydotool: https://github.com/ReimuNotMoe/ydotool
4 changes: 2 additions & 2 deletions documentation/installation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ difficult nor detrimental to the library's support for Python version 3.
**Note for Linux users**: Dragonfly is only fully functional in an X11
session. You may also need to manually set the ``DISPLAY`` environment
variable. Input action classes, application contexts and the ``Window``
class will **not** be functional under Wayland. It is recommended that
Wayland users switch to X11.
class will **not** be functional under Wayland. It is therefore recommended
that the Wayland user switch to X11.


Installation of Dragonfly
Expand Down
9 changes: 6 additions & 3 deletions dragonfly/actions/action_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@
To use this class on X11/Linux, the
`xdotool <https://www.semicomplete.com/projects/xdotool/>`__ program must be
installed and the ``DISPLAY`` environment variable set. This class does
**not** support typing keys in Wayland sessions.
installed and the ``DISPLAY`` environment variable set.
Please note that, for technical reasons, Dragonfly does not support sending
keystroke events this way in Wayland sessions. The Wayland user is therefore
recommended to switch to X11.
.. _RefKeySpec:
Expand Down Expand Up @@ -249,7 +252,7 @@
Unlike on Windows, the :class:`Key` action is able to use modifiers with
Unicode characters on X11.
This class does **not** support typing keys in Wayland sessions.
As stated earlier, sending keystroke events is not supported under Wayland.
Example X11 key actions
Expand Down
8 changes: 8 additions & 0 deletions dragonfly/actions/action_mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@
Mouse across platforms
............................................................................
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
Expand All @@ -164,6 +168,10 @@
On MacOS, however, Dragonfly cannot be used to scroll horizontally.
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.
Mouse class reference
............................................................................
Expand Down
9 changes: 6 additions & 3 deletions dragonfly/actions/action_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@
To use this class on X11/Linux, the
`xdotool <https://www.semicomplete.com/projects/xdotool/>`__ program must be
installed and the ``DISPLAY`` environment variable set. This class does
**not** support typing text in Wayland sessions.
installed and the ``DISPLAY`` environment variable set.
It differs from the :class:`Key` action in that :class:`Text` is used for
Please note that, for technical reasons, Dragonfly does not support sending
keystroke events this way in Wayland sessions. The Wayland user is therefore
recommended to switch to X11.
The :class:`Text` action differs from :class:`Key` in that it is used for
typing literal text, while :class:`dragonfly.actions.action_key.Key`
emulates pressing keys on the keyboard. An example of this is that the
arrow-keys are not part of a text and so cannot be typed using the
Expand Down

0 comments on commit 77df5e4

Please sign in to comment.