Redland
A Wayland screen color temperature adjuster with automatic day/night cycle support, written in Rust. Similar to wlsunset and Redshift, but with a modern Rust implementation and optional QML-based system tray UI.
Features
- Automatic color temperature adjustment based on sunrise/sunset times
- Multiple location methods: GeoClue2, manual coordinates, or fixed times
- Smooth transitions between day and night temperatures
- Manual mode override (Day/Night/Sunset/Auto) with automatic expiration
- IPC control via JSONL stdin/stdout for UI integration
- System tray UI using Quickshell (optional)
- Wayland native using wlr-gamma-control-unstable-v1 protocol
Requirements
- Wayland compositor with
wlr-gamma-control-unstable-v1support (e.g., Sway, Hyprland, river) - Rust toolchain (edition 2024)
- GeoClue2 (optional, for automatic location detection)
- Quickshell (optional, for system tray UI)
Building
# Using cargo directly
# Or with devenv (if using Nix)
The binary will be available at target/release/redland.
Usage
Basic Usage
Run with automatic location detection (via GeoClue2):
Manual Coordinates
Specify latitude and longitude to skip GeoClue:
Fixed Sunrise/Sunset Times
Use manual times (HH:MM format) instead of calculated sunrise/sunset:
Custom Temperature Range
Adjust the temperature range (default: 4000K night, 6500K day):
Transition Duration
Set transition duration around sunrise/sunset (default: 1800 seconds):
Start in Specific Mode
System Tray UI
The included QML-based system tray provides visual mode control:
Features:
- Icon showing current mode (☀️ day, 🌙 night, 🌅 sunset)
- Superscript "A" indicator for automatic mode
- Popup menu for mode selection
- Real-time temperature display
Note: Edit redland-ui.qml and update the daemon path to match your installation.
IPC Protocol
Redland uses a JSON-line protocol over stdin/stdout for UI integration. The daemon is typically spawned by the UI (e.g., redland-ui.qml) and controlled by writing JSONL commands to its stdin and reading responses from stdout.
Commands
Get Status:
Set Mode:
Valid modes: auto, day, night, sunset
Set Temperature Range:
Response Format
Command-Line Options
Options:
-o, --output <OUTPUT> Name/description of outputs to target (can repeat)
-t, --low <LOW_TEMP> Low color temperature at night (K) [default: 4000]
-T, --high <HIGH_TEMP> High color temperature at day (K) [default: 6500]
-l, --lat <LATITUDE> Latitude (degrees)
-L, --lon <LONGITUDE> Longitude (degrees)
-S, --sunrise <SUNRISE> Manual sunrise time HH:MM (local)
-s, --sunset <SUNSET> Manual sunset time HH:MM (local)
-d, --duration <DURATION> Transition duration in seconds [default: 1800]
--mode <MODE> Operating mode [default: auto] [possible values: auto, day, night, sunset]
-h, --help Print help
-V, --version Print version
How It Works
- Location Detection: Uses GeoClue2 D-Bus service, manual coordinates, or fixed times
- Sunrise/Sunset Calculation: Computes solar events using astronomical algorithms
- Phase Detection: Determines current phase (Night/Sunrise/Day/Sunset)
- Temperature Calculation: Interpolates between low and high temperatures during transitions
- Gamma Adjustment: Applies color temperature via Wayland gamma control protocol
- Mode Override: Manual mode selection expires at next sunrise, returning to automatic
Day Phases
- Night: Before dawn or after dusk
- Sunrise: Transition period before sunrise (gradual warming)
- Day: Between sunrise and sunset (high temperature)
- Sunset: Transition period after sunset (gradual cooling)
License
See the source code for license information.