arelange / gnome-shell-extension-hibernate-status

Gnome Shell extension that adds a hibernate/hybrid suspend button in Status menu.
GNU General Public License v2.0
156 stars 58 forks source link

custom reboot #119

Open slaclau opened 6 months ago

slaclau commented 6 months ago

Addresses #112

City-busz commented 6 months ago

I don't think that quick reboot functionality is good in the current form. Regenerating the grub config needs extra caution, because it can break boot, especially with custom configs. And the timeout will remain disabled if e.g. the user logs in into a session other than GNOME after reboot, or not authenticated to run the command to reconfigure grub.

I think it would better to drop this functionality.

slaclau commented 6 months ago

The code in its current from mostly comes from https://extensions.gnome.org/extension/5542/custom-reboot/, I do agree about the issue with disabling the timeout

City-busz commented 6 months ago

Generally, I think it would better to implement this functionality based on the D-Bus interface of systemd-logind. You can get the boot loader entries by reading BootLoaderEntries, and there is a SetRebootToBootLoaderEntry() method.

UPDATE: However, BootLoaderEntries just gives the list of IDs, but not the titles, so the current code that process the output of bootctl list gives better result.

For the reboot, it would better to use the SetRebootToBootLoaderEntry() D-Bus method (or the command systemctl reboot --boot-loader-entry=ID), because it does not require to be authenticated as root, since reboot is allowed for all users by default. But it needs some refactoring, a custom reboot dialog is needed for this feature.