A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
feat(flow): add corner positions (bottom-left and bottom-right) for Flow pill (#958)
unknown74efbba683e4
diff --git a/windows/src-tauri/src/flow/pill.rs b/windows/src-tauri/src/flow/pill.rsindex 5aded2a6..b0669e25 100644--- a/windows/src-tauri/src/flow/pill.rs+++ b/windows/src-tauri/src/flow/pill.rs@@ -207,16 +207,18 @@ fn window(app: &AppHandle) -> Option<WebviewWindow> {}fn size_for(edge: &str) -> (f64, f64) {- if edge == "bottom" {- BOTTOM- } else {+ if edge == "left" || edge == "right" {SIDE+ } else {+ BOTTOM}}pub fn edge_name(edge: Edge) -> &'static str {match edge {Edge::Bottom => "bottom",+ Edge::BottomLeft => "bottom-left",+ Edge::BottomRight => "bottom-right",Edge::Left => "left",Edge::Right => "right",}@@ -301,6 +303,8 @@ fn place(app: &AppHandle, pill: &Pill, edge: &str, on_cursor: bool) {let (x, y) = match edge {"left" => (ax + gap, ay + (ah - ph) / 2),"right" => (ax + aw - pw - gap, ay + (ah - ph) / 2),+ "bottom-left" => (ax + gap, ay + ah - ph - gap),+ "bottom-right" => (ax + aw - pw - gap, ay + ah - ph - gap),_ => (ax + (aw - pw) / 2, ay + ah - ph - gap),};#[cfg(target_os = "linux")]@@ -404,3 +408,23 @@ pub fn rest_after(app: &AppHandle, phase: &str, ms: u64) {});});}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn edge_names_and_sizes_match_expected() {+ assert_eq!(edge_name(Edge::Bottom), "bottom");+ assert_eq!(edge_name(Edge::BottomLeft), "bottom-left");+ assert_eq!(edge_name(Edge::BottomRight), "bottom-right");+ assert_eq!(edge_name(Edge::Left), "left");+ assert_eq!(edge_name(Edge::Right), "right");++ assert_eq!(size_for("bottom"), BOTTOM);+ assert_eq!(size_for("bottom-left"), BOTTOM);+ assert_eq!(size_for("bottom-right"), BOTTOM);+ assert_eq!(size_for("left"), SIDE);+ assert_eq!(size_for("right"), SIDE);+ }+}diff --git a/windows/src-tauri/src/flow/store.rs b/windows/src-tauri/src/flow/store.rsindex 99b38f22..4ae4b16b 100644--- a/windows/src-tauri/src/flow/store.rs+++ b/windows/src-tauri/src/flow/store.rs@@ -66,10 +66,12 @@ pub struct AppStyle {}#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]-#[serde(rename_all = "lowercase")]+#[serde(rename_all = "kebab-case")]pub enum Edge {#[default]Bottom,+ BottomLeft,+ BottomRight,Left,Right,}@@ -381,6 +383,20 @@ mod tests {let _ = std::fs::remove_dir_all(dir);}+ #[test]+ fn edge_serialization_round_trips_all_positions() {+ for (edge, s) in [+ (Edge::Bottom, "\"bottom\""),+ (Edge::BottomLeft, "\"bottom-left\""),+ (Edge::BottomRight, "\"bottom-right\""),+ (Edge::Left, "\"left\""),+ (Edge::Right, "\"right\""),+ ] {+ assert_eq!(serde_json::to_string(&edge).unwrap(), s);+ assert_eq!(serde_json::from_str::<Edge>(s).unwrap(), edge);+ }+ }+#[test]fn prefs_read_from_an_older_file_keep_their_defaults() {let p: Prefs = serde_json::from_str(r#"{"enabled":true,"key":"right_alt"}"#).unwrap();diff --git a/windows/src-tauri/src/platform/linux.rs b/windows/src-tauri/src/platform/linux.rsindex f451eefa..8f2f529d 100644--- a/windows/src-tauri/src/platform/linux.rs+++ b/windows/src-tauri/src/platform/linux.rs@@ -909,10 +909,13 @@ pub fn prepare_pill_window(win: &WebviewWindow, mode: super::DesktopMode) -> boopub fn set_pill_edge(win: &WebviewWindow, edge: &str) {let Ok(gw) = win.gtk_window() else { return };let ptr = gtk_window_ptr(&gw);+ let bottom = edge == "bottom" || edge == "bottom-left" || edge == "bottom-right";+ let left = edge == "left" || edge == "bottom-left";+ let right = edge == "right" || edge == "bottom-right";unsafe {- layer::gtk_layer_set_anchor(ptr, layer::EDGE_BOTTOM, (edge == "bottom") as i32);- layer::gtk_layer_set_anchor(ptr, layer::EDGE_LEFT, (edge == "left") as i32);- layer::gtk_layer_set_anchor(ptr, layer::EDGE_RIGHT, (edge == "right") as i32);+ layer::gtk_layer_set_anchor(ptr, layer::EDGE_BOTTOM, bottom as i32);+ layer::gtk_layer_set_anchor(ptr, layer::EDGE_LEFT, left as i32);+ layer::gtk_layer_set_anchor(ptr, layer::EDGE_RIGHT, right as i32);layer::gtk_layer_set_anchor(ptr, layer::EDGE_TOP, 0);}}diff --git a/windows/src/core/flow.ts b/windows/src/core/flow.tsindex 8464e65a..dff236a4 100644--- a/windows/src/core/flow.ts+++ b/windows/src/core/flow.ts@@ -21,7 +21,7 @@ async function callOrThrow<T>(cmd: string, args?: Record<string, unknown>): Prom}export type FlowKey = "right_ctrl" | "right_alt" | "right_shift" | "left_ctrl_super";-export type Edge = "bottom" | "left" | "right";+export type Edge = "bottom" | "bottom-left" | "bottom-right" | "left" | "right";export type Style = "verbatim" | "natural" | "polished";export interface FlowPrefs {diff --git a/windows/src/hub/pages/flowsettings.ts b/windows/src/hub/pages/flowsettings.tsindex f195ba55..e136cf6d 100644--- a/windows/src/hub/pages/flowsettings.ts+++ b/windows/src/hub/pages/flowsettings.ts@@ -67,7 +67,7 @@ export async function flowSettingsPage(page: HTMLElement, ctx: HubContext) {["right_shift", t("Right {0}", { 0: "Shift" })],["left_ctrl_super", status.platform === "windows" ? "Ctrl + Win" : "Ctrl + Super"],];- const edges: [Edge, string][] = [["bottom", t("Bottom")], ["left", t("Left")], ["right", t("Right")]];+ const edges: [Edge, string][] = [["bottom", t("Bottom")], ["bottom-left", t("Bottom-left")], ["bottom-right", t("Bottom-right")], ["left", t("Left")], ["right", t("Right")]];page.append(label(t("Keys")));const keysCard = card(row(t("Hold a key to dictate anywhere"), null, toggle(prefs.enabled, (on) => void ctx.setPrefs((p) => (p.enabled = on)))),diff --git a/windows/src/i18n/extra.json b/windows/src/i18n/extra.jsonindex d765066d..e26db37e 100644--- a/windows/src/i18n/extra.json+++ b/windows/src/i18n/extra.json@@ -7218,6 +7218,36 @@"tr": "Anahtar yok: sohbet yukarıdaki Claude aboneliğinizi kullanabilir.","ko": "키 없음: 채팅은 위의 Claude 구독을 사용할 수 있습니다.","ja": "キーなし: チャットは上の Claude サブスクリプションを使えます。"+ },+ "Bottom-left": {+ "zh-Hans": "左下",+ "hi": "नीचे-बाएँ",+ "es": "Abajo a la izquierda",+ "ar": "أسفل اليسار",+ "fr": "Bas gauche",+ "bn": "নিচে-বামে",+ "pt-BR": "Inferior esquerdo",+ "ru": "Снизу слева",+ "id": "Bawah-kiri",+ "de": "Unten links",+ "tr": "Sol alt",+ "ko": "왼쪽 아래",+ "ja": "左下"+ },+ "Bottom-right": {+ "zh-Hans": "右下",+ "hi": "नीचे-दाएँ",+ "es": "Abajo a la derecha",+ "ar": "أسفل اليمين",+ "fr": "Bas droite",+ "bn": "নিচে-ডানে",+ "pt-BR": "Inferior direito",+ "ru": "Снизу справа",+ "id": "Bawah-kanan",+ "de": "Unten rechts",+ "tr": "Sağ alt",+ "ko": "오른쪽 아래",+ "ja": "右下"}}}diff --git a/windows/src/pill/main.ts b/windows/src/pill/main.tsindex afbaab67..cf08555f 100644--- a/windows/src/pill/main.ts+++ b/windows/src/pill/main.ts@@ -81,7 +81,7 @@ function look(): Look {}}-const vertical = () => state.edge !== "bottom";+const vertical = () => state.edge === "left" || state.edge === "right";function messageText(): string | null {switch (state.phase) {@@ -292,6 +292,14 @@ function reportHot() {const w = open ? 200 : 96;const h = open ? 46 : 26;rects.push([(W - w) / 2, H - h, w, h]);+ } else if (state.edge === "bottom-left") {+ const w = open ? 200 : 96;+ const h = open ? 46 : 26;+ rects.push([0, H - h, w, h]);+ } else if (state.edge === "bottom-right") {+ const w = open ? 200 : 96;+ const h = open ? 46 : 26;+ rects.push([W - w, H - h, w, h]);} else {const w = open ? 46 : 26;const h = open ? 200 : 96;diff --git a/windows/src/pill/pill.css b/windows/src/pill/pill.cssindex 4d111241..33459c17 100644--- a/windows/src/pill/pill.css+++ b/windows/src/pill/pill.css@@ -34,6 +34,22 @@ body {padding-bottom: 2px;}+#pill.bottom-left {+ flex-direction: column;+ align-items: flex-start;+ justify-content: flex-end;+ padding-bottom: 2px;+ padding-left: 2px;+}++#pill.bottom-right {+ flex-direction: column;+ align-items: flex-end;+ justify-content: flex-end;+ padding-bottom: 2px;+ padding-right: 2px;+}+#pill.left {flex-direction: row;align-items: center;