feat(quickshell): add polkit authentication agent
Registers a polkit agent for the logind session and presents its requests in
the hyprchrome panel chrome. PolkitPrompt owns the agent, the layer-shell
surface and focus; PolkitPromptContent is the headlessly renderable visual
core, staged by tests/PolkitPromptHeadless.qml.
Replaces terra's hyprpolkitagent autostart, which had been dead for a while:
the unit was never installed, so the start failed silently and the session
ran with no polkit agent at all.
Verified against a live agent — registration, the PAM conversation, retry
after a rejected attempt, and cancellation. Behaviours found by tracing that
the component now documents:
* registration is ASYNCHRONOUS, so a Component.onCompleted check reports a
false failure while a change handler cannot see a total failure at all
(a failed registration never changes the property) — hence the deadline
* a flow arrives with isResponseRequired false and an empty prompt, so the
field is still disabled when the window first becomes visible and the
re-focus on that transition is load bearing
* concurrent requests SUPERSEDE rather than queue, orphaning the older one.
Cancelling it from QML trips "QObject::connect(AuthFlow, PolkitAgentImpl):
invalid nullptr parameter" upstream and costs the live prompt as well, so
it is deliberately left alone
* Identity.id is the raw uid, not unix-user:<name>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAq2kKCLazZmrKvkd3akud
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Widgets.Polkit
|
||||
|
||||
// Offscreen render of the polkit prompt with a failed first attempt and two
|
||||
// eligible identities — the state that exercises every optional element at
|
||||
// once (picker, pam_error text, rejected-attempt border).
|
||||
//
|
||||
// ./tools/quickshell-preview/render.sh \
|
||||
// tests/PolkitPromptHeadless.qml \
|
||||
// .artifacts/quickshell-preview/polkit-prompt.png 560 320
|
||||
PolkitPromptContent {
|
||||
width: 520
|
||||
|
||||
message: "Authentication is required to install or remove software"
|
||||
actionId: "org.freedesktop.packagekit.package-install"
|
||||
iconName: "system-software-install"
|
||||
showIcon: false
|
||||
|
||||
identities: [
|
||||
{ id: "1000", displayName: "darman", isGroup: false },
|
||||
{ id: "0", displayName: "root", isGroup: false }
|
||||
]
|
||||
selectedIdentity: 0
|
||||
|
||||
responseRequired: true
|
||||
inputPrompt: "Password:"
|
||||
responseVisible: false
|
||||
response: "hunter2"
|
||||
|
||||
supplementaryMessage: "Authentication failure. 2 attempts remaining."
|
||||
supplementaryIsError: true
|
||||
failed: true
|
||||
}
|
||||
Reference in New Issue
Block a user