Skip to content

A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.

TypeScript

feat(desktop): hide the rose and open the chat full screen

Alan Buscaglia8b274edc35aa
diff --git a/apps/desktop/src-tauri/build.rs b/apps/desktop/src-tauri/build.rs
index 00e88c5..3c85eee 100644
--- a/apps/desktop/src-tauri/build.rs
+++ b/apps/desktop/src-tauri/build.rs
@@ -7,6 +7,9 @@ const COMMANDS: &[&str] = &[
"toggle_panel",
"hide_panel",
"set_dot_state",
+ "rose_hidden",
+ "set_rose_hidden",
+ "set_panel_fullscreen",
"computer_endpoint",
"computer_permissions",
"computer_request_permission",
diff --git a/apps/desktop/src-tauri/capabilities/default.json b/apps/desktop/src-tauri/capabilities/default.json
index d9f5b9e..bac9a4a 100644
--- a/apps/desktop/src-tauri/capabilities/default.json
+++ b/apps/desktop/src-tauri/capabilities/default.json
@@ -1,7 +1,7 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
- "description": "What the Dot and panel UI may call: event listening, Dot dragging, opening web pages (sign-in), the four shell commands, and the computer-control commands (yolo mode included: its native confirmation decides).",
+ "description": "What the Dot and panel UI may call: event listening, Dot dragging, opening web pages (sign-in), the shell commands (hiding the rose and the full-screen panel included), and the computer-control commands (yolo mode included: its native confirmation decides).",
"windows": ["dot", "panel"],
"permissions": [
"core:event:allow-listen",
@@ -12,6 +12,9 @@
"allow-toggle-panel",
"allow-hide-panel",
"allow-set-dot-state",
+ "allow-rose-hidden",
+ "allow-set-rose-hidden",
+ "allow-set-panel-fullscreen",
"allow-computer-endpoint",
"allow-computer-permissions",
"allow-computer-request-permission",
diff --git a/apps/desktop/src-tauri/permissions/autogenerated/rose_hidden.toml b/apps/desktop/src-tauri/permissions/autogenerated/rose_hidden.toml
new file mode 100644
index 0000000..a53131b
--- /dev/null
+++ b/apps/desktop/src-tauri/permissions/autogenerated/rose_hidden.toml
@@ -0,0 +1,11 @@
+# Automatically generated - DO NOT EDIT!
+
+[[permission]]
+identifier = "allow-rose-hidden"
+description = "Enables the rose_hidden command without any pre-configured scope."
+commands.allow = ["rose_hidden"]
+
+[[permission]]
+identifier = "deny-rose-hidden"
+description = "Denies the rose_hidden command without any pre-configured scope."
+commands.deny = ["rose_hidden"]
diff --git a/apps/desktop/src-tauri/permissions/autogenerated/set_panel_fullscreen.toml b/apps/desktop/src-tauri/permissions/autogenerated/set_panel_fullscreen.toml
new file mode 100644
index 0000000..9aa9e0f
--- /dev/null
+++ b/apps/desktop/src-tauri/permissions/autogenerated/set_panel_fullscreen.toml
@@ -0,0 +1,11 @@
+# Automatically generated - DO NOT EDIT!
+
+[[permission]]
+identifier = "allow-set-panel-fullscreen"
+description = "Enables the set_panel_fullscreen command without any pre-configured scope."
+commands.allow = ["set_panel_fullscreen"]
+
+[[permission]]
+identifier = "deny-set-panel-fullscreen"
+description = "Denies the set_panel_fullscreen command without any pre-configured scope."
+commands.deny = ["set_panel_fullscreen"]
diff --git a/apps/desktop/src-tauri/permissions/autogenerated/set_rose_hidden.toml b/apps/desktop/src-tauri/permissions/autogenerated/set_rose_hidden.toml
new file mode 100644
index 0000000..1720b98
--- /dev/null
+++ b/apps/desktop/src-tauri/permissions/autogenerated/set_rose_hidden.toml
@@ -0,0 +1,11 @@
+# Automatically generated - DO NOT EDIT!
+
+[[permission]]
+identifier = "allow-set-rose-hidden"
+description = "Enables the set_rose_hidden command without any pre-configured scope."
+commands.allow = ["set_rose_hidden"]
+
+[[permission]]
+identifier = "deny-set-rose-hidden"
+description = "Denies the set_rose_hidden command without any pre-configured scope."
+commands.deny = ["set_rose_hidden"]
diff --git a/apps/desktop/src-tauri/src/geometry.rs b/apps/desktop/src-tauri/src/geometry.rs
index c77f5ce..239886a 100644
--- a/apps/desktop/src-tauri/src/geometry.rs
+++ b/apps/desktop/src-tauri/src/geometry.rs
@@ -129,6 +129,44 @@ pub fn place_panel(dot: Rect, panel: (i32, i32), monitor: Rect, gap: i32, margin
)
}
+/// Places the panel when the rose is hidden (S26.1): back at its remembered
+/// spot when that lies on the current display (pulled inside it), otherwise at
+/// the right edge of the current display, vertically centered.
+pub fn place_panel_alone(
+ remembered: Option<(i32, i32)>,
+ panel: (i32, i32),
+ current: Rect,
+ margin: i32,
+) -> (i32, i32) {
+ let (width, height) = panel;
+ match remembered {
+ Some((x, y)) if current.contains(Rect::new(x, y, width, height).center()) => (
+ clamp_span(x, width, current.x, current.right(), margin),
+ clamp_span(y, height, current.y, current.bottom(), margin),
+ ),
+ _ => default_dot_position(current, panel, margin),
+ }
+}
+
+/// The frame of the full-screen panel (S26.2): the work area of the display
+/// it is on, so the menu bar and the Dock stay visible.
+pub fn full_screen_rect(panel: Rect, monitors: &[Rect]) -> Option<Rect> {
+ monitor_for(panel, monitors)
+}
+
+/// The frame to return to from full screen: the one before, kept on a display
+/// that still exists.
+pub fn restore_rect(before: Rect, monitors: &[Rect], margin: i32) -> Rect {
+ let Some(m) = monitor_for(before, monitors) else {
+ return before;
+ };
+ Rect {
+ x: clamp_span(before.x, before.width, m.x, m.right(), margin),
+ y: clamp_span(before.y, before.height, m.y, m.bottom(), margin),
+ ..before
+ }
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -249,6 +287,38 @@ mod tests {
assert_eq!(place_panel(dot(12, 500), (420, 640), SCREEN, 8, 12), (76, 208));
}
+ #[test]
+ fn panel_without_the_rose_returns_to_its_remembered_spot_on_the_current_display() {
+ assert_eq!(place_panel_alone(Some((300, 200)), (420, 640), SCREEN, 12), (300, 200));
+ // A spot partly off the display is pulled back inside it.
+ assert_eq!(place_panel_alone(Some((1700, 600)), (420, 640), SCREEN, 12), (1488, 428));
+ }
+
+ #[test]
+ fn panel_without_the_rose_defaults_to_the_right_edge_of_the_current_display() {
+ assert_eq!(place_panel_alone(None, (420, 640), SCREEN, 12), (1488, 220));
+ // A spot remembered on another display does not drag the panel there.
+ let right = Rect::new(1920, -200, 2560, 1440);
+ assert_eq!(place_panel_alone(Some((300, 200)), (420, 640), right, 12), (4048, 200));
+ }
+
+ #[test]
+ fn full_screen_fills_the_work_area_of_the_panel_display() {
+ let right = Rect::new(1920, -200, 2560, 1440);
+ assert_eq!(full_screen_rect(Rect::new(1424, 208, 420, 640), &[SCREEN, right]), Some(SCREEN));
+ assert_eq!(full_screen_rect(Rect::new(2000, 0, 420, 640), &[SCREEN, right]), Some(right));
+ assert_eq!(full_screen_rect(Rect::new(0, 0, 420, 640), &[]), None);
+ }
+
+ #[test]
+ fn restoring_from_full_screen_returns_to_the_previous_frame() {
+ let before = Rect::new(1424, 208, 420, 640);
+ assert_eq!(restore_rect(before, &[SCREEN], 12), before);
+ // The display it was on is gone: same size, moved onto the nearest one that remains.
+ assert_eq!(restore_rect(Rect::new(2500, 100, 420, 640), &[SCREEN], 12), Rect::new(1488, 100, 420, 640));
+ assert_eq!(restore_rect(before, &[], 12), before);
+ }
+
#[test]
fn panel_is_clamped_to_the_monitor() {
assert_eq!(place_panel(dot(12, 12), (420, 640), SCREEN, 8, 12), (76, 12));
diff --git a/apps/desktop/src-tauri/src/position.rs b/apps/desktop/src-tauri/src/position.rs
index 0a9c2d6..beeca6f 100644
--- a/apps/desktop/src-tauri/src/position.rs
+++ b/apps/desktop/src-tauri/src/position.rs
@@ -1,4 +1,5 @@
-//! Persistence of the Dot position in `<data dir>/desktop.json`.
+//! Persistence of the Dot in `<data dir>/desktop.json`: its position and
+//! whether the user hid it (S26.1). Each write keeps the other field.
use serde::{Deserialize, Serialize};
use std::io;
@@ -15,23 +16,44 @@ pub struct DotPosition {
struct DesktopState {
/// Older builds saved `dot` in physical pixels; that key is ignored.
dot_points: Option<DotPosition>,
+ /// Missing in files written before the rose could be hidden.
+ #[serde(default)]
+ rose_hidden: bool,
}
-/// The saved position, or `None` when the file is missing or unreadable.
-pub fn load(path: &Path) -> Option<DotPosition> {
+fn read(path: &Path) -> Option<DesktopState> {
let text = std::fs::read_to_string(path).ok()?;
- serde_json::from_str::<DesktopState>(&text).ok()?.dot_points
+ serde_json::from_str(&text).ok()
}
-pub fn save(path: &Path, position: DotPosition) -> io::Result<()> {
+fn write(path: &Path, state: &DesktopState) -> io::Result<()> {
if let Some(dir) = path.parent() {
std::fs::create_dir_all(dir)?;
}
- let state = DesktopState { dot_points: Some(position) };
- let json = serde_json::to_string_pretty(&state).map_err(io::Error::other)?;
+ let json = serde_json::to_string_pretty(state).map_err(io::Error::other)?;
std::fs::write(path, json + "\n")
}
+/// The saved position, or `None` when the file is missing or unreadable.
+pub fn load(path: &Path) -> Option<DotPosition> {
+ read(path)?.dot_points
+}
+
+pub fn save(path: &Path, position: DotPosition) -> io::Result<()> {
+ let state = read(path).unwrap_or_default();
+ write(path, &DesktopState { dot_points: Some(position), ..state })
+}
+
+/// Whether the user hid the rose; false when the file is missing or unreadable.
+pub fn load_rose_hidden(path: &Path) -> bool {
+ read(path).is_some_and(|state| state.rose_hidden)
+}
+
+pub fn save_rose_hidden(path: &Path, hidden: bool) -> io::Result<()> {
+ let state = read(path).unwrap_or_default();
+ write(path, &DesktopState { rose_hidden: hidden, ..state })
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -63,6 +85,36 @@ mod tests {
assert_eq!(load(&file), None);
}
+ #[test]
+ fn the_rose_is_shown_unless_the_file_says_hidden() {
+ let dir = scratch("rose-default");
+ assert!(!load_rose_hidden(&dir.join("absent.json")));
+ // Files written before the rose could be hidden still load, position included.
+ let old = dir.join("old.json");
+ fs::write(&old, r#"{ "dot_points": { "x": 12, "y": 400 } }"#).unwrap();
+ assert!(!load_rose_hidden(&old));
+ assert_eq!(load(&old), Some(DotPosition { x: 12, y: 400 }));
+ let corrupt = dir.join("corrupt.json");
+ fs::write(&corrupt, "{ nope").unwrap();
+ assert!(!load_rose_hidden(&corrupt));
+ }
+
+ #[test]
+ fn hiding_the_rose_is_remembered_and_keeps_the_position() {
+ let file = scratch("rose-hidden").join("desktop.json");
+ fs::write(&file, "{}").unwrap();
+ save(&file, DotPosition { x: 1852, y: 12 }).unwrap();
+ save_rose_hidden(&file, true).unwrap();
+ assert!(load_rose_hidden(&file));
+ assert_eq!(load(&file), Some(DotPosition { x: 1852, y: 12 }));
+ // Moving the Dot later keeps the choice, and showing it again is remembered too.
+ save(&file, DotPosition { x: 12, y: 300 }).unwrap();
+ assert!(load_rose_hidden(&file));
+ save_rose_hidden(&file, false).unwrap();
+ assert!(!load_rose_hidden(&file));
+ assert_eq!(load(&file), Some(DotPosition { x: 12, y: 300 }));
+ }
+
#[test]
fn missing_file_yields_none() {
assert_eq!(load(&scratch("missing").join("absent.json")), None);
diff --git a/apps/desktop/src-tauri/src/shell.rs b/apps/desktop/src-tauri/src/shell.rs
index 1a64568..9aa1f4d 100644
--- a/apps/desktop/src-tauri/src/shell.rs
+++ b/apps/desktop/src-tauri/src/shell.rs
@@ -1,5 +1,5 @@
//! Tauri wiring: windows, commands, tray menu, global shortcut, Dot snapping,
-//! and the daemon lifecycle (design §9).
+//! hiding the rose, the full-screen panel, and the daemon lifecycle (design §9).
use crate::computer::app as computer;
use crate::computer::session::Reason;
@@ -9,7 +9,9 @@ use crate::geometry::{self, Rect};
use crate::platform::{self, LaunchRequest, Os, DOT_TITLE, PANEL_TITLE};
use crate::position::{self, DotPosition};
use crate::status::{is_template, tray_status, TrayGlyph};
-use std::sync::{mpsc, Arc};
+use std::path::PathBuf;
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::{mpsc, Arc, Mutex};
use std::thread;
use std::time::Duration;
use tauri::image::Image;
@@ -45,6 +47,48 @@ struct Shell {
snap: mpsc::Sender<()>,
/// False on native Wayland, where the compositor places windows (Hyprland window rules).
places_windows: bool,
+ /// The user hid the Dot window (S26.1); saved in `desktop.json`.
+ rose_hidden: AtomicBool,
+ /// Where the panel was when it was last hidden, for placing it without the Dot.
+ panel_spot: Mutex<Option<(i32, i32)>>,
+ /// While the panel fills the screen (S26.2): its frame before, to restore.
+ full_screen: Mutex<Option<Rect>>,
+}
+
+/// The tray's rose item, relabeled when the rose is hidden or shown.
+struct RoseMenuItem(MenuItem<tauri::Wry>);
+
+/// Where `show_panel` puts the panel.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+enum Placement {
+ /// Leave it where it is: full screen, or a compositor that places windows itself.
+ Keep,
+ BesideDot,
+ /// The rose is hidden: the remembered spot or the default one on the current display.
+ Alone,
+}
+
+/// Opening the panel never depends on the Dot window being visible.
+fn panel_placement(places_windows: bool, full_screen: bool, rose_hidden: bool) -> Placement {
+ if !places_windows || full_screen {
+ Placement::Keep
+ } else if rose_hidden {
+ Placement::Alone
+ } else {
+ Placement::BesideDot
+ }
+}
+
+fn rose_menu_label(hidden: bool) -> &'static str {
+ if hidden {
+ "Show the rose"
+ } else {
+ "Hide the rose"
+ }
+}
+
+fn desktop_file(config: &DesktopConfig) -> PathBuf {
+ config.data_dir.join("desktop.json")
}
type CommandResult<T = ()> = Result<T, String>;
@@ -88,7 +132,67 @@ fn toggle_panel(app: AppHandle) -> CommandResult {
#[tauri::command]
fn hide_panel(app: AppHandle) -> CommandResult {
- window(&app, PANEL)?.hide().map_err(err)
+ let panel = window(&app, PANEL)?;
+ let shell = app.state::<Shell>();
+ if shell.full_screen.lock().unwrap().is_none() {
+ if let Ok(rect) = rect_of(&panel) {
+ *shell.panel_spot.lock().unwrap() = Some((rect.x, rect.y));
+ }
+ }
+ panel.hide().map_err(err)
+}
+
+#[tauri::command]
+fn rose_hidden(app: AppHandle) -> bool {
+ rose_hidden_state(&app)
+}
+
+/// Hides or shows the Dot window and remembers the choice. Returns whether it is hidden.
+#[tauri::command]
+fn set_rose_hidden(app: AppHandle, hidden: bool) -> CommandResult<bool> {
+ let shell = app.state::<Shell>();
+ position::save_rose_hidden(&desktop_file(&shell.config), hidden).map_err(err)?;
+ shell.rose_hidden.store(hidden, Ordering::SeqCst);
+ let dot = window(&app, DOT)?;
+ if hidden {
+ dot.hide().map_err(err)?;
+ } else {
+ dot.show().map_err(err)?;
+ }
+ if let Some(item) = app.try_state::<RoseMenuItem>() {
+ item.0.set_text(rose_menu_label(hidden)).map_err(err)?;
+ }
+ app.emit("dot://rose", serde_json::json!({ "hidden": hidden })).map_err(err)?;
+ Ok(hidden)
+}
+
+/// Fills the work area of the panel's display, or returns to the frame before (S26.2).
+/// It stays an accessory window, never a separate macOS fullscreen Space. Returns the new state.
+#[tauri::command]
+fn set_panel_fullscreen(app: AppHandle, on: bool) -> CommandResult<bool> {
+ let panel = window(&app, PANEL)?;
+ let shell = app.state::<Shell>();
+ let mut full_screen = shell.full_screen.lock().unwrap();
+ let monitors = monitor_rects(&panel)?;
+ match (on, *full_screen) {
+ (true, None) => {
+ let before = rect_of(&panel)?;
+ let Some(area) = geometry::full_screen_rect(before, &monitors) else {
+ return Ok(false);
+ };
+ // GTK keeps a non-resizable window at its content size.
+ #[cfg(target_os = "linux")]
+ panel.set_resizable(true).map_err(err)?;
+ set_frame(&panel, area)?;
+ *full_screen = Some(before);
+ }
+ (false, Some(before)) => {
+ set_frame(&panel, geometry::restore_rect(before, &monitors, EDGE_MARGIN))?;
+ *full_screen = None;
+ }
+ _ => {}
+ }
+ Ok(full_screen.is_some())
}
#[tauri::command]
@@ -126,6 +230,21 @@ fn move_to(window: &WebviewWindow, (x, y): (i32, i32)) -> CommandResult {
window.set_position(LogicalPosition::new(f64::from(x), f64::from(y))).map_err(err)
}
+fn set_frame(window: &WebviewWindow, rect: Rect) -> CommandResult {
+ window.set_size(LogicalSize::new(f64::from(rect.width), f64::from(rect.height))).map_err(err)?;
+ move_to(window, (rect.x, rect.y))
+}
+
+/// The work area under the pointer, or the primary one. Tao reports the pointer in pixels of the
+/// primary monitor's scale factor.
+fn current_monitor(app: &AppHandle, monitors: &[Rect]) -> CommandResult<Option<Rect>> {
+ let primary = app.primary_monitor().map_err(err)?;
+ let scale = primary.as_ref().map_or(1.0, |m| m.scale_factor());
+ let points = |value: f64| (value / scale).round() as i32;
+ let pointer = app.cursor_position().ok().map(|p| Rect::new(points(p.x), points(p.y), 0, 0));
+ Ok(pointer.and_then(|p| geometry::monitor_for(p, monitors)).or_else(|| primary.as_ref().map(work_area)))
+}
+
/// Keeps the Dot at exactly `DOT_SIZE` points, in case macOS or a monitor change resized it.
fn keep_dot_size(dot: &WebviewWindow, current: Rect) -> CommandResult {
if (current.width, current.height) == (DOT_SIZE.0 as i32, DOT_SIZE.1 as i32) {
@@ -134,10 +253,27 @@ fn keep_dot_size(dot: &WebviewWindow, current: Rect) -> CommandResult {
dot.set_size(LogicalSize::new(DOT_SIZE.0, DOT_SIZE.1)).map_err(err)
}
-fn place_panel_next_to_dot(app: &AppHandle) -> CommandResult {
- if !app.state::<Shell>().places_windows {
- return Ok(());
+fn place_panel(app: &AppHandle) -> CommandResult {
+ let shell = app.state::<Shell>();
+ let full_screen = shell.full_screen.lock().unwrap().is_some();
+ match panel_placement(shell.places_windows, full_screen, shell.rose_hidden.load(Ordering::SeqCst)) {
+ Placement::Keep => Ok(()),
+ Placement::BesideDot => place_panel_next_to_dot(app),
+ Placement::Alone => place_panel_alone(app),
}
+}
+
+fn place_panel_alone(app: &AppHandle) -> CommandResult {
+ let panel = window(app, PANEL)?;
+ let Some(current) = current_monitor(app, &monitor_rects(&panel)?)? else {
+ return Ok(());
+ };
+ let remembered = *app.state::<Shell>().panel_spot.lock().unwrap();
+ let size = (PANEL_SIZE.0 as i32, PANEL_SIZE.1 as i32);
+ move_to(&panel, geometry::place_panel_alone(remembered, size, current, EDGE_MARGIN))
+}
+
+fn place_panel_next_to_dot(app: &AppHandle) -> CommandResult {
let (dot, panel) = (window(app, DOT)?, window(app, PANEL)?);
let mut dot_rect = rect_of(&dot)?;
(dot_rect.width, dot_rect.height) = (DOT_SIZE.0 as i32, DOT_SIZE.1 as i32);
@@ -151,7 +287,7 @@ fn place_panel_next_to_dot(app: &AppHandle) -> CommandResult {
}
fn show_panel(app: &AppHandle) -> CommandResult {
- place_panel_next_to_dot(app)?;
+ place_panel(app)?;
let panel = window(app, PANEL)?;
panel.show().map_err(err)?;
panel.set_focus().map_err(err)?;
@@ -169,9 +305,9 @@ fn snap_dot(app: &AppHandle) -> CommandResult {
move_to(&dot, (x, y))?;
}
let shell = app.state::<Shell>();
- position::save(&shell.config.data_dir.join("desktop.json"), DotPosition { x, y }).map_err(err)?;
+ position::save(&desktop_file(&shell.config), DotPosition { x, y }).map_err(err)?;
if window(app, PANEL)?.is_visible().unwrap_or(false) {
- place_panel_next_to_dot(app)?;
+ place_panel(app)?;
}
Ok(())
}
@@ -196,7 +332,12 @@ fn spawn_snapper(app: AppHandle) -> mpsc::Sender<()> {
tx
}
-fn build_windows(app: &AppHandle, config: &DesktopConfig, places_windows: bool) -> tauri::Result<()> {
+fn build_windows(
+ app: &AppHandle,
+ config: &DesktopConfig,
+ places_windows: bool,
+ rose_hidden: bool,
+) -> tauri::Result<()> {
let dot = WebviewWindowBuilder::new(app, DOT, WebviewUrl::App("index.html?surface=dot".into()))
.title(DOT_TITLE)
.inner_size(DOT_SIZE.0, DOT_SIZE.1)
@@ -232,7 +373,9 @@ fn build_windows(app: &AppHandle, config: &DesktopConfig, places_windows: bool)
if !places_windows {
// Native Wayland ignores positions; Hyprland window rules place and pin the Dot.
- dot.show()?;
+ if !rose_hidden {
+ dot.show()?;
+ }
return Ok(());
}
@@ -243,13 +386,16 @@ fn build_windows(app: &AppHandle, config: &DesktopConfig, places_windows: bool)
let monitors = monitor_rects(&dot).unwrap_or_default();
let size = (DOT_SIZE.0 as i32, DOT_SIZE.1 as i32);
let primary = app.primary_monitor()?.as_ref().map(work_area);
- let saved = position::load(&config.data_dir.join("desktop.json")).map(|p| (p.x, p.y));
+ let saved = position::load(&desktop_file(config)).map(|p| (p.x, p.y));
if let Some((x, y)) = geometry::initial_dot_position(saved, size, &monitors, primary, EDGE_MARGIN) {
dot.set_position(LogicalPosition::new(f64::from(x), f64::from(y)))?;
}
// Set the size again once the window is in place, so it is exactly DOT_SIZE points there.
dot.set_size(LogicalSize::new(DOT_SIZE.0, DOT_SIZE.1))?;
- dot.show()?;
+ // A hidden rose stays placed, ready for "Show the rose".
+ if !rose_hidden {
+ dot.show()?;
+ }
Ok(())
}
@@ -261,12 +407,13 @@ fn conversations_on(value: Option<&str>) -> bool {
/// The tray menu, top to bottom (`-` is a separator). "New conversation" only exists with the
/// conversations list on; in the single continuous chat there is nothing new to start.
/// "Stop computer control" and "Yolo mode" exist where computer control does (macOS, S24.3, S24.9).
+/// "rose" hides or shows the floating Dot (S26.1).
fn tray_menu_ids(conversations: bool, computer_control: bool) -> Vec<&'static str> {
let mut ids = vec!["open"];
if conversations {
ids.push("new");
}
- ids.push("browser");
+ ids.extend(["browser", "rose"]);
if computer_control {
ids.extend(["computer-stop", "computer-yolo"]);
}
@@ -274,7 +421,7 @@ fn tray_menu_ids(conversations: bool, computer_control: bool) -> Vec<&'static st
ids
}
-fn build_tray(app: &AppHandle, config: &DesktopConfig) -> tauri::Result<TrayIcon> {
+fn build_tray(app: &AppHandle, config: &DesktopConfig, rose_hidden: bool) -> tauri::Result<TrayIcon> {
let autostart = app.autolaunch().is_enabled().unwrap_or(false);
// The accelerator is only a label here; an unparsable one must not break the menu.
let open = MenuItem::with_id(app, "open", "Open", true, Some(config.shortcut.as_str()))
@@ -286,6 +433,11 @@ fn build_tray(app: &AppHandle, config: &DesktopConfig) -> tauri::Result<TrayIcon
"open" => menu.append(&open)?,
"new" => menu.append(&MenuItem::with_id(app, "new", "New conversation", true, None::<&str>)?)?,
"browser" => menu.append(&MenuItem::with_id(app, "browser", "Open in browser", true, None::<&str>)?)?,
+ "rose" => {
+ let item = MenuItem::with_id(app, "rose", rose_menu_label(rose_hidden), true, None::<&str>)?;
+ menu.append(&item)?;
+ app.manage(RoseMenuItem(item));
+ }
"computer-stop" => menu.append(&MenuItem::with_id(
app,
"computer-stop",
@@ -325,6 +477,7 @@ fn build_tray(app: &AppHandle, config: &DesktopConfig) -> tauri::Result<TrayIcon
"open" => show_panel(app),
"new" => show_panel(app).and_then(|()| app.emit("dot://new-conversation", ()).map_err(err)),
"browser" => open_in_browser(app),
+ "rose" => set_rose_hidden(app.clone(), !rose_hidden_state(app)).map(|_| ()),
"computer-stop" => {
computer::stop(app, Reason::Stopped);
Ok(())
@@ -351,6 +504,10 @@ fn build_tray(app: &AppHandle, config: &DesktopConfig) -> tauri::Result<TrayIcon
.build(app)
}
+fn rose_hidden_state(app: &AppHandle) -> bool {
+ app.state::<Shell>().rose_hidden.load(Ordering::SeqCst)
+}
+
fn show_message(app: &AppHandle, kind: MessageDialogKind, text: &str) {
app.dialog().message(text).title("Gentle Dot").kind(kind).show(|_| {});
}
@@ -449,6 +606,9 @@ pub fn run() {
toggle_panel,
hide_panel,
set_dot_state,
+ rose_hidden,
+ set_rose_hidden,
+ set_panel_fullscreen,
computer::computer_endpoint,
computer::computer_permissions,
computer::computer_request_permission,
@@ -468,13 +628,22 @@ pub fn run() {
eprintln!("gentle-dot: {error}");
}
});
- app.manage(Shell { config: config.clone(), daemon, snap: spawn_snapper(handle.clone()), places_windows });
+ let rose_hidden = position::load_rose_hidden(&desktop_file(&config));
+ app.manage(Shell {
+ config: config.clone(),
+ daemon,
+ snap: spawn_snapper(handle.clone()),
+ places_windows,
+ rose_hidden: AtomicBool::new(rose_hidden),
+ panel_spot: Mutex::new(None),
+ full_screen: Mutex::new(None),
+ });
app.manage(computer::start(&handle));
#[cfg(target_os = "macos")]
register_panic_shortcut(&handle);
- build_windows(&handle, &config, places_windows)?;
- build_tray(&handle, &config)?;
+ build_windows(&handle, &config, places_windows, rose_hidden)?;
+ build_tray(&handle, &config, rose_hidden)?;
if places_windows {
register_shortcut(&handle, &config.shortcut);
let snap = app.state::<Shell>().snap.clone();
@@ -513,7 +682,7 @@ mod tests {
fn tray_hides_new_conversation_in_the_single_chat() {
assert_eq!(
tray_menu_ids(false, false),
- vec!["open", "browser", "-", "restart", "autostart", "-", "quit"]
+ vec!["open", "browser", "rose", "-", "restart", "autostart", "-", "quit"]
);
}
@@ -521,7 +690,7 @@ mod tests {
fn tray_shows_new_conversation_with_the_conversations_list() {
assert_eq!(
tray_menu_ids(true, false),
- vec!["open", "new", "browser", "-", "restart", "autostart", "-", "quit"]
+ vec!["open", "new", "browser", "rose", "-", "restart", "autostart", "-", "quit"]
);
}
@@ -529,10 +698,27 @@ mod tests {
fn tray_offers_stop_computer_control_where_it_exists() {
assert_eq!(
tray_menu_ids(false, true),
- vec!["open", "browser", "computer-stop", "computer-yolo", "-", "restart", "autostart", "-", "quit"]
+ vec!["open", "browser", "rose", "computer-stop", "computer-yolo", "-", "restart", "autostart", "-", "quit"]
);
}
+ #[test]
+ fn the_rose_item_offers_the_opposite_of_its_state() {
+ assert_eq!(rose_menu_label(false), "Hide the rose");
+ assert_eq!(rose_menu_label(true), "Show the rose");
+ }
+
+ #[test]
+ fn shortcut_and_tray_open_place_the_panel_without_the_rose_when_it_is_hidden() {
+ // `toggle_panel` (the shortcut) and the tray's Open both go through `show_panel`.
+ assert_eq!(panel_placement(true, false, false), Placement::BesideDot);
+ assert_eq!(panel_placement(true, false, true), Placement::Alone);
+ // Full screen keeps its frame; native Wayland leaves placement to the compositor.
+ assert_eq!(panel_placement(true, true, true), Placement::Keep);
+ assert_eq!(panel_placement(true, true, false), Placement::Keep);
+ assert_eq!(panel_placement(false, false, true), Placement::Keep);
+ }
+
#[test]
fn conversations_flag_reads_like_the_daemon() {
assert!(conversations_on(Some("1")));
diff --git a/docs/design.md b/docs/design.md
index e777c1f..316dd2f 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -200,12 +200,12 @@ Why enforcement lives in the app: everything inside the engine, and the daemon's
### The panel (expanded)
- 420 × 640 px, rounded 20 px, translucent (macOS vibrancy), anchored to the Dot.
-- Header (one continuous chat): the rose glyph and "Gentle Dot", then Accounts, Profiles, Connectors (a plug; also `/connectors`), and Hide as 18 px stroke icons with tooltips. With `features.conversations` on, the conversation title, the conversations list, and New conversation return.
+- Header (one continuous chat): the rose glyph and "Gentle Dot", then Accounts, Profiles, Connectors (a plug; also `/connectors`), Hide the rose (an eye) and Full screen (desktop panel only), and Hide as 18 px stroke icons with tooltips. With `features.conversations` on, the conversation title, the conversations list, and New conversation return.
- "Show earlier" at the top of the chat loads the previous page; a subtle "Earlier messages" divider marks where the chat's earlier session ends.
- Body: message list with streaming Markdown and code blocks; activity rows are collapsed one-liners grouped under the assistant turn ("Read 3 files · Ran tests").
- Ask cards: when the agent needs the user, an inline card with the question and buttons (select and confirm) or a text field (input and editor). The Dot turns amber until the user answers.
- Composer: multiline, Enter sends, Shift+Enter adds a new line. While the agent works, the composer offers "Stop", and sending a message steers the current run.
-- `Esc` collapses back to the Dot; the conversation keeps running.
+- `Esc` collapses back to the Dot; the conversation keeps running. In full screen, `Esc` first restores the panel's size (see §9, Hiding the rose and full screen).
### Menu bar
@@ -271,6 +271,9 @@ When the panel opens, it is placed next to the Dot on the side with more room, a
| `toggle_panel` | — | shows and focuses the panel next to the Dot, or hides it |
| `hide_panel` | — | hides the panel |
| `set_dot_state` | `{ "state": AgentState }` | updates the tray tooltip and swaps the tray glyph for the state |
+| `rose_hidden` | — | `true` when the user hid the rose |
+| `set_rose_hidden` | `{ "hidden": boolean }` | hides or shows the Dot window, saves the choice, emits `dot://rose`; returns the resulting state |
+| `set_panel_fullscreen` | `{ "on": boolean }` | fills the work area of the panel's display, or restores the frame before; returns the resulting state |
The Dot drags with `getCurrentWindow().startDragging()` (permission `core:window:allow-start-dragging`). After a drag ends (no move events for 300 ms), Rust snaps the Dot, by its real window size, to the nearest monitor edge with a 12 px margin and saves the position in `~/.gentle-dot/desktop.json`; the next launch restores it, or defaults to the right edge, vertically centered.
@@ -280,10 +283,17 @@ The Dot drags with `getCurrentWindow().startDragging()` (permission `core:window
|---|---|---|
| `dot://new-conversation` | — | the tray item "New conversation" was chosen; with the conversations list on, the panel starts a new conversation and opens; in the single chat (default) the UI ignores it |
| `dot://panel-shown` | — | the panel became visible; the UI focuses the composer |
+| `dot://rose` | `{ "hidden": boolean }` | the rose was hidden or shown (panel header or tray) |
### Menu bar and shortcut
-Tray menu: Open (`⌥ Space`), New conversation (only with `GENTLE_DOT_CONVERSATIONS=1`, read like the daemon reads it), Open in browser, Restart assistant, Launch at login (check item), Quit. The global shortcut `Alt+Space` (configurable as `shortcut` in `config.json`) toggles the panel. Launch at login uses `tauri-plugin-autostart`; Open in browser uses `tauri-plugin-opener` with `webUrl`.
+Tray menu: Open (`⌥ Space`), New conversation (only with `GENTLE_DOT_CONVERSATIONS=1`, read like the daemon reads it), Open in browser, Hide the rose / Show the rose, Restart assistant, Launch at login (check item), Quit. The global shortcut `Alt+Space` (configurable as `shortcut` in `config.json`) toggles the panel. Launch at login uses `tauri-plugin-autostart`; Open in browser uses `tauri-plugin-opener` with `webUrl`.
+
+### Hiding the rose and full screen (S26)
+
+- Hide the rose: the tray item "Hide the rose" (relabeled "Show the rose" while hidden) and an eye button in the panel header call `set_rose_hidden`. The choice is saved as `rose_hidden` in `~/.gentle-dot/desktop.json` next to `dot_points`; files without the key load as shown. A hidden rose is still placed at launch, only not shown. The shortcut and the tray's Open never need the Dot: with the rose hidden, the panel opens at the spot where it was last hidden when that is on the display under the pointer, or else at the right edge of that display, vertically centered. Computer control stays visible in the panel banner (and the tray's Yolo mode check) while the rose is hidden.
+- Full screen: a header button and ⌘⇧F (Ctrl+Shift+F off macOS) while the panel has focus call `set_panel_fullscreen`. The panel fills the work area of its display (the menu bar and the Dock stay visible) and stays an accessory window, not a separate macOS fullscreen Space. The app remembers the frame before and restores it, kept on a display that still exists. While full screen, the panel is not moved when it opens or the Dot snaps, and the conversation, notes, and composer use a centered column of `--reading-width` (780 px, the web page's column). The web page has no button; it already fills the browser.
+- `Esc` in the panel, in order: an `Esc` that something inside the panel already handled (`preventDefault`) is left alone; in full screen it restores the panel; otherwise it hides the panel.
### Second launch and `--toggle`
diff --git a/packages/ui/src/App.tsx b/packages/ui/src/App.tsx
index 778f947..fface04 100644
--- a/packages/ui/src/App.tsx
+++ b/packages/ui/src/App.tsx
@@ -15,6 +15,7 @@ import {
} from "./desktop.ts";
import { useComputerRegistration, useComputerState } from "./useComputer.ts";
import { useDot } from "./useDot.ts";
+import { usePanelWindow } from "./usePanelWindow.ts";
type Surface = "dot" | "panel" | "web";
@@ -42,6 +43,13 @@ function browserConnection(): ConnectionInfo | undefined {
return { url: `${protocol}//${base.host}/ws`, token };
}
+/** ⌘⇧F (Ctrl+Shift+F off macOS) toggles the panel's full screen. */
+function isFullscreenShortcut(event: KeyboardEvent): boolean {
+ return (
+ (event.metaKey || event.ctrlKey) && event.shiftKey && !event.altKey && event.key.toLowerCase() === "f"
+ );
+}
+
export function App() {
const surface = currentSurface();
const [info, setInfo] = useState<ConnectionInfo | undefined>(undefined);
@@ -58,6 +66,10 @@ export function App() {
state.connection === "open",
send,
);
+ // The panel's own window (S26): hide the rose, full screen.
+ const panel = usePanelWindow(desktop && surface === "panel");
+ const fullscreenNow = panel.fullscreenNow;
+ const setFullscreen = panel.controls.setFullscreen;
const computer: ComputerControls | undefined =
desktop && surface === "panel"
? {
@@ -94,15 +106,26 @@ export function App() {
}),
onDesktopEvent("dot://panel-shown", () => setFocusKey((k) => k + 1)),
];
+ // Esc, in order: whatever inside the panel already handled it (it called preventDefault),
+ // then leaving full screen, then hiding the panel.
const onKey = (event: KeyboardEvent) => {
- if (event.key === "Escape") hidePanel();
+ if (event.defaultPrevented) return;
+ if (event.key === "Escape") {
+ if (fullscreenNow.current) setFullscreen(false);
+ else hidePanel();
+ return;
+ }
+ if (isFullscreenShortcut(event)) {
+ event.preventDefault();
+ setFullscreen(!fullscreenNow.current);
+ }
};
window.addEventListener("keydown", onKey);
return () => {
window.removeEventListener("keydown", onKey);
for (const s of subscriptions) void s.then((unlisten) => unlisten());
};
- }, [surface, send]);
+ }, [surface, send, fullscreenNow, setFullscreen]);
useEffect(() => {
document.documentElement.dataset.surface = surface;
@@ -140,6 +163,7 @@ export function App() {
focusKey={focusKey}
{...(surface === "panel" ? { onHide: hidePanel } : {})}
{...(computer ? { computer } : {})}
+ {...(desktop && surface === "panel" ? { panelWindow: panel.controls } : {})}
/>
);
}
diff --git a/packages/ui/src/components/ChatSurface.tsx b/packages/ui/src/components/ChatSurface.tsx
index 752f15d..876df0e 100644
--- a/packages/ui/src/components/ChatSurface.tsx
+++ b/packages/ui/src/components/ChatSurface.tsx
@@ -2,6 +2,7 @@ import type { ClientMessage } from "@gentle-dot/protocol";
import { useState } from "react";
import { openUrl as openExternal } from "../desktop.ts";
import { activeTitle, type DotAction, type DotState, isBusy, needsAccount } from "../store.ts";
+import type { PanelWindowControls } from "../usePanelWindow.ts";
import { AccountsPanel } from "./AccountsPanel.tsx";
import { AskCard } from "./AskCard.tsx";
import { Composer } from "./Composer.tsx";
@@ -10,8 +11,12 @@ import { ConnectorDraftCard } from "./ConnectorDraftCard.tsx";
import { ConnectorsPanel } from "./ConnectorsPanel.tsx";
import {
AccountsIcon,
+ CollapseIcon,
ConnectorsIcon,
ConversationsIcon,
+ ExpandIcon,
+ EyeIcon,
+ EyeOffIcon,
MinusIcon,
PlusIcon,
ProfilesIcon,
@@ -32,6 +37,8 @@ interface ChatSurfaceProps {
openUrl?: (url: string) => void;
/** Computer control, in the desktop panel only. */
computer?: ComputerControls;
+ /** Hiding the rose and full screen (S26), in the desktop panel only; the web page already fills the browser. */
+ panelWindow?: PanelWindowControls;
}
const CONTINUE_TEXT = "Continue where you left off.";
@@ -59,6 +66,7 @@ export function ChatSurface({
dispatch = () => {},
openUrl = openExternal,
computer,
+ panelWindow,
}: ChatSurfaceProps) {
const openAccounts = () => {
send({ type: "auth_list" });
@@ -96,7 +104,10 @@ export function ChatSurface({
state.connection === "open" && state.agentState !== "restarting" && state.agentState !== "starting";
return (
- <div className={`chat chat-${variant}`} data-state={state.agentState}>
+ <div
+ className={`chat chat-${variant}${panelWindow?.fullscreen ? " chat-fullscreen" : ""}`}
+ data-state={state.agentState}
+ >
<header className="chat-header" data-tauri-drag-region={variant === "panel" ? "" : undefined}>
<span className={`state-dot state-${state.agentState}`} aria-hidden="true" />
{conversations ? (
@@ -149,6 +160,12 @@ export function ChatSurface({
<PlusIcon />
</button>
) : null}
+ {panelWindow ? (
+ <>
+ <RoseButton controls={panelWindow} />
+ <FullscreenButton controls={panelWindow} />
+ </>
+ ) : null}
{onHide ? (
<button type="button" className="icon" aria-label="Hide" title="Hide" onClick={onHide}>
<MinusIcon />
@@ -308,3 +325,34 @@ export function ChatSurface({
</div>
);
}
+
+function RoseButton({ controls }: { controls: PanelWindowControls }) {
+ const label = controls.roseHidden ? "Show the rose" : "Hide the rose";
+ return (
+ <button
+ type="button"
+ className="icon"
+ aria-label={label}
+ title={label}
+ onClick={() => controls.setRoseHidden(!controls.roseHidden)}
+ >
+ {controls.roseHidden ? <EyeIcon /> : <EyeOffIcon />}
+ </button>
+ );
+}
+
+function FullscreenButton({ controls }: { controls: PanelWindowControls }) {
+ const label = controls.fullscreen ? "Exit full screen" : "Full screen";
+ return (
+ <button
+ type="button"
+ className="icon"
+ aria-label={label}
+ title={`${label} (⌘⇧F)`}
+ aria-pressed={controls.fullscreen}
+ onClick={() => controls.setFullscreen(!controls.fullscreen)}
+ >
+ {controls.fullscreen ? <CollapseIcon /> : <ExpandIcon />}
+ </button>
+ );
+}
diff --git a/packages/ui/src/components/icons.tsx b/packages/ui/src/components/icons.tsx
index 2826af0..7333632 100644
--- a/packages/ui/src/components/icons.tsx
+++ b/packages/ui/src/components/icons.tsx
@@ -124,3 +124,49 @@ export function MinusIcon() {
</Icon>
);
}
+
+/** An eye: show the floating rose again. */
+export function EyeIcon() {
+ return (
+ <Icon>
+ <path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z" />
+ <circle cx="12" cy="12" r="3" />
+ </Icon>
+ );
+}
+
+/** A crossed-out eye: hide the floating rose. */
+export function EyeOffIcon() {
+ return (
+ <Icon>
+ <path d="M10.6 5.1A9.8 9.8 0 0 1 12 5c6.5 0 10 7 10 7a17 17 0 0 1-2.2 3.1" />
+ <path d="M6.6 6.6C3.6 8.4 2 12 2 12s3.5 7 10 7a9.7 9.7 0 0 0 5.4-1.6" />
+ <path d="M9.9 9.9a3 3 0 0 0 4.2 4.2" />
+ <path d="m2 2 20 20" />
+ </Icon>
+ );
+}
+
+/** Corners pointing out: fill the screen. */
+export function ExpandIcon() {
+ return (
+ <Icon>
+ <path d="M15 3h6v6" />
+ <path d="M9 21H3v-6" />
+ <path d="M21 3l-7 7" />
+ <path d="M3 21l7-7" />
+ </Icon>
+ );
+}
+
+/** Corners pointing in: back to the panel's size. */
+export function CollapseIcon() {
+ return (
+ <Icon>
+ <path d="M4 14h6v6" />
+ <path d="M20 10h-6V4" />
+ <path d="M14 10l7-7" />
+ <path d="M3 21l7-7" />
+ </Icon>
+ );
+}
diff --git a/packages/ui/src/styles.css b/packages/ui/src/styles.css
index 6321d7f..b4a5e38 100644
--- a/packages/ui/src/styles.css
+++ b/packages/ui/src/styles.css
@@ -23,6 +23,8 @@
--radius-lg: 16px;
--radius-pill: 999px;
--radius: 20px;
+ /* The reading column of the web page and of the full-screen panel (S26.2). */
+ --reading-width: 780px;
--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
--font-text: Inter, "SF Pro Text", system-ui, -apple-system, "Segoe UI", sans-serif;
--font-mono: "IosevkaTerm NF", "Iosevka Term", "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
@@ -544,7 +546,7 @@ html[data-effects="none"] .chat-panel {
}
.chat-web {
- max-width: 780px;
+ max-width: var(--reading-width);
margin: 0 auto;
border-left: 1px solid var(--line);
border-right: 1px solid var(--line);
@@ -1322,6 +1324,20 @@ button.link:hover:not(:disabled) {
gap: 8px;
}
+/* Full screen (S26.2): the panel fills the display, and the conversation, its notes, and the
+ composer keep the web page's readable centered column. */
+.chat-fullscreen .chat-body,
+.chat-fullscreen .notices {
+ padding-inline: max(16px, calc((100% - var(--reading-width)) / 2));
+}
+
+.chat-fullscreen .status,
+.chat-fullscreen .computer-banner,
+.chat-fullscreen .switch-confirm,
+.chat-fullscreen .composer {
+ margin-inline: max(12px, calc((100% - var(--reading-width)) / 2));
+}
+
@media (prefers-reduced-motion: reduce) {
*,
*::before,
diff --git a/packages/ui/src/usePanelWindow.ts b/packages/ui/src/usePanelWindow.ts
new file mode 100644
index 0000000..df24f76
--- /dev/null
+++ b/packages/ui/src/usePanelWindow.ts
@@ -0,0 +1,75 @@
+import { invoke, isTauri } from "@tauri-apps/api/core";
+import { useCallback, useEffect, useRef, useState } from "react";
+
+/** Whether the user hid the floating rose (S26.1); the choice is saved by the app. */
+function loadRoseHidden(): Promise<boolean> {
+ if (!isTauri()) return Promise.resolve(false);
+ return invoke<boolean>("rose_hidden");
+}
+
+/** Hides or shows the rose; resolves with the resulting state. */
+function setRoseHidden(hidden: boolean): Promise<boolean> {
+ if (!isTauri()) return Promise.resolve(false);
+ return invoke<boolean>("set_rose_hidden", { hidden });
+}
+
+/** The rose was hidden or shown, from the panel or the menu bar item. */
+async function onRoseHidden(handler: (hidden: boolean) => void) {
+ if (!isTauri()) return () => {};
+ const { listen } = await import("@tauri-apps/api/event");
+ return listen<{ hidden?: unknown }>("dot://rose", (event) => handler(event.payload?.hidden === true));
+}
+
+/** Fills the display's work area with the panel, or restores it (S26.2); resolves with the result. */
+function setPanelFullscreen(on: boolean): Promise<boolean> {
+ if (!isTauri()) return Promise.resolve(false);
+ return invoke<boolean>("set_panel_fullscreen", { on });
+}
+
+/** What the panel header offers about its own window (S26), in the desktop panel only. */
+export interface PanelWindowControls {
+ roseHidden: boolean;
+ setRoseHidden: (hidden: boolean) => void;
+ fullscreen: boolean;
+ setFullscreen: (on: boolean) => void;
+}
+
+/**
+ * The rose's visibility as the app reports it, and the panel's full-screen state. The app does the
+ * window work; this follows the state each command returns. `fullscreenNow` is read by key handlers.
+ */
+export function usePanelWindow(enabled: boolean) {
+ const [roseHidden, setRose] = useState(false);
+ const [fullscreen, setFull] = useState(false);
+ const fullscreenNow = useRef(false);
+
+ useEffect(() => {
+ if (!enabled) return;
+ let live = true;
+ const update = (hidden: boolean) => {
+ if (live) setRose(hidden);
+ };
+ loadRoseHidden().then(update, () => {});
+ const unlisten = onRoseHidden(update);
+ return () => {
+ live = false;
+ void unlisten.then((stop) => stop());
+ };
+ }, [enabled]);
+
+ const hideRose = useCallback((hidden: boolean) => {
+ setRoseHidden(hidden).then(setRose, () => {});
+ }, []);
+ const setFullscreen = useCallback((on: boolean) => {
+ setPanelFullscreen(on).then(
+ (result) => {
+ fullscreenNow.current = result;
+ setFull(result);
+ },
+ () => {},
+ );
+ }, []);
+
+ const controls: PanelWindowControls = { roseHidden, setRoseHidden: hideRose, fullscreen, setFullscreen };
+ return { controls, fullscreenNow };
+}
diff --git a/packages/ui/test/window.test.tsx b/packages/ui/test/window.test.tsx
new file mode 100644
index 0000000..297cd05
--- /dev/null
+++ b/packages/ui/test/window.test.tsx
@@ -0,0 +1,198 @@
+import { readFileSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { type DotState, initialState } from "../src/store.ts";
+
+/** Hide the rose and full-screen chat (S26), through the panel and its mocked Tauri commands. */
+const h = vi.hoisted(() => ({
+ tauri: true,
+ roseHidden: false,
+ fullscreen: false,
+ computer: { active: false } as unknown,
+ invoke: vi.fn(),
+ listeners: new Map<string, (event: { payload: unknown }) => void>(),
+ state: undefined as unknown as DotState,
+}));
+
+vi.mock("@tauri-apps/api/core", () => ({
+ isTauri: () => h.tauri,
+ invoke: (command: string, args?: unknown) => h.invoke(command, args),
+}));
+
+vi.mock("@tauri-apps/api/event", () => ({
+ listen: async (name: string, handler: (event: { payload: unknown }) => void) => {
+ h.listeners.set(name, handler);
+ return () => h.listeners.delete(name);
+ },
+}));
+
+// As in computer.test.tsx: the panel's other desktop events are not under test, and concurrent first
+// imports of the mocked event module can reach the real one.
+vi.mock("../src/desktop.ts", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("../src/desktop.ts")>()),
+ onDesktopEvent: async () => () => {},
+}));
+
+vi.mock("../src/useDot.ts", () => ({
+ useDot: () => ({ state: h.state, send: () => {}, dismiss: () => {}, dispatch: () => {} }),
+}));
+
+async function renderApp(search: string) {
+ window.history.replaceState(null, "", `/${search}`);
+ const { App } = await import("../src/App.tsx");
+ return render(<App />);
+}
+
+const invoked = (command: string) => h.invoke.mock.calls.filter(([c]) => c === command);
+const lastArgs = (command: string) => invoked(command).at(-1)?.[1];
+const chat = (container: HTMLElement) => container.querySelector(".chat");
+
+beforeEach(() => {
+ h.tauri = true;
+ h.roseHidden = false;
+ h.fullscreen = false;
+ h.computer = { active: false };
+ h.listeners.clear();
+ h.state = { ...initialState, connection: "open", agentState: "idle" };
+ h.invoke = vi.fn(async (command: string, args?: Record<string, unknown>) => {
+ switch (command) {
+ case "connection_info":
+ return new Promise(() => {});
+ case "rose_hidden":
+ return h.roseHidden;
+ case "set_rose_hidden":
+ h.roseHidden = args?.hidden === true;
+ return h.roseHidden;
+ case "set_panel_fullscreen":
+ h.fullscreen = args?.on === true;
+ return h.fullscreen;
+ case "computer_status":
+ return h.computer;
+ default:
+ return null;
+ }
+ });
+});
+
+afterEach(() => {
+ window.history.replaceState(null, "", "/");
+});
+
+describe("hide the rose (S26.1)", () => {
+ it("the panel header hides the rose and then offers to show it again", async () => {
+ await renderApp("?surface=panel");
+ await waitFor(() => expect(invoked("rose_hidden")).toHaveLength(1));
+ await userEvent.click(await screen.findByRole("button", { name: "Hide the rose" }));
+ expect(h.invoke).toHaveBeenCalledWith("set_rose_hidden", { hidden: true });
+
+ const show = await screen.findByRole("button", { name: "Show the rose" });
+ expect(show).toHaveAttribute("title", "Show the rose");
+ await userEvent.click(show);
+ expect(lastArgs("set_rose_hidden")).toEqual({ hidden: false });
+ await screen.findByRole("button", { name: "Hide the rose" });
+ });
+
+ it("starts from the remembered choice and follows the tray", async () => {
+ h.roseHidden = true;
+ await renderApp("?surface=panel");
+ await screen.findByRole("button", { name: "Show the rose" });
+
+ await waitFor(() => expect(h.listeners.has("dot://rose")).toBe(true));
+ await act(async () => h.listeners.get("dot://rose")?.({ payload: { hidden: false } }));
+ await screen.findByRole("button", { name: "Hide the rose" });
+ });
+
+ it("keeps the computer-control banner, yolo included, while the rose is hidden", async () => {
+ h.roseHidden = true;
+ h.computer = { active: true, endsAt: Date.now() + 60_000, yolo: true };
+ await renderApp("?surface=panel");
+ await screen.findByRole("button", { name: "Show the rose" });
+ const banner = await screen.findByRole("region", { name: "Computer control" });
+ expect(banner).toHaveTextContent(/yolo/i);
+ });
+});
+
+describe("full-screen chat (S26.2)", () => {
+ it("the header button fills the screen and the same button restores it", async () => {
+ const { container } = await renderApp("?surface=panel");
+ await userEvent.click(await screen.findByRole("button", { name: "Full screen" }));
+ expect(h.invoke).toHaveBeenCalledWith("set_panel_fullscreen", { on: true });
+ const exit = await screen.findByRole("button", { name: "Exit full screen" });
+ expect(chat(container)).toHaveClass("chat-fullscreen");
+
+ await userEvent.click(exit);
+ expect(lastArgs("set_panel_fullscreen")).toEqual({ on: false });
+ await screen.findByRole("button", { name: "Full screen" });
+ expect(chat(container)).not.toHaveClass("chat-fullscreen");
+ });
+
+ it("⌘⇧F toggles full screen while the panel has focus", async () => {
+ const { container } = await renderApp("?surface=panel");
+ await screen.findByRole("button", { name: "Full screen" });
+ fireEvent.keyDown(window, { key: "F", code: "KeyF", metaKey: true, shiftKey: true });
+ await waitFor(() => expect(chat(container)).toHaveClass("chat-fullscreen"));
+ fireEvent.keyDown(window, { key: "F", code: "KeyF", metaKey: true, shiftKey: true });
+ await waitFor(() => expect(chat(container)).not.toHaveClass("chat-fullscreen"));
+ // Plain ⌘F (find) and ⇧F (typing a capital F) are left alone.
+ fireEvent.keyDown(window, { key: "f", code: "KeyF", metaKey: true });
+ fireEvent.keyDown(window, { key: "F", code: "KeyF", shiftKey: true });
+ expect(invoked("set_panel_fullscreen")).toHaveLength(2);
+ });
+
+ it("Esc restores from full screen first and hides the panel only after that", async () => {
+ const { container } = await renderApp("?surface=panel");
+ await userEvent.click(await screen.findByRole("button", { name: "Full screen" }));
+ await waitFor(() => expect(chat(container)).toHaveClass("chat-fullscreen"));
+
+ fireEvent.keyDown(window, { key: "Escape" });
+ await waitFor(() => expect(chat(container)).not.toHaveClass("chat-fullscreen"));
+ expect(lastArgs("set_panel_fullscreen")).toEqual({ on: false });
+ expect(invoked("hide_panel")).toHaveLength(0);
+
+ fireEvent.keyDown(window, { key: "Escape" });
+ expect(invoked("hide_panel")).toHaveLength(1);
+ expect(invoked("set_panel_fullscreen")).toHaveLength(2);
+ });
+
+ it("leaves an Esc that something inside the panel already handled alone", async () => {
+ const { container } = await renderApp("?surface=panel");
+ await userEvent.click(await screen.findByRole("button", { name: "Full screen" }));
+ await waitFor(() => expect(chat(container)).toHaveClass("chat-fullscreen"));
+ const box = screen.getByRole("textbox", { name: "Message" });
+ box.addEventListener("keydown", (event) => event.preventDefault());
+
+ fireEvent.keyDown(box, { key: "Escape" });
+ expect(chat(container)).toHaveClass("chat-fullscreen");
+ expect(invoked("set_panel_fullscreen")).toHaveLength(1);
+ expect(invoked("hide_panel")).toHaveLength(0);
+ });
+
+ it("gives the conversation a readable centered column in full screen", async () => {
+ const stylesheet = "../src/styles.css";
+ const css = readFileSync(fileURLToPath(new URL(stylesheet, import.meta.url)), "utf8");
+ expect(css).toMatch(/--reading-width: 780px;/);
+ expect(css).toMatch(/\.chat-web \{[^}]*max-width: var\(--reading-width\);/);
+ expect(css).toMatch(/\.chat-fullscreen \.chat-body[^{]*\{[^}]*var\(--reading-width\)/);
+ });
+});
+
+describe("outside the desktop panel", () => {
+ it("the web page shows neither the full-screen nor the rose button and calls nothing", async () => {
+ h.tauri = false;
+ await renderApp("?#token=web-key");
+ await screen.findByRole("textbox", { name: "Message" });
+ expect(screen.queryByRole("button", { name: "Full screen" })).toBeNull();
+ expect(screen.queryByRole("button", { name: /the rose/ })).toBeNull();
+ fireEvent.keyDown(window, { key: "F", metaKey: true, shiftKey: true });
+ expect(h.invoke).not.toHaveBeenCalled();
+ });
+
+ it("the Dot window loads no panel controls", async () => {
+ await renderApp("?surface=dot");
+ await new Promise((resolve) => setTimeout(resolve, 20));
+ expect(invoked("rose_hidden")).toHaveLength(0);
+ expect(screen.queryByRole("button", { name: "Full screen" })).toBeNull();
+ });
+});