Svelte + Tauri Floating Panel Template
A template/example to show how to create an app that uses floating panels using Tauri 2 and Svelte on MacOs.
The app have 2 main windows:
- A regular main window that appears in the dock
- A floating panel window that can be toggled with keyboard shortcuts and is visible in all spaces including fullscreen spaces.
Features
- Floating Panel: A macOS-style floating panel that can be toggled with keyboard shortcuts (Alt+Space)
- Fullscreen Compatible: Panel remains visible even in fullscreen spaces
- Follows you around the spaces: The panel will follow you around the spaces and will be visible in all of them.
- Regular Window: A regular window that appears in the dock and can be used for the main application UI
Tech Stack
Getting Started
Prerequisites
Installation
- Clone this repository:
git clone https://github.com/facundoPri/svelte-tauri-template.git
- Navigate to the project directory:
cd svelte-tauri-template
- Install dependencies and run the demo:
pnpm install
pnpm tauri dev
- Press Alt+Space to toggle the spotlight window
Usage
- Launch the application
- Press
Alt+Space
to toggle the floating panel
- The panel will appear and follow you around the spaces
- Type something and press Enter or click the "Greet" button
Project Structure
src/
- Svelte frontend code
routes/
- SvelteKit routes
panel/
- Panel UI components
lib/
- Shared components and utilities
src-tauri/
- Rust backend code
src/
- Rust source files
lib.rs
- Main application logic
panel.rs
- Panel functionality
command.rs
- Tauri commands
Styling the Panel
The panel UI is defined in src/routes/panel/+page.svelte
. You can modify this file to change the appearance and behavior of the panel.
Adapting for Other Frameworks
While this example uses Svelte, you can adapt the Tauri code to work with any frontend framework supported by Tauri 2.
Simply copy the Tauri configuration and Rust code to your project and adjust the frontend accordingly.
Special Thanks
This project wouldn't be possible without the contributions of:
License
MIT