https://github.com/linux-brat/bclicker
A professional Rust-based auto-clicker with a sleek Terminal User Interface
https://github.com/linux-brat/bclicker
auto-clicker cps linux powershell rust rust-crate rust-lang tui windows
Last synced: 5 months ago
JSON representation
A professional Rust-based auto-clicker with a sleek Terminal User Interface
- Host: GitHub
- URL: https://github.com/linux-brat/bclicker
- Owner: linux-brat
- License: mit
- Created: 2025-09-14T16:42:44.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-09-14T17:04:41.000Z (5 months ago)
- Last Synced: 2025-09-14T18:41:44.186Z (5 months ago)
- Topics: auto-clicker, cps, linux, powershell, rust, rust-crate, rust-lang, tui, windows
- Language: Rust
- Homepage:
- Size: 79.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BClicker Professional
[](https://github.com/linux-brat/BClicker/releases)
[](https://github.com/linux-brat/BClicker/blob/main/LICENSE)
[](https://www.rust-lang.org/)
[](https://warp.dev)
**A professional Rust-based auto-clicker with a sleek Terminal User Interface**

## ๐ Project Overview
BClicker Professional is a high-performance auto-clicker application with a TUI (Terminal User Interface) built using crossterm and tui-rs. The application provides professional auto-clicking functionality with global hotkey support, system tray integration, audio feedback, and statistics tracking.
## โจ Key Features
### ๐ฎ Core Features
- ๐ฑ๏ธ **High-Precision Clicking**: Microsecond-accurate timing
- โจ๏ธ **Global Hotkeys**: Control from anywhere (Windows)
- ๐จ **Beautiful TUI**: Terminal-based interface
- ๐ **Statistics Tracking**: Monitor your usage
- ๐ **Audio Feedback**: Optional click sounds
- ๐ฑ **System Tray**: Background operation
### โ๏ธ Technical Features
- ๐ **Multi-threaded**: Non-blocking performance
- ๐ **TOML Configuration**: Human-readable settings
- ๐ **Cross-platform**: Windows & Linux support
- ๐ฆ **Portable**: Single executable
- ๐ช **Zero Dependencies**: Standalone operation
- ๐ **Memory Safe**: Rust guarantees
---
## ๐ ๏ธ Technology Stack
| Component | Technology | Purpose |
| -------------------- | ------------------- | ------------------------------------ |
| ๐ฆ **Language** | Rust (2025 edition) | High-performance systems programming |
| ๐ฅ๏ธ **UI Framework** | tui-rs + crossterm | Terminal-based user interface |
| ๐ฑ๏ธ **Mouse Control** | enigo | Cross-platform mouse automation |
| ๐ **Audio** | rodio | Non-blocking sound effects |
| โ๏ธ **Configuration** | TOML + serde | Human-readable config files |
| ๐ฑ **System Tray** | tray-item | Background system integration |
| ๐ **Notifications** | notify-rust | Cross-platform notifications |
| ๐ช **Platform** | Windows + Win32 API | Global hotkey support |
---
## โก Quick Start (TL;DR)
```bash
# ๐ Get up and running in 30 seconds!
git clone https://github.com/linux-brat/BClicker.git
cd BClicker
cargo run --release
```
**๐ฎ Controls:**
- `Space` - Start/Stop clicking
- `Tab` - Switch between presets
- `h` - Help menu
- `q` - Quit
> ๐ซ **WARP Users**: This works perfectly in WARP terminal with full Unicode support and beautiful rendering!
---
## ๐ฆ Detailed Installation
### ๐ง Prerequisites
- ๐ฆ **Rust toolchain**: Install from [rustup.rs](https://rustup.rs/)
- ๐ **Git**: For cloning the repository
- ๐ช **Windows**: Windows SDK for global hotkey functionality
- ๐ง **Linux**: Audio development libraries (ALSA/PulseAudio)
---
### ๐ป One-Click Installation
#### ๐ช Windows (PowerShell)
```powershell
# ๐ Quick Setup - Copy & Paste!
git clone https://github.com/linux-brat/BClicker.git
cd BClicker
cargo build --release
# โถ๏ธ Run BClicker
.\target\release\bclicker.exe
# ๐ Optional: Add to PATH for global access
# Copy target\release\bclicker.exe to C:\Windows\System32\ or your preferred PATH directory
```
> **๐ Note**: Replace `bclicker.exe` with the actual executable name if different
#### ๐ง Linux (Bash)
```bash
# ๐ฆ Install audio libraries (Ubuntu/Debian)
sudo apt update && sudo apt install libasound2-dev pkg-config
# ๐ For other distributions:
# Fedora: sudo dnf install alsa-lib-devel pkgconf
# Arch: sudo pacman -S alsa-lib pkgconf
# ๐ Quick Setup - Copy & Paste!
git clone https://github.com/linux-brat/BClicker.git
cd BClicker
cargo build --release
# โถ๏ธ Run BClicker
./target/release/bclicker
# ๐ Optional: Install system-wide
sudo cp target/release/bclicker /usr/local/bin/
```
### ๐ฆ Direct Cargo Installation
```bash
# ๐ Install directly from GitHub
cargo install --git https://github.com/linux-brat/BClicker.git
# ๐ Or install from crates.io (when published)
cargo install bclicker
```
---
## โ๏ธ WARP Development Commands
> ๐ก **WARP Users**: These commands work perfectly in WARP terminal with syntax highlighting and autocompletion!
### ๐จ Build & Run Commands
| Command | Description | WARP Tip |
| ----------------------- | -------------------------- | ------------------------------------------------------------ |
| `cargo build` | ๐ Debug build | ๐ Use WARP's AI to explain any build errors |
| `cargo build --release` | โก Optimized release build | ๐ View build progress in WARP's enhanced output |
| `cargo run` | โถ๏ธ Run in debug mode | ๐ Perfect for development with WARP's terminal multiplexing |
| `cargo run --release` | ๐ Run optimized version | โ๏ธ Best performance for testing |
```bash
# ๐ Quick Development Cycle
cargo run # Fast compilation, debug info
cargo run --release # Optimized performance
```
### ๐งช Testing & Code Quality
| Command | Purpose | WARP Feature |
| ----------------------------- | -------------------- | ------------------------------------- |
| `cargo test` | ๐งช Run all tests | ๐ Test results beautifully formatted |
| `cargo check` | โ๏ธ Fast syntax check | โก Lightning-fast feedback loop |
| `cargo fmt` | ๐จ Format code | ๐ Instant code beautification |
| `cargo clippy` | ๐ Lint analysis | ๐ก Smart suggestions in WARP |
| `cargo clippy -- -D warnings` | ๐ก๏ธ Strict linting | ๐ซ Zero tolerance for warnings |
```bash
# ๐ Code Quality Pipeline
cargo check # Quick syntax validation
cargo fmt # Auto-format code
cargo clippy # Catch common issues
cargo test # Ensure everything works
```
### ๐ ๏ธ Development Utilities
```bash
# ๐งผ Clean build artifacts
cargo clean
# ๐ Update dependencies
cargo update
# ๐ณ Show dependency tree
cargo tree
# ๐ Security audit (install with: cargo install cargo-audit)
cargo audit
# ๐ Generate documentation
cargo doc --open
# ๐ Performance profiling
cargo build --release
time ./target/release/bclicker
```
> ๐ซ **WARP Pro Tip**: Use WARP's AI assistant to explain any cargo commands or help debug build issues!
## Architecture Overview
### Core Application Structure
The application follows a modular architecture with clear separation of concerns:
**Main Components:**
1. **App State Management** (`App` struct) - Central application state, configuration, and UI modes
2. **Event System** - Multi-threaded event handling for input, ticking, and quit signals
3. **Auto-Clicker Engine** - Dedicated thread for mouse clicking with precise timing
4. **UI Rendering** - TUI-based interface with dynamic content and help system
5. **System Integration** - Global hotkeys, system tray, and notifications
### Key Data Structures
**Configuration System:**
- `Config` struct handles all persistent settings
- `Statistics` struct tracks usage metrics across sessions
- `KeyCombo` struct represents global hotkey combinations
- Auto-saves to `bclicker_config.toml` in the current directory
**Threading Architecture:**
- **Main Thread**: UI rendering and input handling
- **Clicker Thread**: High-precision mouse clicking loop
- **Event Threads**: Separate threads for input capture and tick events
- **Hotkey Thread**: Windows-specific global hotkey monitoring
- **Audio Threads**: Spawned per-sound for non-blocking audio
### Input Mode System
The application uses a state machine for different input modes:
- `Normal` - Standard navigation and controls
- `EditingCps` - Custom CPS value input
- `SettingKeybind` - Capturing hotkey combinations
- `AwaitingKeybind` - Brief preparation state before capturing
- `ShowingHelp` - Help screen display
### Platform-Specific Features
**Windows Integration:**
- Global hotkey registration via Win32 API (`RegisterHotKey`)
- System message loop for hotkey detection
- Windows-specific virtual key code mapping
**Cross-Platform Considerations:**
- Mouse control works on all platforms via enigo
- System tray and notifications have fallback behavior
- Global hotkeys currently Windows-only with graceful degradation
## Configuration and Data Files
### Primary Configuration File
- **Location**: `bclicker_config.toml` (current directory)
- **Format**: TOML with nested sections
- **Auto-generated**: Creates default config if missing
- **Auto-saved**: Persists changes immediately
### Configuration Structure
```toml
cps_presets = [20, 30, 40, 50] # Available CPS preset values
selected_preset = 2 # Currently selected preset index
custom_cps_value = 99 # User-defined CPS value
using_custom_cps = false # Whether to use custom vs preset
selected_button = 0 # 0=Left, 1=Right mouse button
sound_enabled = false # Audio feedback toggle
[toggle_keybind] # Global hotkey configuration
mods = 6 # Modifier bitmask (1=Shift, 2=Ctrl, 4=Alt)
key = "B" # Key character or function key
[statistics] # Usage tracking
total_clicks = 0 # All-time click count
session_clicks = 0 # Current session clicks
total_sessions = 0 # Number of application launches
last_session_start = 0 # Unix timestamp
session_duration = 0 # Session length in seconds
```
## Development Considerations
### Performance Characteristics
- **Click Precision**: Microsecond-accurate timing using `Duration::from_micros(1_000_000 / cps)`
- **UI Responsiveness**: 60 FPS rendering loop with conditional redrawing
- **Memory Efficiency**: Minimal allocations in hot paths, Arc/Mutex for shared state
- **CPU Usage**: Adaptive sleep timing based on UI visibility
### Thread Safety Patterns
- `Arc` for simple boolean flags (clicker running, UI visibility)
- `Arc>` for complex shared data (statistics, configuration)
- MPSC channels for event communication between threads
- Lock contention minimized through brief critical sections
### Error Handling Strategy
- Graceful degradation for system integration features
- Configuration corruption handled with default fallback
- Non-critical errors logged but don't crash application
- Proper cleanup on exit with terminal restoration
### Key Extension Points
**Adding New Features:**
1. **New Input Modes**: Extend `InputMode` enum and add handlers in `handle_input()`
2. **Additional Statistics**: Add fields to `Statistics` struct with migration logic
3. **Audio Enhancements**: Extend `AudioManager` with new sound methods
4. **Platform Support**: Implement platform-specific modules for hotkeys/tray
**UI Customization:**
- Theme system already in place with `Theme` struct
- Modular widget rendering in `draw_ui()` function
- Help system supports scrolling and formatted content
- Status bar easily extensible with new information
### Common Patterns
**Configuration Changes:**
```rust
// Always save config after modifications
app.config.some_setting = new_value;
app.save_config();
app.needs_redraw = true; // Trigger UI update
```
**Shared State Updates:**
```rust
// Safe access to shared statistics
if let Ok(mut stats) = app.stats_tracker.lock() {
stats.some_field += 1;
// Lock automatically released
}
```
**Event-Driven Updates:**
```rust
// Mark redraw needed for next frame
app.needs_redraw = true;
// Only redraw when UI is visible and needs update
```
## Troubleshooting
### Common Build Issues
- **Missing Windows SDK**: Global hotkeys require Windows development headers
- **Audio Dependencies**: rodio may need system audio libraries on Linux
- **Terminal Compatibility**: Some terminals may not support all TUI features
### Runtime Considerations
- **Hotkey Conflicts**: Global hotkeys may conflict with other applications
- **Permission Issues**: Some antivirus software may flag mouse automation
- **Terminal Encoding**: Unicode characters in UI require UTF-8 terminal support
### Development Tips
- Use `cargo run` for development with debug info and faster compilation
- The application handles terminal cleanup automatically on exit
- Configuration file is human-readable and can be manually edited
- Statistics are preserved across application restarts