User:TheSame/google-krane notes/fixes

From postmarketOS Wiki

Sleep access fixes

If you see a prompt for the user password when you try to put the device to sleep (for example, in KDE by closing the lid) with a similar description:

Action: Suspend the system while an application is inhibiting this
ID: org.freedesktop.login1.suspend-ignore-inhibit

You can remove this restriction by using the polkit rule. Create a file /etc/polkit-1/rules.d/50-suspend.rules with the following contents and reboot device:

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.upower.suspend" ||
        action.id == "org.freedesktop.login1.suspend" ||
        action.id == "org.freedesktop.login1.hibernate" ||
        action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
        action.id == "org.freedesktop.login1.hibernate-multiple-sessions") {
        return polkit.Result.YES;
    }
});

KDE has a rule that sleep is blocked if there is an SSH connection. This rule can also be bypassed by adding another rule to the previous one:

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.upower.suspend" ||
        action.id == "org.freedesktop.login1.suspend" ||
        action.id == "org.freedesktop.login1.hibernate" ||
        action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
        action.id == "org.freedesktop.login1.hibernate-multiple-sessions" ||
        action.id == "org.freedesktop.login1.suspend-ignore-inhibit") {
        return polkit.Result.YES;
    }
});

SDDM fixes for Krane

When running SDDM on Krane, there are a few unpleasant issues with the screen - it's upside down, relative to the keyboard.

If this bothers you, you can change the xrandr and xinput rules. Install them on your system if you still don't have them.

# sudo apk add xrandr xinput

This works because SDDM runs through Xorg (as of 2024). This change doesn't seem to affect the KDE Xorg user session, or even less so the KDE Wayland session.

Create a file /usr/share/sddm/scripts/Xsetup with the following contents:

#!/bin/sh
# Xsetup - run as root before the login dialog appears
xrandr --output DSI-1 --rotate left
xinput set-prop "hid-over-i2c 27C6:0E30" "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1

You can then verify the changes by simply restarting SDDM itself (careful, this will close the current user session, but will not drop the SSH connection):

# sudo rc-service sddm restart