Skip to content

Conversation

@bcho
Copy link
Member

@bcho bcho commented Jan 4, 2026

This pull request introduces a new system tray menu for the standalone Tauri application, adds checkpoint querying capabilities to the database API, and updates build assets for improved icon handling. The main changes are grouped below by theme.

System Tray Integration and UI Improvements

  • Added a new ui::tray module (standalone/src-tauri/src/ui/tray.rs) to implement a system tray menu, displaying recent tasks, worker status, and providing quick actions like show and quit. The tray menu updates every 30 seconds and responds to user events. Integration hooks were added to lib.rs to set up and manage the tray icon and its menu. [1] [2] [3] [4] [5]
  • Enhanced the main window event handling to support tray-driven navigation (e.g., clicking recent tasks opens the relevant view) and improved window close behavior (hide instead of quit).

Database API Extensions

  • Added new database API endpoints and corresponding Rust structs for querying task checkpoint statuses and listing checkpoints, with support for Tauri commands and dev API routing. [1] [2] [3] [4]
  • Updated TaskRun and related mapping logic to include millisecond timestamps for creation and updates, improving time-based UI and API features. [1] [2]

Build and Asset Updates

  • Reduced the set of icon sizes generated by generate-icon.sh and updated tauri.conf.json to use higher-resolution icons, streamlining build outputs and improving visual quality. [1] [2]
  • Added a new icon definition file (assets/absurd-sqlite-standalone.icon/icon.json) for automatic gradient and platform-specific icon support.

Dependency and Feature Updates

  • Enabled the tray-icon and image-png features for the tauri crate in Cargo.toml to support tray icon functionality.

Code Organization

  • Refactored imports and module structure in lib.rs to support the new tray UI and event handling. [1] [2]

References:
System Tray Integration: [1] [2] [3] [4] [5]
Database API Extensions: [1] [2] [3] [4] [5] [6]
Build and Asset Updates: [1] [2] [3]
Dependency and Feature Updates: standalone/src-tauri/Cargo.tomlL28-R28
Code Organization: [1] [2]

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the standalone Tauri application with system tray functionality, checkpoint querying capabilities, and refined UI/icon handling. The changes improve user experience by providing quick access to recent tasks via the system tray and displaying checkpoint information in the task detail view.

Key changes:

  • Added system tray menu with recent tasks, worker status, and quick actions (show/quit)
  • Implemented checkpoint querying APIs with status tracking and display in task details
  • Updated icon handling to use higher-resolution assets and added new tray icon
  • Enhanced task duration calculation using millisecond timestamps

Reviewed changes

Copilot reviewed 13 out of 28 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
standalone/src-tauri/src/ui/tray.rs New system tray implementation with periodic updates and event handling
standalone/src-tauri/src/lib.rs Integrated tray setup, menu event handlers, and window close behavior
standalone/src-tauri/src/db_commands.rs Added checkpoint query functions and updated TaskRun with millisecond timestamps
standalone/src/lib/providers/absurdData.ts Extended provider interface with checkpoint methods and mock data
standalone/src/routes/tasks/[taskId]/+page.svelte Added checkpoint display and duration calculation logic
standalone/src/routes/+layout.svelte Updated header with logo image and compact mode styling
standalone/src-tauri/tauri.conf.json Reduced icon sizes to higher-resolution variants only
standalone/src-tauri/Cargo.toml Enabled tray-icon and image-png features for Tauri
assets/generate-icon.sh Reduced generated icon size set

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<div class="mx-auto flex w-full max-w-screen-2xl items-center justify-between px-8 py-4 transition-all duration-200 header-inner">
<p class="text-base font-semibold text-slate-900 header-logo select-none">Absurd Habitat</p>
<div class="flex items-center gap-2 text-base font-semibold text-slate-900 header-logo select-none">
<img src="/logo.png" alt="Absurd SQLite logo" class="h-10 w-10 header-logo-icon" />
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logo image path is hardcoded to "/logo.png" which may not resolve correctly depending on the deployment base path or route configuration. Consider using a proper asset import or a configurable base path.

Copilot uses AI. Check for mistakes.
Comment on lines +81 to +86
let script = format!(
"window.location.assign({});",
serde_json::to_string(&format!("/tasks/{}", task_id))
.unwrap_or_else(|_| "\"/tasks\"".to_string())
);
let _ = window.eval(&script);
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using window.location.assign() for navigation bypasses the SvelteKit router, which can cause loss of client-side state and disable SvelteKit's optimizations. Use the goto() function from $app/navigation instead for proper client-side routing.

Copilot uses AI. Check for mistakes.
Comment on lines +110 to +119
pub fn start_updates(app_handle: AppHandle) {
async_runtime::spawn(async move {
let mut ticker = interval(TRAY_UPDATE_INTERVAL);
loop {
ticker.tick().await;
if let Err(err) = update_menu_state(&app_handle) {
log::warn!("Failed to update tray menu: {}", err);
}
}
});
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tray menu update runs every 30 seconds in an infinite loop without any error recovery mechanism. If update_menu_state fails repeatedly, errors will continue to accumulate in the logs. Consider implementing exponential backoff or circuit breaker pattern to handle persistent failures gracefully.

Copilot uses AI. Check for mistakes.
Comment on lines +445 to +446
createdAtMs: Date.parse("Dec 22, 2025, 9:13 AM"),
updatedAtMs: Date.parse("Dec 27, 2025, 3:03 PM"),
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded timestamp strings passed to Date.parse() will produce inconsistent results across different locales and time zones. Date.parse() behavior varies by browser implementation and should be avoided. Consider using ISO 8601 format timestamps or Unix timestamps in milliseconds instead.

Suggested change
createdAtMs: Date.parse("Dec 22, 2025, 9:13 AM"),
updatedAtMs: Date.parse("Dec 27, 2025, 3:03 PM"),
createdAtMs: Date.parse("2025-12-22T09:13:00.000Z"),
updatedAtMs: Date.parse("2025-12-27T15:03:00.000Z"),

Copilot uses AI. Check for mistakes.
const minCreated = Math.min(...createdValues);
const maxUpdated = Math.max(...updatedValues);
if (!Number.isFinite(minCreated) || !Number.isFinite(maxUpdated)) return "—";
return formatDuration(Math.max(0, maxUpdated - minCreated));
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subtraction calculation here will always return a non-negative number due to Math.max(0, ...), making the Math.max unnecessary on line 47. The logic would be clearer without the redundant Math.max wrapping.

Suggested change
return formatDuration(Math.max(0, maxUpdated - minCreated));
return formatDuration(maxUpdated - minCreated);

Copilot uses AI. Check for mistakes.
@bcho bcho marked this pull request as ready for review January 4, 2026 00:46
@bcho bcho merged commit 857c16d into main Jan 4, 2026
8 checks passed
@bcho bcho deleted the ui-tweak branch January 4, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants