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 a575eaa commit 087407e
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 42 deletions.
101 changes: 101 additions & 0 deletions docs/source/adjust_rotate.rst
Original file line number Diff line number Diff line change
@@ -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/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/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/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/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/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.
1 change: 1 addition & 0 deletions docs/source/quick_user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This chapter includes installing the Raspberry Pi OS, installing the virtual key
adjust_the_resolution
install_virtual_keyboard
right_click
adjust_rotate



Expand Down
66 changes: 24 additions & 42 deletions docs/source/right_click.rst
Original file line number Diff line number Diff line change
@@ -1,79 +1,61 @@
Right Click Function
Right Click on RasPad
===============================

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.
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).

Here we use ``evdev-rce`` to make the right-click function still available.
Then you will need to download a ``Touchégg`` app. Enter the following command to install it.

Enter the following command to install the required software.

.. raw:: html

<run></run>

.. code-block:: shell
sudo apt install build-essential libevdev2 libevdev-dev -y
git clone 'https://github.com/PeterCxy/evdev-right-click-emulation.git'
cd 'evdev-right-click-emulation'
Enter the following command to build.
**For 32-bit OS:**

.. raw:: html

<run></run>

.. code-block:: shell
make all
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
Copy the file to the ``/usr`` directory.
.. raw:: html
**For 64-bit OS:**

.. 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``.

.. code-block:: shell
sudo reboot
sudo /usr/local/bin/evdev-rce &
.. image:: img/right_click.png
:align: center

Press ``Ctrl+C`` -> ``Y`` to exit and save the ``rc.local`` file, and then run ``sudo reboot`` to restart.

.. raw:: html

<run></run>
**Available gestures**

.. code-block:: shell
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.

sudo reboot
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).

After restarting, you can long press on the Raspberry Pi desktop and see if the right click function appears.
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 087407e

Please sign in to comment.