Introduction
Do you find yourself working late into the night, only to realize your screen’s harsh blue light has been keeping you wide awake? You’re not alone. The blue light emitted by computer screens can disrupt your circadian rhythm and make it harder to fall asleep after extended computer use.
Fortunately, Linux users have an excellent solution: Redshift. This powerful tool automatically adjusts your screen’s color temperature throughout the day, shifting from cool daylight colors (6500K) to warm, amber tones (3000-4500K) as evening approaches. Think of it as flux for Linux, but with more customization options and better integration with various desktop environments.
While this guide focuses primarily on XFCE4, the instructions work across most Linux desktop environments including GNOME, KDE, and others. Whether you’re a night owl programmer, a digital artist, or someone who simply wants to reduce eye strain, this guide will help you set up the perfect warm light configuration for your workflow.
What You’ll Learn
- How to install and configure Redshift on Linux
- Multiple methods to set your location coordinates
- Troubleshooting common Redshift issues
- Creating custom day/night mode toggles
- Advanced configuration options for power users
Let’s dive into creating a more comfortable computing experience that works with your natural sleep cycle.
How to install and configure Redshift
Installing Redshift
Most Linux distributions include Redshift in their repositories:
Ubuntu/Debian:
sudo apt update sudo apt install redshift
Fedora:
sudo dnf install redshift
Arch Linux:
sudo pacman -S redshift
openSUSE:
sudo zypper install redshift
Finding Your Location Coordinates
Redshift needs your location to calculate sunrise and sunset times. Here are several ways to find your coordinates:
Method 1: Google Maps (Easiest)
- Go to maps.google.com
- Right-click on your location
- Click “What’s here?” or the coordinates that appear
- Note the format: latitude, longitude (e.g., 40.7128, -74.0060)
Method 2: Command Line
# Get approximate coordinates from your IP curl -s "http://ip-api.com/line/?fields=lat,lon"
Method 3: Search Online
Simply search “[your city] coordinates” in any search engine.
Example Coordinates:
- New York: 40.7128, -74.0060
- London: 51.5074, -0.1278
- Manila: 14.5995, 120.9842
- Tokyo: 35.6762, 139.6503
Basic Configuration
Quick Start (Manual Location)
Replace LAT:LON with your coordinates:
redshift -l 40.7128:-74.0060
Creating a Configuration File
For persistent settings, create ~/.config/redshift.conf
:
; Redshift configuration file ; This config automatically adjusts screen color temperature based on time of day ; You can manually override for permanent daylight or night modes [redshift] ; Day temperature (6500K = daylight white) ; For permanent daylight mode: comment out temp-night line below temp-day=6500 ; Night temperature (3500K = warm/reduced blue light) ; For permanent night mode: comment out temp-day line above temp-night=3500 ; Smooth transition between day/night modes (1=enabled, 0=disabled) fade=1 ; Day brightness (1.0 = full brightness) ; For permanent daylight: ensure this is set to your preferred level brightness-day=1.0 ; Night brightness (0.8 = 80% brightness) ; For permanent night mode: ensure this is set to your preferred level brightness-night=0.8 ; Gamma correction (0.8 = slightly reduced gamma) gamma=0.8 ; Location provider - using manual coordinates location-provider=manual ; Adjustment method for screen color changes adjustment-method=randr [manual] ; Manila, Philippines coordinates ; Change these if you're in a different location lat=14.52 lon=121.07 ; MANUAL OVERRIDE INSTRUCTIONS: ; For permanent daylight (no color temperature changes): ; 1. Comment out the temp-night line by adding ; at the beginning ; 2. Ensure temp-day is set to your preferred daylight temperature ; Example: ;temp-night=3500 ; For permanent night mode (always warm/reduced blue light): ; 1. Comment out the temp-day line by adding ; at the beginning ; 2. Ensure temp-night is set to your preferred night temperature ; Example: ;temp-day=6500 ; After making changes, restart redshift for changes to take effect ; Command: pkill redshift && redshift &
Configuration Breakdown:
- temp-day: Daylight color temperature (6500K = cool white)
- temp-night: Evening color temperature (3500K = warm amber)
- fade: Smooth transitions (1 = enabled)
- brightness-night: Reduce screen brightness at night
Advanced Usage and Troubleshooting
Manual Day/Night Mode Toggle
Add these aliases at bottom of your ~/.bashrc
, or ~/.zshrc
:
# Always reset before applying new temperature # ~/.bashrc or ~/.zshrc # --- Enhanced Redshift Aliases --- # Stop any running Redshift instance and reset the screen. # `pkill redshift` stops the background process causing the conflict. # `|| true` prevents an error if no process is found. # `redshift -x` resets the color to neutral. alias redshift-stop="pkill redshift || true && redshift -x -m randr" # Night modes with 80% brightness. # These now use redshift-stop to ensure no conflicts. alias night-mode1="redshift-stop && redshift -m randr -O 4500K -b 0.8" alias night-mode2="redshift-stop && redshift -m randr -O 4000K -b 0.8" alias night-mode3="redshift-stop && redshift -m randr -O 3500K -b 0.8" alias night-mode4="redshift-stop && redshift -m randr -O 3000K -b 0.8" # Day mode with 100% brightness. alias day-mode1="redshift-stop && redshift -m randr -O 6500K -b 1.0"
Note: If you will go in Manual setup please remove the ~/.config/redshift.conf
that you’ve created before.
Common Issues and Solutions
Issue 1: GeoClue2 Timeout
Unable to obtain GeoClue client path: Timeout was reached.
Solution: Use manual location instead of automatic detection.
Issue 2: Wayland Display Error (XFCE4)
Could not connect to wayland display, exiting.
Solution: This is normal for XFCE4 (X11). Redshift will automatically fall back to randr method.
Issue 3: Temperature Stacking If colors become progressively warmer with each command, you’re stacking filters. Solution: Always use redshift -x
to reset before applying new temperatures.
Creating a Toggle Script
Create ~/toggle-redshift.sh
:
#!/bin/bash # A robust script to control Redshift modes, inspired by the alias setup. # --- Configuration --- # You can easily adjust these default values. DEFAULT_NIGHT_TEMP=3500 DAY_TEMP=6500 BRIGHTNESS_NIGHT=0.8 BRIGHTNESS_DAY=1.0 ADJUST_METHOD="randr" # --- Main Logic --- # Always stop any running Redshift instance first to avoid conflicts. pkill redshift || true case "$1" in night) # Use the second argument for temperature if provided, otherwise use the default. TEMP=${2:-$DEFAULT_NIGHT_TEMP} redshift -m "$ADJUST_METHOD" -O "${TEMP}K" -b "$BRIGHTNESS_NIGHT" echo "Redshift: Night mode enabled (${TEMP}K, ${BRIGHTNESS_NIGHT} brightness)." ;; day) # Reset the screen to default day settings (6500K, 1.0 brightness). redshift -x -m "$ADJUST_METHOD" echo "Redshift: Day mode enabled (Default ${DAY_TEMP}K)." ;; auto) # Start Redshift in automatic, background mode using your .conf file. redshift -m "$ADJUST_METHOD" & echo "Redshift: Automatic mode started." ;; off) # pkill already ran, so we just reset the screen to neutral. redshift -x -m "$ADJUST_METHOD" echo "Redshift: Turned off." ;; *) echo "Usage: $(basename "$0") {day|night [temp]|auto|off}" echo " Examples:" echo " $(basename "$0") night # Uses default night temp ($DEFAULT_NIGHT_TEMP K)" echo " $(basename "$0") night 4000 # Uses a custom 4000K temp" echo " $(basename "$0") day" exit 1 ;; esac
Make it executable: chmod +x ~/toggle-redshift.sh
Then use:
./toggle-redshift.sh night # Night mode ./toggle-redshift.sh day # Day mode ./toggle-redshift.sh auto # Start automatic mode ./toggle-redshift.sh off # Switch off redshift
Note: If you will go in toggle-redshift.sh script please remove the ~/.config/redshift.conf
that you’ve created before.
Autostart Configuration
XFCE4 Method
- Open Settings Manager → Session and Startup
- Click Application Autostart tab
- Click Add
- Set:
- Name: Redshift
- Description: Blue light filter
- Command:
redshift
Alternative: Desktop File Method
Create ~/.config/autostart/redshift.desktop
:
[Desktop Entry] Version=1.0 Type=Application Name=Redshift Comment=Blue light filter Exec=redshift Icon=redshift Terminal=false Categories=Utility; StartupNotify=false
GUI Options
For users who prefer graphical interfaces:
Install Redshift GTK
sudo apt install redshift-gtk # Ubuntu/Debian
This provides:
- System tray icon
- Right-click context menu
- Easy enable/disable toggle
- Visual status indicator
XFCE4 Panel Plugin
Some distributions offer a Redshift panel plugin through package managers or as third-party additions.
Key Benefits You’ll Experience:
Immediate Comfort: Reduced eye strain during evening computing sessions means you can work longer without discomfort.
Better Sleep: The gradual transition to warm light helps signal to your brain that it’s time to wind down, leading to easier sleep transitions.
Increased Productivity: When your eyes aren’t fighting harsh blue light, you’ll find yourself more focused and less fatigued during long work sessions.
Customization Freedom: Unlike built-in solutions, Redshift gives you complete control over color temperatures, transition times, and brightness levels.
Pro Tips for Optimal Usage:
- Start Conservative: Begin with milder settings (4500K night temperature) and gradually work down to warmer temperatures as you adapt.
- Match Your Schedule: If you’re a night owl, adjust the dawn/dusk times to match your actual sleep schedule rather than solar times.
- Consider Your Work: If you do color-critical work (photo editing, graphic design), create easy toggles to disable Redshift when precision is needed.
- Experiment with Brightness: Don’t just adjust color temperature—reducing brightness at night can be equally beneficial.
The beauty of Redshift lies in its “set it and forget it” nature. Once configured, it works silently in the background, adapting your display to support healthier computing habits. Your eyes (and your sleep schedule) will thank you.
Final Thoughts
Redshift is more than just a blue light filter—it’s an investment in your long-term eye health and sleep quality. By automatically adjusting your screen’s color temperature throughout the day, you’re working with your body’s natural circadian rhythm instead of against it.