rustrland 0.3.8

A Rust implementation of Pyprland for Hyprland - Fast, reliable plugin system
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
<div align="center">

<img src="docs/logo/rustrland_logo.png" alt="Rustrland Logo" width="200">

**Rust-powered window management for Hyprland**

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Rust](https://img.shields.io/badge/rust-1.81+-orange.svg)](https://www.rust-lang.org)
<img src="https://camo.githubusercontent.com/a008fee23e5878dc3caecb71839846a9b3a44afb006a2bcc2eae5fa7dcb6ade6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d616465253230666f722d487970726c616e642d626c7565" alt="Hyprland" data-canonical-src="https://img.shields.io/badge/Made%20for-Hyprland-blue" style="max-width: 100%;">

</div>

## Features

- **⚡ Fast**: Written in Rust for maximum performance and efficiency
- **🔒 Production-Ready**: Memory-safe with comprehensive error handling and 48+ tests
- **🧩 Plugin-based**: Modular architecture with hot-reload and animation systems
- **🔄 Compatible**: Drop-in replacement for Pyprland configurations
- **📦 Easy deployment**: Single binary, no Python dependencies
- **🎯 Multi-monitor**: Intelligent caching with 90% API call reduction
- **🔧 Enhanced IPC**: Robust reconnection logic and event filtering

---

## Installation

### Prerequisites

- **Rust**: Version 1.81 or newer ([Install Rust]https://rustup.rs/)
- **Hyprland**: Compatible window manager ([Install Hyprland]https://hyprland.org/)
- **Environment**: `HYPRLAND_INSTANCE_SIGNATURE` must be set (usually automatic)

### Method 1: From Source (Recommended)

```bash
# Clone the repository
git clone https://github.com/mattdef/rustrland.git
cd rustrland

# Build and install
cargo install --path .
```

### Method 2: Development Build

```bash
# Clone and build in debug mode
git clone https://github.com/mattdef/rustrland.git
cd rustrland
cargo build

# Run directly from source
cargo run --bin rustrland -- --help
cargo run --bin rustr -- --help
```

### Method 3: Release Build

```bash
# Build optimized release version
cargo build --release

# Copy binaries to your PATH
sudo cp target/release/rustrland /usr/local/bin/
sudo cp target/release/rustr /usr/local/bin/
```

### Verify Installation

```bash
# Check daemon version and features
rustrland --version

# Check client connectivity
rustr status

# Verify Hyprland connection
echo $HYPRLAND_INSTANCE_SIGNATURE  # Should show instance ID
```

### Uninstall

To completely remove Rustrland from your system:

```bash
# Remove binaries (if installed via cargo)
cargo uninstall rustrland

# Or manually remove binaries (if copied to /usr/local/bin/)
sudo rm /usr/local/bin/rustrland
sudo rm /usr/local/bin/rustr

# Remove configuration files (optional - keeps your settings)
rm -rf ~/.config/hypr/rustrland.toml
rm -rf ~/.config/rustrland.toml
rm -rf ~/.cache/rustrland/  # Remove any cached data

# Remove from Hyprland autostart (if added)
# Edit ~/.config/hypr/hyprland.conf and remove:
# exec-once = rustrland --config ~/.config/hypr/rustrland.toml

# Kill any running daemon
pkill rustrland

# Clean up socket files
rm -f /tmp/rustrland-*.sock
```

## Configuration

### Overview

Rustrland supports **dual configuration formats** for maximum compatibility:

- **Pyprland Format**: `[pyprland]` - Full compatibility with existing Pyprland configs
- **Rustrland Format**: `[rustrland]` - Native format with enhanced features
- **Dual Format**: Both sections in one file - Rustrland merges them intelligently

### Configuration Locations

Rustrland looks for configuration files in this order:

1. `--config` command line argument
2. `~/.config/hypr/rustrland.toml` (primary)
3. `~/.config/rustrland.toml` (alternative)
4. `./rustrland.toml` (current directory)

### Creating Your Configuration

Create your configuration file at `~/.config/hypr/rustrland.toml`:

#### Basic Pyprland-Compatible Configuration

```toml
[pyprland]
plugins = ["scratchpads"]

[pyprland.variables]
term_classed = "foot --app-id"
browser_class = "firefox"
filemanager_class = "thunar"

[scratchpads.term]
command = "[term_classed] dropterm"
class = "dropterm"
size = "75% 60%"
animation = "fromTop"

[scratchpads.browser]
command = "firefox --new-window --class=[browser_class]"
class = "[browser_class]"
size = "90% 85%"
position = "center"

[scratchpads.filemanager]
command = "thunar --class=[filemanager_class]"
class = "[filemanager_class]"
size = "80% 70%"
position = "center"
```

#### Advanced Rustrland Native Configuration

```toml
[rustrland]
plugins = ["scratchpads", "expose", "workspaces_follow_focus", "magnify"]

[rustrland.variables]
term_classed = "foot --app-id"
browser_class = "firefox"
filemanager_class = "thunar"
music_class = "spotify"

# Enhanced scratchpad with all features
[scratchpads.term]
command = "[term_classed] dropterm"
class = "dropterm"
size = "75% 60%"
position = "center"
animation = "fromTop"
lazy = true
pinned = false
excludes = ["class:^org\\.gnome\\..*"]

# Multi-monitor aware scratchpad
[scratchpads.browser]
command = "firefox --new-window --class=[browser_class]"
class = "[browser_class]"
size = "90% 85%"
position = "center"
multi_monitor = true
preserve_aspect = true

# Mission Control-style expose (v0.3.0+ - Full Implementation)
[expose]
# Grid layout and visual settings
padding = 25                      # Padding between windows in pixels
scale = 0.3                       # Window scale factor (0.1-1.0)
show_titles = true                # Display window titles
background_color = "#000000CC"    # Semi-transparent overlay
highlight_color = "#FF6600"       # Selection highlight color

# Animation and performance
animation = "fromTop"             # Animation type (fromTop, fromBottom, etc.)
animation_duration = 250          # Animation duration in milliseconds
max_windows = 30                  # Performance limit (prevents slowdown)

# Advanced features
include_floating = true           # Include floating windows
include_minimized = false         # Include minimized windows
current_workspace_only = false    # Limit to current workspace
enable_caching = true            # Thumbnail caching for performance
mouse_selection = true           # Mouse click selection support
target_monitor = "auto"          # Target monitor ("auto", "DP-1", etc.)

# Multi-monitor workspace management
[workspaces_follow_focus]
follow_window_focus = true
allow_cross_monitor_switch = true
workspace_switching_delay = 100

# Viewport magnification
[magnify]
factor = 2.0
duration = 300
smooth_animation = true
min_zoom = 1.0
max_zoom = 5.0
increment = 0.5
```

#### Dual Format Configuration

```toml
# Legacy Pyprland section (for compatibility)
[pyprland]
plugins = ["scratchpads"]

[pyprland.variables]
term_classed = "foot --app-id"

# Enhanced Rustrland section (overrides and extends)
[rustrland]
plugins = ["scratchpads", "expose", "workspaces_follow_focus"]

[rustrland.variables]
browser_class = "firefox"  # Additional variables

# Scratchpad definitions (shared between formats)
[scratchpads.term]
command = "[term_classed] dropterm"
class = "dropterm"
size = "75% 60%"
animation = "fromTop"

[scratchpads.browser]
command = "firefox --class=[browser_class]"
class = "[browser_class]"
size = "90% 85%"

[expose]
padding = 20
scale = 0.2
```

### Configuration Examples

The `examples/` directory contains ready-to-use configurations:

- `examples/pyprland-compatible.toml` - Drop-in Pyprland replacement
- `examples/rustrland-native.toml` - Full Rustrland features
- `examples/dual-config.toml` - Hybrid configuration approach
- `examples/advanced-animations.toml` - Animation system showcase

## Usage

### Starting Rustrland

#### As a Daemon (Recommended)

```bash
# Start with default config location
rustrland

# Start with specific config file
rustrland --config ~/.config/hypr/rustrland.toml

# Start in foreground with debug output
rustrland --debug --foreground

# Start as background service
rustrland --config ~/.config/hypr/rustrland.toml &
```

#### Auto-start with Hyprland

Add to your `~/.config/hypr/hyprland.conf`:

```bash
# Auto-start Rustrland daemon
exec-once = rustrland --config ~/.config/hypr/rustrland.toml
```

### Client Commands

#### Scratchpad Management

```bash
# Toggle scratchpads
rustr toggle term        # Toggle terminal scratchpad
rustr toggle browser     # Toggle browser scratchpad
rustr toggle filemanager # Toggle file manager scratchpad
rustr toggle music       # Toggle music player scratchpad

# List and manage
rustr list              # List all available scratchpads
rustr status            # Check daemon status and uptime
```

#### Window Overview (Expose) - v0.3.0+ Enhanced

```bash
# Mission Control-style window overview with full navigation
rustr expose                 # Toggle expose mode with all windows in grid
rustr expose next           # Navigate to next window in sequence
rustr expose prev           # Navigate to previous window in sequence

# Advanced navigation (v0.3.0+)
rustr expose up             # Navigate up in grid
rustr expose down           # Navigate down in grid
rustr expose left           # Navigate left in grid
rustr expose right          # Navigate right in grid
rustr expose home           # Jump to first window
rustr expose end            # Jump to last window

# Selection and control
rustr expose select         # Select current window and exit
rustr expose select x y     # Mouse selection at coordinates
rustr expose status         # Show detailed status with metrics
rustr expose exit           # Exit expose mode without selection
```

#### Workspace Management

```bash
# Cross-monitor workspace switching
rustr workspace switch 1    # Switch to workspace 1 (on focused monitor)
rustr workspace switch 2    # Switch to workspace 2 (on focused monitor)
rustr workspace change +1   # Switch to next workspace
rustr workspace change -1   # Switch to previous workspace
rustr workspace list        # List all workspaces and monitors
```

#### Magnification/Zoom

```bash
# Viewport magnification
rustr magnify toggle        # Toggle zoom (1.0x ↔ 2.0x)
rustr magnify in           # Zoom in by increment (default 0.5)
rustr magnify out          # Zoom out by increment
rustr magnify set 3.0      # Set absolute zoom level
rustr magnify reset        # Reset zoom to 1.0x
rustr magnify status       # Show current zoom level
```

### Command Line Options

#### Daemon Options

```bash
rustrland --help
  -c, --config <FILE>     Configuration file path
  -d, --debug            Enable debug logging
  -f, --foreground       Run in foreground (don't daemonize)
  -v, --version          Show version information
```

#### Client Options

```bash
rustr --help
  -h, --help            Show help message
  -v, --version         Show version information
  --socket <PATH>       Custom socket path
```

## Keyboard Integration

### Basic Keybindings

Add these to your `~/.config/hypr/hyprland.conf` for essential functionality:

```bash
# Scratchpad keybindings
bind = SUPER, grave, exec, rustr toggle term        # Super + ` (backtick)
bind = SUPER, B, exec, rustr toggle browser         # Super + B
bind = SUPER, F, exec, rustr toggle filemanager     # Super + F
bind = SUPER, M, exec, rustr toggle music           # Super + M

# Window overview (Mission Control) - v0.3.0+ Enhanced
bind = SUPER, TAB, exec, rustr expose               # Super + Tab (toggle)
bind = SUPER, j, exec, rustr expose next            # Super + J (next window)
bind = SUPER, k, exec, rustr expose prev            # Super + K (prev window)
bind = SUPER, Return, exec, rustr expose select     # Super + Enter (select)
bind = SUPER, Escape, exec, rustr expose exit       # Super + Esc (exit)

# Workspace management
bind = SUPER, 1, exec, rustr workspace switch 1     # Super + 1
bind = SUPER, 2, exec, rustr workspace switch 2     # Super + 2
bind = SUPER, 3, exec, rustr workspace switch 3     # Super + 3
bind = SUPER, Right, exec, rustr workspace change +1 # Super + Right
bind = SUPER, Left, exec, rustr workspace change -1  # Super + Left

# Magnification
bind = SUPER, equal, exec, rustr magnify in          # Super + = (zoom in)
bind = SUPER, minus, exec, rustr magnify out         # Super + - (zoom out)
bind = SUPER, 0, exec, rustr magnify reset           # Super + 0 (reset)

# Utility
bind = SUPER, L, exec, rustr list                   # Super + L (list all)
bind = SUPER_SHIFT, S, exec, rustr status           # Super + Shift + S
```

### Advanced Keybindings

```bash
# Expose navigation
bind = SUPER, j, exec, rustr expose next             # Navigate expose
bind = SUPER, k, exec, rustr expose prev             # Navigate expose
bind = SUPER, Return, exec, rustr expose select      # Select in expose
bind = SUPER, Escape, exec, rustr expose exit        # Exit expose

# Advanced workspace management
bind = SUPER_SHIFT, 1, exec, rustr workspace switch 1  # Force workspace 1
bind = SUPER_SHIFT, 2, exec, rustr workspace switch 2  # Force workspace 2
bind = SUPER_CTRL, Right, exec, rustr workspace list   # List workspaces

# Magnification control
bind = SUPER_SHIFT, equal, exec, rustr magnify set 2.0    # 2x zoom
bind = SUPER_SHIFT, 3, exec, rustr magnify set 3.0        # 3x zoom
bind = SUPER_SHIFT, 0, exec, rustr magnify toggle         # Toggle zoom
```

### Installation Script

For automatic keybinding setup:

```bash
# Download and run the keybinding setup script
curl -sSL https://raw.githubusercontent.com/mattdef/rustrland/master/scripts/install-keybindings.sh | bash
```

See [KEYBINDINGS.md](KEYBINDINGS.md) for complete setup guide and alternative key schemes.

## Troubleshooting

### Common Issues

#### Daemon won't start

```bash
# Check Hyprland environment
echo $HYPRLAND_INSTANCE_SIGNATURE  # Should show instance ID

# Verify Hyprland is running
hyprctl version

# Check configuration syntax
rustrland --config ~/.config/hypr/rustrland.toml --debug --foreground
```

#### Client can't connect

```bash
# Check if daemon is running
rustr status

# Check socket permissions
ls -la /tmp/rustrland-*.sock

# Restart daemon
pkill rustrland
rustrland &
```

#### Scratchpads not working

```bash
# Test application command manually
foot --app-id dropterm  # Should work outside Rustrland

# Check window class detection
hyprctl clients | grep -i dropterm

# Verify configuration
rustr list  # Should show your scratchpads
```

### Debug Mode

For detailed troubleshooting:

```bash
# Run daemon with debug output
rustrland --debug --foreground

# Check logs (if using systemd)
journalctl -f -u rustrland

# Verbose client output
rustr --debug toggle term
```

## Development

### Building from Source

```bash
# Clone and build
git clone https://github.com/mattdef/rustrland.git
cd rustrland
cargo build

# Run in development mode
cargo run --bin rustrland -- --debug --foreground

# Run client from source
cargo run --bin rustr -- --help
```

### Development Commands

```bash
# Run comprehensive tests (48+ tests)
cargo test

# Run specific test suites
cargo test --lib scratchpads       # 20 scratchpad tests
cargo test --lib animation         # 16 animation tests
cargo test --lib enhanced_client   # Enhanced client tests

# Code quality
cargo fmt                          # Format code
cargo clippy -- -D warnings       # Lint (fails on warnings)

# Full CI pipeline
make ci                           # fmt + lint + test + build
```

### Project Structure

```
rustrland/
├── src/
│   ├── main.rs              # Daemon entry point
│   ├── ...                  # Client entry point
│   ├── config/              # Configuration system
│   │   └── mod.rs           # Rustrland config
│   ├── core/                # Core daemon and plugin management
│   │   ├── daemon.rs        # Main daemon loop
│   │   └── ...              # Hot reload system
│   ├── ipc/                 # IPC communication
│   │   ├── mod.rs           # Hyprland IPC client
│   │   └── ...              # Unix socket server
│   ├── animation/           # Animation system
│   │   ├── timeline.rs      # Keyframe timelines
│   │   └── ...              # And more
│   └── plugins/             # Plugin implementations
│       ├── scratchpads.rs   # Production-ready scratchpads
│   │   └── ...              # And more
├── examples/                # Configuration examples
├── tests/                   # Integration tests
└── docs/                    # Documentation
```

## Supported Plugins

- **scratchpads**: Production-ready dropdown terminals and applications with multi-monitor support (20/20 tests)
-**expose**: Mission Control-style window overview with grid layout and navigation (Integrated tests)
-**workspaces_follow_focus**: Multi-monitor workspace management with cross-monitor switching (Integrated tests)
-**magnify**: Viewport zooming and magnification with smooth animations (Integrated tests)
-**shift_monitors**: Shift workspaces between monitors with configurable direction (Integrated tests)
-**toggle_special**: Manage Hyprland special workspaces with multi-workspace support (Integrated tests)
-**monitors**: Advanced monitor management with relative positioning and hotplug support (15/15 tests)
-**wallpapers**: Hardware-accelerated wallpaper management with interactive carousel navigation (15/15 tests)
-**system_notifier**: Log monitoring with animated desktop notifications and Pyprland compatibility (10/10 tests)

### Plugin Status Summary

| Plugin | Status | Tests | Key Features |
|--------|--------|-------|-------------|
| **Scratchpads** | ✅ Production | 20/20 | Multi-monitor, caching, events, Pyprland compatible |
| **Expose** | ✅ Production | Integrated | Grid layout, navigation, Mission Control experience |
| **Workspaces Follow Focus** | ✅ Development | Integrated | Cross-monitor, focus following, workspace rules |
| **Magnify** | ✅ Production | Integrated | Zoom, animations, accessibility support |
| **Shift Monitors** | ✅ Production | Integrated | Workspace shifting between monitors |
| **Toggle Special** | ✅ Development | Integrated | Special workspace management |
| **Monitors** | ✅ Development | 15/15 | Relative positioning, hotplug, hardware acceleration |
| **Wallpapers** | ✅ Production | 15/15 | Hardware accel, carousel, multi-monitor support |
| **System Notifier** | ✅ Production | 10/10 | Log monitoring, animations, desktop notifications |

**Total**: 6 production-ready plugins with 60+ comprehensive tests passing across all functionality.

## License

MIT License - see [LICENSE](LICENSE) for details.

## Contributing

Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

---

<div align="center">
<img src="docs/logo/rustrland_logo.png" alt="Rustrland" width="100">
<br>
<strong>🦀 Rustrland - Rust-powered window management for Hyprland</strong>
</div>