Let the laptop say what it is doing: battery percentage, the lid, a fingerprint
Three surfaces the first laptop install showed were missing. The bar's battery icon gets an optional exact number beside it -- GNOME's "Show Battery Percentage", off by default for GNOME's reason, one color with the icon so it reads as one indicator. The Power page says what closing the lid does. The policy already existed (LidPolicy holds a suspend inhibitor while an external display is connected) but was surfaced nowhere, so the machine's most physical behavior was undiscoverable -- and the deliberate absence of an override deserves stating rather than leaving someone to hunt for a switch that does not exist. And the Users page grows a Fingerprint card, because fingerprint login is two systems that fail silently when they disagree: fprintd holds the enrolled prints, authselect decides whether PAM ever asks the reader. This machine arrived with a finger enrolled from its GNOME days and with-fingerprint off, which reads as "the reader is broken". The card shows both facts, flips the authselect feature through polkit with a stated reason, and hands enrollment to GNOME's Users panel, which owns the only good capture dialog -- a named exception in the handoff contract. Everything through scripts/panama-fingerprint, pinned by a stub-driven contract. Claude-Session: https://claude.ai/code/session_01Epx9ZC1gwm81K3jm9x9CKh
This commit is contained in:
@@ -130,6 +130,16 @@ Pill {
|
||||
// battery has actually been read, so this is not a zero that looks like a
|
||||
// flat cell. Same shape as the graphics field in VitalsWidget, which gates
|
||||
// on both the preference and the hardware.
|
||||
//
|
||||
// One color for the icon and the number beside it: two different colors
|
||||
// would read as two indicators.
|
||||
readonly property color batteryColor: {
|
||||
if (Battery.critical) return Theme.danger;
|
||||
if (Battery.low) return Theme.warn;
|
||||
if (Battery.charging) return Theme.ok;
|
||||
return Theme.fg;
|
||||
}
|
||||
|
||||
StatusGlyph {
|
||||
visible: Settings.showBattery && Battery.available
|
||||
glyph: {
|
||||
@@ -141,11 +151,24 @@ Pill {
|
||||
// md-battery_10 .. md-battery_90 are consecutive from F007A.
|
||||
return String.fromCodePoint(0xF007A + (level / 10) - 1);
|
||||
}
|
||||
color: {
|
||||
if (Battery.critical) return Theme.danger;
|
||||
if (Battery.low) return Theme.warn;
|
||||
if (Battery.charging) return Theme.ok;
|
||||
return Theme.fg;
|
||||
color: root.batteryColor
|
||||
}
|
||||
|
||||
// The exact number, for the people who ask the icon to be more specific --
|
||||
// GNOME's "Show Battery Percentage", living under the same gates as the
|
||||
// icon it annotates.
|
||||
Text {
|
||||
visible: Settings.showBattery && Settings.showBatteryPercent && Battery.available
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: Math.round(Battery.percent) + "%"
|
||||
color: root.batteryColor
|
||||
font.family: Theme.fontFamily
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.durFast
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,6 +381,7 @@ SettingsPage {
|
||||
// Only where there is a battery to report on. A desktop should not be
|
||||
// offered a switch for a readout it can never show.
|
||||
ToggleRow { setting: "showBattery"; visible: Battery.available }
|
||||
ToggleRow { setting: "showBatteryPercent"; visible: Battery.available && Settings.showBattery }
|
||||
ToggleRow { setting: "showAgentUsage"; divider: true }
|
||||
// Refresh interval was on the Home page, which split one concept across
|
||||
// two pages -- what the vitals show here, how often they update there.
|
||||
|
||||
@@ -121,6 +121,25 @@ SettingsPage {
|
||||
SliderRow { setting: "suspendMinutesBattery"; zeroLabel: "Never"; divider: false }
|
||||
}
|
||||
|
||||
// What the lid does. Informational by design: the decision follows what
|
||||
// is connected (see services/LidPolicy.qml), and the deliberate absence
|
||||
// of an override is part of the design -- a lid switch set to "never
|
||||
// suspend" is a laptop that cooks in a bag. Saying so here beats leaving
|
||||
// the behavior undiscoverable.
|
||||
SettingsCard {
|
||||
visible: Battery.available
|
||||
title: "When the lid closes"
|
||||
subtitle: "Decided by what is connected rather than by a setting: with an external display attached the machine is docked and keeps running; on its own it suspends, locking on the way down."
|
||||
|
||||
TextRow {
|
||||
label: "Right now"
|
||||
value: LidPolicy.inhibited
|
||||
? "Stays awake — an external display is connected"
|
||||
: "Suspends"
|
||||
divider: false
|
||||
}
|
||||
}
|
||||
|
||||
// Only shown when the numbers are actually contradictory, rather than as a
|
||||
// permanent warning nobody reads.
|
||||
SettingsCard {
|
||||
|
||||
@@ -55,7 +55,12 @@ SettingsPage {
|
||||
root.newUserIsAdministrator = false;
|
||||
}
|
||||
|
||||
Component.onCompleted: UserAccounts.refresh()
|
||||
Component.onCompleted: {
|
||||
UserAccounts.refresh();
|
||||
// Probing fprintd bus-activates it, so it waits for the page rather
|
||||
// than costing every shell launch.
|
||||
Fingerprint.refresh();
|
||||
}
|
||||
|
||||
TextRow {
|
||||
visible: UserAccounts.lastError !== ""
|
||||
@@ -260,6 +265,58 @@ SettingsPage {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Fingerprint ──────────────────────────────────────────────────────────
|
||||
//
|
||||
// Hidden in full on a machine with no reader. Two systems make this work
|
||||
// and the card keeps them honest with each other: fprintd holds the
|
||||
// enrolled prints (GNOME's Users panel owns that dialog, so enrollment
|
||||
// hands off the same way password-adjacent panels do), and authselect
|
||||
// decides whether PAM asks the reader at all -- a print enrolled while
|
||||
// that is off does nothing, which reads as "fingerprint is broken".
|
||||
|
||||
SettingsCard {
|
||||
visible: Fingerprint.readerPresent
|
||||
title: "Fingerprint"
|
||||
subtitle: Fingerprint.readerName !== ""
|
||||
? Fingerprint.readerName
|
||||
: "A fingerprint reader is present."
|
||||
|
||||
SwitchRow {
|
||||
label: "Unlock with a fingerprint"
|
||||
detail: {
|
||||
if (Fingerprint.enrolled.length === 0)
|
||||
return "Enroll a finger below first; until then the password is the only way in";
|
||||
return Fingerprint.pamEnabled
|
||||
? "The lock screen and sudo accept an enrolled finger, with the password as fallback"
|
||||
: "Enrolled fingers are ignored until this is on";
|
||||
}
|
||||
checked: Fingerprint.pamEnabled
|
||||
enabled: !Fingerprint.busy
|
||||
onToggled: value => Fingerprint.setUnlockEnabled(value)
|
||||
}
|
||||
|
||||
ActionRow {
|
||||
label: "Enrolled fingers"
|
||||
detail: Fingerprint.enrolled.length === 0
|
||||
? "None yet"
|
||||
: Fingerprint.enrolled.map(finger => Fingerprint.fingerLabel(finger)).join(", ")
|
||||
action: "Manage…"
|
||||
divider: Fingerprint.lastError !== ""
|
||||
// GNOME's Users panel owns the enrollment dialog; growing our own
|
||||
// means reimplementing a guided capture flow fprintd already has
|
||||
// a good one of.
|
||||
onTriggered: SystemSettings.openGnomePanel("system", "users")
|
||||
}
|
||||
|
||||
TextRow {
|
||||
visible: Fingerprint.lastError !== ""
|
||||
label: "Fingerprint needs attention"
|
||||
detail: Fingerprint.lastError
|
||||
value: ""
|
||||
divider: false
|
||||
}
|
||||
}
|
||||
|
||||
// ── Everyone else ────────────────────────────────────────────────────────
|
||||
|
||||
SettingsCard {
|
||||
|
||||
Reference in New Issue
Block a user