linuxmint/cinnamon-settings-daemon

Do only rotate if tablet mode is active

Opened this issue · 1 comments

dreng commented
 * Cinnamon version: 5.2.7
 * Distribution - Mint 20.3

Sorry for cross posting, but this one is related to cinnamon and cinnamon-settings-daemon. See also linuxmint/cinnamon#10697

Issue
Auto rotate does not honor /sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi/hotkey_tablet_mode. The screen rotates even if a Thinkpad Yoga is not in tablet mode (display turned all the way down). The behavior on MS Windows is different and seems to be more logical since automatic rotation does rarely make sense when not in tablet mode.

Steps to reproduce

  • Take a Lenovo Thinkpad Yoga, e.g. X390 or X13
  • Turn Auto Rotate on in display settings
  • Have a look at /sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi/hotkey_tablet_mode -> 0
  • Rotate display and watch the screen rotate automagically
  • Rotate back
  • Turn display at least 180 degrees down
  • Have a look at /sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi/hotkey_tablet_mode again -> 1
  • Rotate display again -> screen rotates like seen before

Expected behaviour

Screen should rotate in tablet mode only (if display is turned down more than 180 degrees, respectively if /sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi/hotkey_tablet_mode equals 1).

Other information

  • The fix has to take place in cinnamon-settings-daemon/plugins/orientation/csd-orientation-manager.c
  • A new GSettingsSwitch like "orientation-lock-tablet-mode" in org.cinnamon.settings-daemon.peripherals.touchscreen should be implemented
  • Display settings: A new switch should be implemented in cinnamon/files/usr/share/cinnamon/cinnamon-settings/modules/cs_display.py like "Rotate in tablet mode only"
  • More information about thinkpad-acpi hotkey_tablet_mode: https://www.kernel.org/doc/html/latest/admin-guide/laptops/thinkpad-acpi.html
dreng commented

I just tried a patched version on my laptop when I realized that this is not the ideal solution. A more elegant way would be to implement an ACPID listener in another thread, as was done with the onscreen keyboard called "onboard". The famous "acpi_listen" could help here.

This has the advantage that not only Thinkpads would benefit. It also allows another important feature to be implemented: When the display is folded back, thereby turning off tablet mode, the screen should automatically rotate back to the "normal" position. If the display is then rotated to "left-up" or "right-up" and tablet mode is activated afterwards by folding the display, this can be detected and the screen can be rotated automatically. This would not be noticed without ACPID Listener.

@cinnamon-settings-daemon dev team
What is the default procedure with feature requests here? Do you accept pull requests in general or should one wait for one of you writing like "Yes, we want this implemented but we haven't got any free ressources. Any volunteers?"