Switching auto screen rotation ON/OFF


I am on Kernel 6.3 and KDE. I would like to be able to switch the auto screen rotation ON/OFF on demand.

Switching OFF is rather straight forward via:

 sudo systemctl stop iio-sensor-proxy  

However when reversing the previous command with:

 sudo systemctl start iio-sensor-proxy                              

auto screen rotation is not working anymore. The accelerometer however is working correctly, as I get from monitor-sensors:

Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: undefined)
=== No ambient light sensor
=== No proximity sensor
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: left-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal

And also journalctl -b | grep iio confirms the correct activation:

Mai 19 15:08:59 LaptopSieAlleZuKnechten polkitd[868]: Operator of unix-session:2 successfully authenticated as unix-user:johnny to gain TEMPORARY authorization for action o
rg.freedesktop.systemd1.manage-units for system-bus-name::1.768 [systemctl start iio-sensor-proxy] (owned by unix-user:johnny)
Mai 19 15:08:59 LaptopSieAlleZuKnechten audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=iio-sensor-proxy comm="systemd" exe="/usr/lib/systemd
/systemd" hostname=? addr=? terminal=? res=success'
Mai 19 15:08:59 LaptopSieAlleZuKnechten kernel: audit: type=1130 audit(1684501739.612:202): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=iio-sensor-proxy comm="sy
stemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'

systemctl status iio-sensor-proxy :

● iio-sensor-proxy.service - IIO Sensor Proxy service
     Loaded: loaded (/usr/lib/systemd/system/iio-sensor-proxy.service; static)
     Active: active (running) since Fri 2023-05-19 15:08:59 CEST; 7min ago
   Main PID: 35709 (iio-sensor-prox)
      Tasks: 4 (limit: 17585)
     Memory: 5.3M
        CPU: 26ms
     CGroup: /system.slice/iio-sensor-proxy.service
             └─35709 /usr/lib/iio-sensor-proxy

Mai 19 15:08:59 LaptopSieAlleZuKnechten systemd[1]: Starting IIO Sensor Proxy service...
Mai 19 15:08:59 LaptopSieAlleZuKnechten systemd[1]: Started IIO Sensor Proxy service.

What am I missing?

Thanks and BR.

You probably make use of kde-auto-rotate from AUR and you are stopping and starting the wrong service. Look into auto-rotate.service instead and leave iio-sensor-proxy.service running.

AFAIK, on KDE Plasma wayland session you can set the Auto Rotation on and off via Settings, but i can’t test to confirm.

Thanks for the reply.

kde-auto-rotate is installed, but not running as a service.

These are the service i utilize:

 alsa-restore.service                                                                                                     >
  bluetooth.service                                                                                                        >
  cronie.service                                                                                                           >
  cups.service                                                                                                             >
  dbus.service                                                                                                             >
  iio-sensor-proxy.service                                                                                                 >
  kmod-static-nodes.service                                                                                                >
  ldconfig.service                                                                                                         >
  lvm2-monitor.service                                                                                                     >
  ModemManager.service                                                                                                     >
  NetworkManager-wait-online.service                                                                                       >
  NetworkManager.service                                                                                                   >
  polkit.service                                                                                                           >
  rtkit-daemon.service                                                                                                     >
  ryzenctrl-root.service                                                                                                   >
  sddm.service                                                                                                             >
  systemd-backlight@backlight:amdgpu_bl0.service                                                                           >
  systemd-binfmt.service                                                                                                   >
  systemd-fsck@dev-disk-by\x2duuid-41A2\x2dE9C6.service                                                                    >
  systemd-fsck@dev-disk-by\x2duuid-b579a1e3\x2decdb\x2d40d9\x2db6f4\x2d3eca9f205be1.service                                >
  systemd-journal-catalog-update.service                                                                                   >
  systemd-journal-flush.service                                                                                            >
  systemd-journald.service                                                                                                 >
  systemd-logind.service                                                                                                   >
  systemd-modules-load.service                                                                                             >
  systemd-random-seed.service                                                                                              >
  systemd-remount-fs.service                                                                                               >
  systemd-sysctl.service                                                                                                   >
  systemd-sysusers.service                                                                                                 >
  systemd-timesyncd.service                                                                                                >
  systemd-tmpfiles-setup-dev.service                                                                                       >
  systemd-tmpfiles-setup.service                                                                                           >
  systemd-udev-trigger.service                                                                                             >
  systemd-udevd.service                                                                                                    >
  systemd-update-done.service                                                                                              >
  systemd-update-utmp.service                                                                                              >
  systemd-user-sessions.service                                                                                            >
  teamviewerd.service                                                                                                      >
  tlp.service                                                                                                              >
  udisks2.service                                                                                                          >
  upower.service                                                                                                           >
  user-runtime-dir@1000.service                                                                                            >
  user@1000.service                                                                                                        >

Btw: I am on X11 for the time being.

Does no one have a clue?