hyprsunset
repository·main·Indexed 19 days ago
https://github.com/hyprwm/hyprsunsetA blue-light filter utility for the Hyprland compositor that adjusts screen color temperature and gamma. Requires Hyprland version 0.45.0 or newer and support for the hyprland-ctm-control-v1 protocol.
What's inside hyprsunset
- hyprsunset is an application designed to enable a blue-light filter on the Hyprland compositor. It is specifically built for the Hyprland ecosystem to manage screen color temperature.
Requirements for using hyprsunset
mainTo use hyprsunset, you must meet the following requirements:
- Hyprland Version: You must be running
hyprland >= 0.45.0. - Protocol Support: The compositor must support the
hyprland-ctm-control-v1protocol. Because of this dependency, hyprsunset is likely exclusive to Hyprland.
- Hyprland Version: You must be running
Configure hyprsunset temperature and gamma
mainThe
CHyprsunsetclass manages the blue-light filter state through several configurable parameters. You can set the color temperature in Kelvin and adjust the gamma levels.Note that
kelvinSetandidentityflags are used to track whether these values have been explicitly modified from their defaults. Settingidentitytotruetypically reverts the color transformation to a neutral state.CHyprsunset sunset; sunset.KELVIN = 3000; // Set temperature to 3000K sunset.kelvinSet = true; sunset.GAMMA = 0.8f; // Adjust gamma sunset.MAX_GAMMA = 1.0f;Control the hyprsunset lifecycle
mainThe
CHyprsunsetclass provides methods to manage the application lifecycle and the application of color transformation matrices (CTM) to Wayland outputs:init(): Initializes the application state and Wayland connections.calculateMatrix(): Computes the color transformation matrix based on current settings.tick(): Advances the internal state (used in the event loop).loadCurrentProfile(): Loads the profile matching the current time.getCurrentProfile(): Returns anstd::optional<SSunsetProfile>representing the active profile.terminate(): Gracefully shuts down the application.
Manage sunset profiles
mainHyprsunset supports scheduled profiles via the
SSunsetProfilestruct. Each profile defines a specific time (hour and minute) and associated color settings (temperaturein Kelvin andgamma).SSunsetProfile::time: A struct containinghourandminute.SSunsetProfile::temperature: The target Kelvin value (default6000).SSunsetProfile::gamma: The target gamma value (default1.0f).SSunsetProfile::identity: A boolean flag.
You can retrieve the currently active profile using
getCurrentProfile().// Example of what a profile looks like SSunsetProfile profile; profile.time.hour = 20; profile.time.minute = 30; profile.temperature = 2500; profile.gamma = 1.0f;Access sunset profiles and gamma settings via CConfigManager
mainThe
CConfigManagerclass is responsible for managing application settings and configuration state. It useshyprlanginternally to parse configuration files. Developers interacting with the configuration state can retrieve the following:getSunsetProfiles(): Returns astd::vector<SSunsetProfile>containing the available sunset profiles.getMaxGamma(): Returns the maximum gamma value allowed by the configuration.
To use the manager, it must be initialized via
init().// Conceptual usage of the CConfigManager API g_pConfigManager->init(); auto profiles = g_pConfigManager->getSunsetProfiles(); float maxGamma = g_pConfigManager->getMaxGamma();Use hyprsunset CLI flags
mainThe
hyprsunsetcommand-line interface allows you to control display color temperature and gamma settings. You can specify temperature in Kelvin, adjust gamma levels, or use the identity matrix to disable color changes.Available Flags
Flag Short Description --temperature-tSet the temperature in K (default 6000) --gamma-gSet the display gamma (default 100%) --gamma_maxSet the maximum display gamma (default 100%, maximum 200%) --identity-iUse the identity matrix (no color change) --config-cSpecify a path to a configuration file --verbosePrint more logging --version-vPrint the version --help-hPrint this info # Example: Set temperature to 3000K and gamma to 80% hyprsunset -t 3000 -g 80 # Example: Use a specific config file hyprsunset --config /path/to/config.json