Feature: Lock and Suspend option for power button and gnome-menu
DEVICE: Pinephone Fedora 34 Rawhide Gnome-Shell 3.38.1
Feature summary
ATM the powerbutton can only be set to suspend or poweroff, but not to lock&suspend.
To make Pinephones and other mobile devices safe, a new option for the powerbutton must be made available. It needs to be made customizeable for the device, as in special pinephones have a very unique requirement atm:
It uses LightDM + Gnome-Shell ( or Phosh, but Phosh has mastered this already ). The LightDM greeter(/deviceunlocker now) has been adapted for phones, but does only lock the screen, not suspend the device.
I was able to hack an extension that does the trick for itself: (just the needed block)
Util.spawn(['/usr/bin/dm-tool', 'lock']);
let systemMenu = Main.panel.statusArea['aggregateMenu']._system;
gnomeShellVersion = Config.PACKAGE_VERSION.split(".")
if (systemMenu.hasOwnProperty('_systemActions')) {
systemMenu.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
systemMenu._systemActions.activateSuspend()
} else {
systemMenu._onSuspendClicked()
}
now this or a more general version with configureable lock cmds, needs to be executed when the power-button is pressed. As this will become a mass problem of the near future, a gnome build-in version sounds most reasonable to me.