forked from Blendman974/faceclaw
Add R1 ring battery indicator
This commit is contained in:
1 parent
92d5857c3e
commit
adf9fa89c4
10 files changed
+111
-32
No files matched your search
@@ -101,7 +101,7 @@ export type ShellChromeState = {
|
||||
/** Height mode of the foreground window; decides where its top bar sits. */
|
||||
foregroundHeightMode: WindowHeightMode;
|
||||
foregroundAppId?: string;
|
||||
battery: { headset: number | null; headsetCharging: boolean | null };
|
||||
battery: { headset: number | null; headsetCharging: boolean | null; ring: number | null; ringCharging: boolean | null };
|
||||
/** App-provided tray images, drawn between notification icons and batteries. */
|
||||
trayIcons: GrayImage[];
|
||||
};
|
||||
@@ -336,7 +336,7 @@ export class ShellChromeLayer implements Layer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Labelled battery indicators for the phone and the G2, right-aligned in
|
||||
* Labelled battery indicators for the phone, G2, and R1, right-aligned in
|
||||
* the top bar, following the dashboard card's icon/percentage setting.
|
||||
* Returns the left edge of the battery block.
|
||||
*/
|
||||
@@ -352,6 +352,10 @@ export class ShellChromeLayer implements Layer {
|
||||
if (state.battery.headset !== null && Number.isFinite(state.battery.headset)) {
|
||||
items.push({ label: "G2", percent: state.battery.headset, charging: Boolean(state.battery.headsetCharging) });
|
||||
}
|
||||
if (state.battery.ring !== null && Number.isInteger(state.battery.ring)
|
||||
&& state.battery.ring >= 0 && state.battery.ring <= 100) {
|
||||
items.push({ label: "R1", percent: state.battery.ring, charging: Boolean(state.battery.ringCharging) });
|
||||
}
|
||||
if (!items.length) return G2_LENS_WIDTH;
|
||||
|
||||
const labelGap = 5;
|
||||
|
||||
@@ -299,7 +299,7 @@ class Shell {
|
||||
private lastInputAtMs = Date.now();
|
||||
/** The most recent input event received, for windows gaining focus (see ShellWindow.onFocus). */
|
||||
private lastInput: InputEvent | null = null;
|
||||
private battery: ShellChromeState["battery"] = { headset: null, headsetCharging: null };
|
||||
private battery: ShellChromeState["battery"] = { headset: null, headsetCharging: null, ring: null, ringCharging: null };
|
||||
private attention = new Map<string, boolean>();
|
||||
// App-provided top-bar tray icons, keyed by owner id; drawn between the
|
||||
// notification icons and the battery indicators.
|
||||
|
||||
Reference in new issue
Block a user