Skip to content

powermenu: reboot into a chosen EFI boot entry - #3568

Merged
bbedward merged 3 commits into
duxlabs-dev:masterfrom
matthewyjiang:feat/reboot-to-boot-entry
Sep 27, 2026
Merged

bbedward merged 3 commits into
duxlabs-dev:masterfrom
matthewyjiang:feat/reboot-to-boot-entry

Conversation

@matthewyjiang

@matthewyjiang matthewyjiang commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

An easy way for dual boaters to configure a "reboot into chosen os" power menu entry. requires efibootmgr.

On a UEFI machine with more than one OS, the power menu can now reboot straight into another one. The shell sets the firmware's one-time BootNext entry, so the boot after that follows the normal boot order.

  • Settings → Power & Sleep has a new Reboot to another OS card. It lists the firmware's active entries through efibootmgr and leaves out the OS that is running.
  • Each saved entry becomes a Reboot to <name> action in the power menu and the launcher. Keys 1 to 9 pick entries in the order you added them.
  • Picking one lists the entries again first. If the firmware has renumbered its entries and the saved id no longer has the saved label, a toast says so and nothing changes. Otherwise the shell runs pkexec efibootmgr --bootnext XXXX and reboots through SessionService.reboot(), so custom reboot commands still apply.
  • Setting BootNext needs root, so a polkit password prompt opens each time you pick an entry. Users who want to skip it can add the polkit rule from the docs PR (DankLinux-Docs#150, "Skipping the password"). The rule allows only efibootmgr --bootnext XXXX from an active local session.
  • When efibootmgr can't list the entries, the card says why: the system didn't boot in UEFI mode, efibootmgr is missing, or efibootmgr failed with the error it printed. Saved entries stay in the list either way. If you sync your config to a machine without them, you can still remove them there.

Docs: duxlabs-dev/dux-docs#150

Structure

There are two commits.

  1. powermenu: derive shortcuts and extra actions from one source

    Power menu shortcuts now come from the key hint each action already shows, so boot entries get 1 to 9 without key handling of their own. SessionService also keeps the list of actions added in settings, which the power menu and the launcher both read.

    It also fixes three shortcut bugs:

    • Ctrl+R rebooted. Only Ctrl+P was excluded from the action shortcuts, so Ctrl with any other action letter still fired that action. Ctrl combinations are for navigation, so none of them trigger actions now.
    • U did nothing. The menu shows U as the hint for Switch user, but no key handler matched it. It now triggers Switch user when the menu shows it.
    • Releasing any shortcut letter cancelled a hold, even a letter with no visible action. Only Enter and the shortcuts of visible actions cancel a hold now.
  2. powermenu: add actions that reboot into a chosen efi boot entry

    The feature itself. BootEntryService lists the entries, checks them, and sets BootNext. Services/BootEntries.js holds the parser for efibootmgr output and the picker's filter as pure functions.

Local testing

  • I tested everything on my own machine and it all works, including the reboot itself: picking a boot entry from the power menu set BootNext and restarted into that OS.
  • make lint-qml: passes for all three entrypoints after regenerating the local Quickshell tooling config.
  • node --test quickshell/tests/*.test.mjs: 194 pass. That includes the singleton cycle check and the new boot-entries.test.mjs.
  • boot-entries.test.mjs parses efibootmgr output in the old format and in the tab-separated format of version 18. It also checks that the picker skips the running and saved entries and appends the id to duplicate labels.
  • The generated settings search index is up to date, and the i18n term-variant check passes.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / internal cleanup
  • Documentation
  • Other

Related issues

Screenshots / video

Settings → Power & sleep, with Windows Boot Manager added:

Power and sleep settings with Windows Boot Manager saved under Reboot to another OS

Power menu with the new reboot action and its 1 shortcut:

Power menu showing Reboot to Windows Boot Manager with shortcut 1

Checklist

  • My code follows the conventions in CONTRIBUTING.md
  • I have tested my changes locally
  • New user-facing strings are wrapped in I18n.tr() with translator context, reusing existing terms where possible
  • Go changes: ran make fmt, added/updated tests, make test passes, and go mod tidy is clean. Not applicable: this PR has no Go changes.
  • QML changes: ran make lint-qml with no new warnings
  • I have opened a corresponding pull request in dlx-docs to document any new behaviors: docs: add a page for rebooting into another OS from the power menu dux-docs#150

AI disclosure

AI assistance was used to create this PR.

The power menu matched keys with a switch that repeated the key hints
getPowerActionData already returns, plus a second key list for release.
Look the pressed key up against the hints of the visible actions instead,
so every action with a hint gets its shortcut and the two cannot drift.

Side effects:
- Ctrl+letter no longer triggers actions. Only Ctrl+P was excluded
  before, so Ctrl+R still rebooted. Ctrl combinations are navigation.
- U now triggers switch user when it is shown. Its hint already said U.
- Releasing a letter with no visible action no longer cancels a hold.

SessionService now owns the custom:N action ids as customPowerActions
and extraPowerActions, which the power menu and the launcher both use.
Actions resolve by index into that list instead of slicing the prefix.
Settings → Power & Sleep gets a "Reboot to another OS" card that lists
the firmware's active EFI entries through efibootmgr. Each saved entry
becomes a "Reboot to <name>" action in the power menu and the launcher,
bound to 1-9 in the order it was added.

Picking one lists the entries again, and stops with a toast if the id no
longer carries the saved label. Otherwise it sets BootNext through pkexec
and reboots through SessionService, so custom reboot commands still apply.

BootEntryService reports why entries are unavailable: not booted in UEFI
mode, efibootmgr missing, or efibootmgr failing with its stderr. Saved
entries stay listed in settings whatever the status, so a synced config
on another machine can still remove them.

efibootmgr parsing and the picker's filtering live in BootEntries.js,
covered by tests/boot-entries.test.mjs.
@matthewyjiang
matthewyjiang force-pushed the feat/reboot-to-boot-entry branch from 939c5f5 to 384c80f Compare September 25, 2026 09:31
@matthewyjiang
matthewyjiang marked this pull request as ready for review September 25, 2026 09:36
@bbedward

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Claude review

One bug to fix before merge. The new power menu key mapping lets special keys fire actions.

  • Super, Menu, Help and F2–F10 fire Suspend, Switch user, Logout and the boot entry actions, because String.fromCharCode truncates the key code. See quickshell/Modules/PowerMenu/PowerMenuContent.qml:270
    Checked: the power menu shortcut refactor and hold/release handling, the BootEntryService process flow (pending entry, pkexec exit codes, stale id check), the SessionService extra actions, the settings card, the singleton cycle risk and the i18n usage. Model: claude-opus-5-5.

@hthienloc

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Claude review

No issues found. The special-key fix from the last review is in: actionForKey now rejects anything above Qt.Key_Z.
Checked: the power menu shortcut mapping and hold/release handling (Ctrl navigation, digit keys for boot entries), the BootEntryService list/set process flow (pending entry, refresh overlap, pkexec 126, stale id check), SessionService extra actions and index lookups, the settings card dropdown/repeater, and the i18n usage. Model: claude-opus-5-5.

@bbedward
bbedward merged commit f27627e into duxlabs-dev:master Sep 27, 2026
2 checks passed
@matthewyjiang
matthewyjiang deleted the feat/reboot-to-boot-entry branch September 29, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants