Commit 68e98aefce16

Vincent Demeester <vincent@sbr.pm>
2026-08-03 11:46:45
feat(pi): adaptive footer for narrow terminals
Progressively dropped footer components based on terminal width to avoid unreadable truncation on small screens.
1 parent 23ea580
Changed files (1)
dots
pi
agent
dots/pi/agent/extensions/custom-footer.ts
@@ -340,22 +340,17 @@ export default function (pi: ExtensionAPI) {
 						.filter(([key, val]: [string, string]) => key !== "mode" && key !== "mode-color" && Boolean(val))
 						.map(([, val]: [string, string]) => val);
 
-					// Combine components with separators
-					// Format: 16:10  🖥️ kyushu  ~/s/home  main  google-vertex/sonnet-4.5  🧠 ext  76.2%/200k (auto)  [extension statuses]
-					const components = [
-						timeText,
-						`${hostIcon} ${hostText}`,
-						folderText,
-						gitBranch,
-						modeText,
-						providerModel,
-						thinkingText,
-						contextText,
-						...statusTexts, // Add extension statuses at the end
-					].filter(Boolean); // Remove empty strings
+					// Adaptive footer: progressively drop components on narrow terminals
+					const components = width < 60
+						? [timeText, modeText, contextText]
+						: width < 80
+						? [timeText, folderText, gitBranch, modeText, providerModel, contextText]
+						: width < 100
+						? [timeText, `${hostIcon} ${hostText}`, folderText, gitBranch, modeText, providerModel, contextText]
+						: [timeText, `${hostIcon} ${hostText}`, folderText, gitBranch, modeText, providerModel, thinkingText, contextText, ...statusTexts];
 
 					const separator = theme.fg("dim", "  ");
-					const footer = components.join(separator);
+					const footer = components.filter(Boolean).join(separator);
 
 					return [truncateToWidth(footer, width)];
 					} catch { return [""]; }
@@ -429,22 +424,17 @@ export default function (pi: ExtensionAPI) {
 					const statusTexts = Array.from(extensionStatuses.entries())
 						.filter(([key, val]: [string, string]) => key !== "mode" && key !== "mode-color" && Boolean(val))
 						.map(([, val]: [string, string]) => val);
-					// Combine components with separators
-					// Format: 16:10  🖥️ kyushu  ~/s/home  main  google-vertex/sonnet-4.5  🧠 ext  76.2%/200k (auto)
-					const components = [
-						timeText,
-						`${hostIcon} ${hostText}`,
-						folderText,
-						gitBranch,
-						modeText,
-						providerModel,
-						thinkingText,
-						contextText,
-						...statusTexts,
-					].filter(Boolean);
+					// Adaptive footer: progressively drop components on narrow terminals
+					const components = width < 60
+						? [timeText, modeText, contextText]
+						: width < 80
+						? [timeText, folderText, gitBranch, modeText, providerModel, contextText]
+						: width < 100
+						? [timeText, `${hostIcon} ${hostText}`, folderText, gitBranch, modeText, providerModel, contextText]
+						: [timeText, `${hostIcon} ${hostText}`, folderText, gitBranch, modeText, providerModel, thinkingText, contextText, ...statusTexts];
 
 					const separator = theme.fg("dim", "  ");
-					const footer = components.join(separator);
+					const footer = components.filter(Boolean).join(separator);
 
 					return [truncateToWidth(footer, width)];
 					} catch { return [""]; }