A cross-platform system tray application that prevents your system from going to sleep. Built with Rust and Tauri 2.0.
- Prevent system sleep with a single click
- Screen Control Modes:
- Keep Screen On: Prevents both system sleep and screen turning off (Windows only)
- Allow Screen Off: Keeps system awake but allows screen to sleep/turn off
- System tray integration for easy access
- Start at login option
- Cross-platform support (Windows, macOS, Linux)
- Minimal resource usage
- No visible interference with your work
Download the latest release for your platform from the Releases page.
- Rust (1.70.0 or later)
- Node.js (18.0.0 or later)
- Platform-specific dependencies for Tauri - See Tauri Prerequisites
Clone the repository
git clone https://github.com/Swatto86/tea.git cd teaBuild the application
cargo tauri build
The compiled application will be available in src-tauri/target/release.
- Launch the application
- Click the system tray icon (appears in your taskbar/menu bar)
- Select "Disable Sleep" to prevent your system from sleeping
- Choose your screen mode:
- Keep Screen On: Prevents screen from turning off (Windows: uses native API)
- Allow Screen Off: Lets screen sleep but keeps system awake
- Optionally enable "Start at Login" for automatic startup
Tea uses an intelligent approach combining F15 key simulation with platform-specific display control:
- Keep Screen On mode: Uses Windows
SetThreadExecutionStateAPI withES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIREDflags + F15 simulation for redundancy - Allow Screen Off mode: Uses only the Windows API with
ES_SYSTEM_REQUIREDflag (no F15), which keeps the system awake while allowing the screen to sleep normally
- Simulates a function key (F15) press every 60 seconds to prevent system sleep
- Non-intrusive method that doesn't interfere with your work
- Only "Keep Screen On" mode available - F15 simulation prevents both system and display sleep, making "Allow Screen Off" technically impossible on these platforms
F15 was chosen because it is non-standard on most keyboards and therefore unlikely to conflict with application shortcuts or user workflows. Most applications don't bind actions to F15, making it safe to simulate without interrupting your work.
Your preferences (sleep mode and screen control) are automatically saved to:
- Windows:
%LOCALAPPDATA%\tea\state.json - Linux:
~/.config/tea/state.json - macOS:
~/Library/Application Support/tea/state.json
The "Start at Login" feature uses platform-specific mechanisms:
- Windows: Registry entry at
HKCU\Software\Microsoft\Windows\CurrentVersion\Run - macOS: LaunchAgent plist in
~/Library/LaunchAgents - Linux: Desktop file in
~/.config/autostart
- Minimal system impact with F15 key simulation
- Works reliably in the background on all platforms
- Additional Windows-specific screen control when needed
- Preserves your settings between sessions
tea/
├── src/ # Frontend (minimal - app is system tray only)
│ └── main.ts # Entry point (no interactive UI)
├── src-tauri/ # Rust backend code
│ ├── src/ # Source files
│ │ ├── main.rs # Application entry and tray setup
│ │ ├── commands.rs # Tauri command handlers
│ │ ├── core/ # Pure business logic
│ │ ├── persistence.rs # State file management
│ │ ├── platform.rs # Platform-specific power APIs
│ │ └── wake_service.rs # Background wake service
│ ├── icons/ # Application icons
│ └── Cargo.toml # Rust dependencies
├── tests/ # Test suite
│ ├── autostart.test.ts # Autostart documentation tests
│ ├── e2e.test.ts # End-to-end tests
│ └── frontend.test.ts # Frontend structure tests
└── README.md # This file
Run the test suite:
npm test# Watch mode
npm run test:run # Single run
npm run test:coverage # With coverage reportNote: Tea is a system tray-only application. The HTML window is not shown to users, so frontend tests validate basic structure while the real UI is the system tray menu.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.