https://bugs.kde.org/show_bug.cgi?id=336369

NotForYouMate <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #64 from NotForYouMate <[email protected]> ---
(In reply to y9ly4z091 from comment #62)
> Found a hack/fix
> Works on  kscreenlocker 6.6.3-1.1, plasma-desktop 6.6.3-1.1
> 
> in
> 
> /usr/share/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/
> LockScreenUi.qml
> 
> add at the end of  
> 
> actionItems
> 
> block the following
> ActionButton {
>                         text: i18ndc("plasma_shell_org.kde.plasma.desktop",
> "@action:button", "&Restart")
>                         icon.name: "system-reboot"
>                         onClicked: sessionManagement.requestReboot()
>                         visible: sessionManagement.canReboot
>                     },
>                     ActionButton {
>                         text: i18ndc("plasma_shell_org.kde.plasma.desktop",
> "@action:button", "Shut &Down")
>                         icon.name: "system-shutdown"
>                         onClicked: sessionManagement.requestShutdown()
>                         visible: sessionManagement.canShutdown
>                     }
> 
> Will obviously get overwritten after updates

Great find, thank you.
I have added script what runs on pc restart and if this is missing it will add
it.

```
#!/bin/bash
FILE="/usr/share/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/LockScreenUi.qml"
TEMP_FILE="/tmp/LockScreenUi.qml.tmp"

if [ ! -f "$FILE" ]; then
    echo "Error: $FILE not found."
    exit 1
fi

if grep -q "sessionManagement.requestShutdown()" "$FILE"; then
    echo "Restart and Shut Down buttons are already present. No changes made."
    exit 0
fi

cp "$FILE" "${FILE}.bak"
echo "Backup created at: ${FILE}.bak"
awk '
BEGIN { in_action = 0; brackets = 0; prev = ""; }
{
    if (in_action == 0) {
        if ($0 ~ /actionItems:[ \t]*\[/ || $0 ~ /actionItems:\[/) {
            in_action = 1;
            open_c = split($0, a, "\\[") - 1;
            close_c = split($0, a, "\\]") - 1;
            brackets = open_c - close_c;
            if (prev != "") print prev;
            prev = $0;
            next;
        } else {
            if (prev != "") print prev;
            prev = $0;
            next;
        }
    }

    if (in_action == 1) {
        open_c = split($0, a, "\\[") - 1;
        close_c = split($0, a, "\\]") - 1;
        brackets += (open_c - close_c);

        if (brackets <= 0) {
            if (prev !~ /, *$/ && prev !~ /^[ \t]*$/) {
                prev = prev ",";
            }
            print prev;

            # 2. Inject our new buttons
            print "                    ActionButton {";
            print "                        text:
i18ndc(\"plasma_shell_org.kde.plasma.desktop\", \"@action:button\",
\"&Restart\")";
            print "                        icon.name: \"system-reboot\"";
            print "                        onClicked:
sessionManagement.requestReboot()";
            print "                        visible:
sessionManagement.canReboot";
            print "                    },";
            print "                    ActionButton {";
            print "                        text:
i18ndc(\"plasma_shell_org.kde.plasma.desktop\", \"@action:button\", \"Shut
&Down\")";
            print "                        icon.name: \"system-shutdown\"";
            print "                        onClicked:
sessionManagement.requestShutdown()";
            print "                        visible:
sessionManagement.canShutdown";
            print "                    }";

            in_action = 2; # Mark as finished
            prev = $0;
            next;
        } else {
            if (prev != "") print prev;
            prev = $0;
            next;
        }
    }

    if (in_action == 2) {
        if (prev != "") print prev;
        prev = $0;
    }
}
END {
    if (prev != "") print prev;
}
' "$FILE" > "$TEMP_FILE"

mv "$TEMP_FILE" "$FILE"
echo "Success! Restart and Shut Down buttons have been added to the lock
screen."
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to