Skip to content

powermenu: support user-defined custom power buttons#2916

Open
FormalSnake wants to merge 1 commit into
AvengeMedia:masterfrom
FormalSnake:feat/custom-power-buttons
Open

powermenu: support user-defined custom power buttons#2916
FormalSnake wants to merge 1 commit into
AvengeMedia:masterfrom
FormalSnake:feat/custom-power-buttons

Conversation

@FormalSnake

@FormalSnake FormalSnake commented Jul 23, 2026

Copy link
Copy Markdown

The power menu only offers the built-in actions (Lock/Logout/Suspend/Hibernate/Reboot/Power Off/Restart DMS/Switch User). The customPowerActionReboot-style settings can change what a built-in does, but there is no way to add a new entry. My case: I dual boot, and I want a "reboot into Windows" button (systemctl reboot --boot-loader-entry=auto-windows) without hijacking the normal reboot button or keeping a script outside the shell.

This adds a customPowerButtons array setting:

"customPowerButtons": [
  { "label": "Windows", "icon": "desktop_windows", "command": "systemctl reboot --boot-loader-entry=auto-windows" }
]

Each entry renders after the built-ins in both list and grid layout with the same styling, participates in grid sizing and keyboard navigation, and gets the same hold-to-confirm flow as reboot. Commands run detached via sh -c, same as the existing customPowerAction* overrides in SessionService. Icons are Material Symbols names, labels are user content and shown untranslated. The setting itself is declared in SettingsSpec.js/SettingsData.qml like any other spec-backed setting and defaults to [], so existing configs are unaffected. PowerMenuModal maps entries to custom:N action ids resolved in getActionData/executeAction.

I left the lock screen's own power menu alone on purpose: running arbitrary configured commands from a locked session doesn't seem like something we want. The ControlCenter and DankBar power buttons open this modal anyway, so they pick the custom buttons up automatically. Config file only for now, no settings UI page.

Verified with qmllint (identical diagnostics to master, just the pre-existing unresolved-import noise you get when linting outside the shell's VFS), qmlformat, and the repo pre-commit hooks. The full make lint-qml harness needs the .qmlls.ini a running shell generates, which this checkout doesn't have.

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.

1 participant