You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+76-4Lines changed: 76 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,14 @@ Guide for AI agents working on the FloatView codebase.
4
4
5
5
## Project Overview
6
6
7
-
FloatView is a Tauri v2 application that provides a floating browser window for streaming media on secondary monitors. Key features include always-on-top, borderless resizable window, opacity control, and click-through mode.
7
+
FloatView is a Tauri v2 application that provides a floating browser window for streaming media on secondary monitors. Key features include always-on-top, borderless resizable window, opacity control, click-through mode, persistent bookmarks, navigation controls, smart URL bar with DuckDuckGo search, window title tracking, crash recovery (config backup + periodic geometry auto-save), and clear site data.
8
8
9
9
## Tech Stack
10
10
11
11
-**Runtime**: Tauri v2 (Rust backend)
12
12
-**Rendering**: WebView2 (system webview on Windows)
-**URL tracking**: `popstate` + 3s polling for address bar sync
170
+
-**Config sync**: `config-changed` event listener updates bookmarks in real-time
171
+
-**Dropdown mutual exclusion**: recent/bookmarks/snap dropdowns dismiss each other
172
+
115
173
## Gotchas
116
174
117
175
1.**Invoke, don't call window methods** -- `getCurrentWindow().method()` is unreliable from injected scripts. Always create a Rust command and use `invoke()`.
@@ -128,16 +186,30 @@ Edit `src-tauri/src/injection.js`. The script:
128
186
129
187
7.**Single Instance** -- `tauri-plugin-single-instance` brings existing window to front if user launches again.
130
188
189
+
8.**Config backup** -- `save_config()` creates a `.bak` copy before writing. Used for crash recovery.
190
+
191
+
9.**Periodic geometry auto-save** -- Background thread saves window position/size every 30s (skips minimized/maximized). Prevents geometry loss on crash.
192
+
193
+
10.**Bookmark limits** -- Max 50 bookmarks, deduplication by normalized URL, sanitized via `sanitize_config()`.
Controls: back, forward, refresh, bookmark star (click to toggle, right-click for dropdown list), always-on-top pin, URL display (click to edit, non-URL input searches DuckDuckGo), lock toggle, settings gear (audio, preferences, clear site data, clear bookmarks), minimize, close.
235
236
236
-
Communication: injected JS calls `window.__TAURI__.invoke('command_name', { args })` to talk to the Rust backend. Tauri commands handle window manipulation, config persistence, audio device enumeration, etc.
237
+
Communication: injected JS calls `window.__TAURI__.invoke('command_name', { args })` to talk to the Rust backend. Tauri commands handle window manipulation, config persistence, bookmark management, title updates, site data clearing, etc.
237
238
238
239
### Locked/Unlocked State Model (Click-Through)
239
240
@@ -300,18 +301,25 @@ Unsigned Windows binaries trigger SmartScreen warnings and may face friction in
300
301
},
301
302
"last_url": "http://192.168.1.XXX:8096",
302
303
"recent_urls": [],
303
-
"audio_device_id": null,
304
-
"launch_at_startup": false,
304
+
"bookmarks": [],
305
+
"home_url": "https://www.google.com",
306
+
"first_run": true,
307
+
"auto_refresh_minutes": 0,
305
308
"hotkeys": {
306
309
"toggle_on_top": "Alt+Shift+T",
307
310
"toggle_locked": "Alt+Shift+D",
308
311
"opacity_up": "Alt+Shift+Up",
309
312
"opacity_down": "Alt+Shift+Down",
310
-
"toggle_visibility": "Alt+Shift+H"
313
+
"toggle_visibility": "Alt+Shift+H",
314
+
"media_play_pause": "Alt+Shift+Space",
315
+
"media_next": "Alt+Shift+Right",
316
+
"media_previous": "Alt+Shift+Left"
311
317
}
312
318
}
313
319
```
314
320
321
+
Config is backed up to `config.json.bak` before each write. Window geometry is auto-saved every 30 seconds (skipping minimized/maximized states) via a background thread to prevent geometry loss on crash.
0 commit comments