powermenu: support user-defined custom power buttons#2916
Open
FormalSnake wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
customPowerButtonsarray setting: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 existingcustomPowerAction*overrides in SessionService. Icons are Material Symbols names, labels are user content and shown untranslated. The setting itself is declared inSettingsSpec.js/SettingsData.qmllike any other spec-backed setting and defaults to[], so existing configs are unaffected.PowerMenuModalmaps entries tocustom:Naction ids resolved ingetActionData/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-qmlharness needs the.qmlls.inia running shell generates, which this checkout doesn't have.