Skip to content

Commit

Permalink
renew right-click solution & add rotate function
Browse files Browse the repository at this point in the history
  • Loading branch information
SunFounder committed Jun 30, 2022
1 parent ba33fb6 commit aa42da0
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 46 deletions.
101 changes: 101 additions & 0 deletions docs/source/quick_guide/adjust_rotate.rst
@@ -0,0 +1,101 @@
Rotate the Display and Touch Angle
=========================================

After the Raspberry Pi is turned on, if you find that the display or touch angle is not correct, or you need to rotate to other angles during use, you can follow the tutorial below to achieve them.

Rotate the Display Angle
---------------------------------

There are two ways to rotate the display angle, one way is from the Raspberry Pi desktop, and the other way is using the command line.


**1. Set from the Raspberry Pi Desktop**


Click the **Raspberry Pi icon** -> **Preferences** -> **Screen Configuration**.

.. image:: img/image11.png

Then click **Configure** -> **Screens** -> **HDMI-1** -> **Orientation**, then select the angle you want to rotate.

.. image:: img/orientation.png

Click the green checkbox to take effect.

.. image:: img/check.png

.. note::

* After checking the box, you need to confirm the changes by clicking **OK** within 10 seconds, otherwise it will go back to the previous angle.

.. image:: img/invert_ok.png

* For Debian Bullseye system, there is only one option - **Inverted**, if you want to rotate to another angle, you need to set it from command line.

**2. Using the Command Line**

To make this change stay after a reboot, do the following to rotate your display.

Open the ``autostart`` file.

.. raw:: html

<run></run>

.. code-block:: shell
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
Add the following line to the end.

.. code-block::
@xrandr --output HDMI-1 --rotate right
* ``right`` represents the direction of rotation, and there are 4 directions to choose from: ``normal``, ``right``, ``left`` and ``inverted``.

After restarting the Raspberry Pi, you will see the effect of rotation.

.. raw:: html

<run></run>

.. code-block:: shell
sudo reboot
Rotate Touch Angle
--------------------------

Run the following command to open the ``40-libinput.conf`` file.

.. raw:: html

<run></run>

.. code-block:: shell
sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf
Find the touchscreen section and add the corresponding rotation angle to it.

.. image:: img/touch_rotate.png


* 0 degrees: ``Option "CalibrationMatrix" "1 0 0 0 1 0 0 0 1"``
* 90 degrees: ``Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"``
* 180 degrees: ``Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1"``
* 270 degrees: ``Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"``

.. note::
For some Raspberry Pis, you may set the rotation angle of touch to 90°, but eventually you find that it is not 90° and you need to manually alternate these 4 sets of values.

After restarting the Raspberry Pi, you will see the effect of rotation.

.. raw:: html

<run></run>

.. code-block:: shell
sudo reboot
Binary file added docs/source/quick_guide/img/TSimage11.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/quick_guide/img/check.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/quick_guide/img/invert_ok.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/quick_guide/img/orientation.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/quick_guide/img/touch_rotate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/source/quick_guide/quick_user_guide.rst
Expand Up @@ -10,4 +10,5 @@ This chapter includes installing the Raspberry Pi OS, installing the virtual key
install_the_rpi_os
adjust_resolution
install_virtual
right_click
right_click
adjust_rotate
69 changes: 24 additions & 45 deletions docs/source/quick_guide/right_click.rst
@@ -1,82 +1,61 @@
Right Click on RasPad
===============================

Right Click on Raspberry Pi
=================================
The touchscreen makes it easy to perform simple navigation tasks with your finger or stylus, but you may want to be able to use the context menu (right-click menu).

Touchscreen tablets and displays make it easy for you to perform simple navigation tasks with your fingers or stylus, but at some point, you may want to use right-click commands to quickly access context-specific shortcuts.
Then you will need to download a ``Touchégg`` app. Enter the following command to install it.

Here we use ``evdev-rce`` to make right-click command still available.

Enter the following command to install the required software.
**For 32-bit OS:**

.. raw:: html

<run></run>

.. code-block:: shell
sudo apt install build-essential libevdev2 libevdev-dev
git clone 'https://github.com/PeterCxy/evdev-right-click-emulation.git'
cd 'evdev-right-click-emulation'
wget https://github.com/JoseExposito/touchegg/releases/download/2.0.14/touchegg_2.0.14_armhf.deb
sudo apt install ./touchegg_2.0.14_armhf.deb
Enter the following command to build.
.. raw:: html

<run></run>

.. code-block:: shell
make all
**For 64-bit OS:**

Copy the file to the ``/usr`` directory.

.. raw:: html
.. raw:: html

<run></run>

.. code-block:: shell
sudo cp 'out/evdev-rce' '/usr/local/bin/'
wget https://github.com/JoseExposito/touchegg/releases/download/2.0.14/touchegg_2.0.14_arm64.deb
sudo apt install ./touchegg_2.0.14_arm64.deb
Make it executable.
.. raw:: html

<run></run>
.. code-block:: shell
sudo chmod +x '/usr/local/bin/evdev-rce'
Modify the /etc/rc.local file to enable boot-up.
After restarting, you can double-tap the screen to bring up the context menu.

.. raw:: html

<run></run>

.. code-block:: shell
sudo nano /etc/rc.local
After entering rc.local, add the following command before ``exit 0``.

.. raw:: html

<run></run>
sudo reboot
.. code-block:: shell
.. image:: img/right_click.png
:align: center

sudo /usr/local/bin/evdev-rce &

After restarting, you can long press on the desktop and see if the right click function appears.

.. raw:: html
**Available gestures**

<run></run>
Swipe
Swipe gestures are executed when three or more fingers are moved synchronously in the same direction.
Note that three is the minimum number of fingers that Touchégg allows for swipe gestures on touchpads and two on touchscreens.

.. code-block:: shell
Pinch
Pinch gestures are executed when two or more fingers are located on the touchpad and are either changing the relative distance to each other (pinching) or are changing the relative angle (rotate).

sudo reboot
Tap
Tap gestures are executed when two or more fingers "click" on the touchscreen.

.. image:: img/right_click.png
:align: center
For more details please check `Touchégg <https://github.com/JoseExposito/touchegg>`_.

0 comments on commit aa42da0

Please sign in to comment.