Stop asking for a restart after the machine has restarted
Release / release (push) Successful in 27s

CoreDesktop only removes reboot-needed at the start of the next update, so
the restart item stayed after a reboot. Ignore the flag when it was written
before the current boot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 19:39:27 -07:00
co-authored by Claude Opus 5.5
parent 3e5d23c25f
commit af81a8ccc5
3 changed files with 24 additions and 2 deletions
+1 -1
View File
@@ -345,7 +345,7 @@ class Indicator extends PanelMenu.Button {
this._header.versionLabel.text = version ?? (Cli.isInstalled()
? 'Version unknown' : 'CoreDesktop isn\'t installed');
this._rebootNeeded = GLib.file_test(Cli.REBOOT_NEEDED, GLib.FileTest.EXISTS);
this._rebootNeeded = Cli.rebootNeeded();
this._lastUpdate = Cli.mtime(Cli.PACMAN_UPDATE_LOG);
const names = await Cli.installedSiblings();
+22
View File
@@ -207,6 +207,28 @@ export function mtime(path) {
}
}
// When this boot started, in seconds since the epoch, from btime in /proc/stat
export function bootTime() {
try {
const [, contents] = GLib.file_get_contents('/proc/stat');
const match = new TextDecoder().decode(contents).match(/^btime (\d+)$/m);
return match ? Number(match[1]) : null;
} catch {
return null;
}
}
// Whether the last update asked for a restart that hasn't happened yet.
// CoreDesktop only removes the flag at the start of the next update, so a
// flag written before this boot is already satisfied.
export function rebootNeeded() {
const flagged = mtime(REBOOT_NEEDED);
if (flagged === null)
return false;
const booted = bootTime();
return booted === null || flagged >= booted;
}
export function findTerminal(preference) {
if (preference && preference !== 'auto') {
if (GLib.find_program_in_path(preference))