Skip to content

๐ŸŒก๏ธ Intelligent screen temperature adjustment for Hyprland with weather-aware automation

License

Notifications You must be signed in to change notification settings

IamAndelib/Auto-blue-light-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Auto-blue-light-filter๐ŸŒก๏ธ

Automatic screen temperature adjustment tool for Hyprland, intelligently adjusting your display's colour temperature based on the time of day, weather conditions, and location.

โœจ Features

  • Automatic temperature adjustment based on time of day and weather
  • Location-aware using IP geolocation
  • Weather integration with OpenWeatherMap API
  • Manual and automatic modes with easy toggling
  • Blue light filter for reduced eye strain
  • Desktop notifications for status updates
  • Comprehensive logging for troubleshooting

๐Ÿ“‹ Requirements

System Requirements

  • Hyprland window manager
  • hyprsunset - Hyprland's screen temperature adjustment tool
  • Python 3.6+
  • notify-send (libnotify) for notifications

Installation of Dependencies

Arch:

sudo pacman -S hyprsunset python python-requests

Ubuntu/Debian:

# Install hyprsunset from source (see hyprsunset documentation)
sudo apt install python3 python3-pip python3-requests libnotify-bin

๐Ÿš€ Installation

# Clone the repository
git clone https://github.com/YOUR_USERNAME/hypr-py-light.git
cd hypr-py-light
chmod +x hypr-py-light.py

โš™๏ธ Configuration

First Time Setup

Run the script for initial configuration:

./hypr-py-light.py

You'll be prompted to enter API keys for:

  1. OpenWeatherMap API (for weather data)
  1. IP Geolocation API (for location detection)

Manual Configuration

Edit ~/.config/hypr-py-light/config.ini:

[API]
openweather = your_openweather_api_key_here
ipgeolocation = your_ipgeolocation_api_key_here

๐ŸŽ›๏ธ Usage

Basic Commands

# Show current status
hypr-py-light status

# Toggle between manual and automatic modes
hypr-py-light manual

# Force automatic mode
hypr-py-light auto

# Force manual mode
hypr-py-light force-manual

# Toggle blue light filter (manual mode only)
hypr-py-light toggle

# Refresh location data
hypr-py-light refresh-location

# Test with specific temperature
hypr-py-light test 4500

# Run as a background daemon
hypr-py-light

Temperature Profiles

  1. Day Clear: 6500K (neutral white)
  2. Day Cloudy: 5800K (slightly warm)
  3. Day Rainy: 5200K (warm)
  4. Night Default: 4600K (warmer)
  5. Night Cold: 4200K (very warm)
  6. Manual Blue Light On: 5000K
  7. Manual Blue Light Off: 6500K

Hyprland Integration

Add to your hyprland.conf:

# Start hypr-py-light automatically
exec-once = /path-to-blue-light.py

# Keybindings
bind = SUPER, F5, exec, ~/path-to-hypr-py-light toggle     # Toggle blue light in manual mode
bind = SUPER, F6, exec, ~/path-to-hypr-py-light manual     # Toggle mode (auto/manual)
bind = SUPER, F7, exec, ~/path-to-hypr-py-light status     # Show status

๐Ÿ“ File Locations

  1. Configuration: ~/.config/hypr-py-light/config.ini
  2. State: ~/.config/hypr-py-light/state.json
  3. Logs: ~/.config/hypr-py-light/hyprlight.log
  4. Cache: ~/.config/hypr-py-light/cache/

๐Ÿ› Troubleshooting

Common Issues

"hyprsunset command not found"

  1. Install hyprsunset: sudo pacman -S hyprsunset (Arch) or build from source

Temperature not changing

  1. Check if hyprsunset is running: pgrep hyprsunset
  2. Check logs: tail ~/.config/hypr-py-light/hyprlight.log
  3. Verify API keys in config file

Location detection not working

  1. Check internet connection
  2. Verify IP Geolocation API key
  3. Use refresh-location command

Service not starting

  1. Check systemd logs: journalctl --user -u hypr-py-light.service
  2. Ensure script has execute permissions
  3. Verify Python dependencies are installed

Debug Mode

Check detailed logs:

tail -f ~/.config/hypr-py-light/hyprlight.log

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss the changes you would like to make.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  1. Hyprland - The amazing window manager
  2. hyprsunset - Screen temperature adjustment tool
  3. OpenWeatherMap - Weather data API
  4. IP Geolocation - Location detection API

๐Ÿ“Š Status Examples

=========================================================
๐Ÿ“ LOCATION & WEATHER
   Location: London, United Kingdom
   Weather: Clear (Clear Sky)
   Temperature: 18.5ยฐC
   Time: Day

๐Ÿ–ฅ๏ธ SCREEN SETTINGS
   Screen Temperature: 6500K
   Mode: Automatic
   Blue Light Filter: OFF

๐Ÿ“‚ FILES
   Config: /home/user/.config/hypr-py-light/config.ini
   State: /home/user/.config/hypr-py-light/state.json
   Logs: /home/user/.config/hypr-py-light/hyprlight.log
==========================================================

๐Ÿ”„ Version History

  1. v1.0.0 - Initial release with automatic temperature adjustment

Made with โค๏ธ for the Hyprland community

About

๐ŸŒก๏ธ Intelligent screen temperature adjustment for Hyprland with weather-aware automation

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages