Skip to content

Add Hyprsunset for Blue Light Filtering / Nightlight#447

Merged
dhh merged 17 commits into
basecamp:devfrom
JaxonWright:hyprsunset
Aug 3, 2025
Merged

Add Hyprsunset for Blue Light Filtering / Nightlight#447
dhh merged 17 commits into
basecamp:devfrom
JaxonWright:hyprsunset

Conversation

@JaxonWright
Copy link
Copy Markdown
Contributor

@JaxonWright JaxonWright commented Aug 2, 2025

Description

A blue light filter is useful when using a computer at night / in the dark so you experience less eye fatigue. hyprsunset is an official hyprland plugin that adds this functionality.

#81 attempted to add this, but DHH rejected it due to hyprsunset setting a slight amount of filtering by default when it runs. I figured out how to make it not do that by default. It just needed a config file.

Keyboard Shortcut

This PR adds a default keybind for toggling nightlight. The keybind is SUPER+CTRL+N (for "Nightlight"). This will trigger a notification telling you the state, but your eyes should also be able to tell.

Notifications

image image

Optional Waybar Toggle

This was originally in the PR, but DHH wanted me to remove it. If you want a simple toggle for hyprsunset in waybar, add the following to the config.jsonc for waybar:

In "modules_right":
"custom/nightlight",

Somewhere in the top-level, like above "network":

  "custom/nightlight": {
    "exec": "hyprctl hyprsunset temperature | jq --unbuffered --compact-output -Rn '{alt: input}",
    "format": "{icon}",
    "format-icons": {
      "4000": "",
      "default": ""
    },
    "tooltip-format": "Nightlight",
    "interval": "once",
    "on-click": "omarchy-toggle-nightlight",
    "signal": 8
  },

I also recommend adding #custom-nightlight to the CSS that adds left and right margin to #tray and a bunch of other items. This keeps the spacing consistent.

Off:
image

On:
image

I made this use a 4000K color temperature when enabled. If this is too much or too little, let me know. You can play around with the value by changing the 4000 value in the "custom/nightlight" section of the Waybar config.jsonc

The keyboard shortcut mentioned above triggers in a way that updates this waybar module with the state.

Auto-Enabling By Time?

You can add profiles to trigger at specific times, but I find that essentially useless. What I have not figured out is a way to make it turn on/off automatically at sunset and sunrise based on your location and time of year. If anyone figures that out, please contribute or comment!

Migration

The migration does the following:

  1. Installs hyprsunset via yay
  2. Copies the new, default hyprsunset.conf into the hypr config folder
  3. kills and starts hyprsunset

Useful Links

@JaxonWright
Copy link
Copy Markdown
Contributor Author

I would like the tooltip for the waybar widget to show the state (like with an [ON] or [OFF] at the end), but can't figure it out as of now.

@JaxonWright JaxonWright changed the title Add Hyprsunset for Blue Light Filtering Add Hyprsunset for Blue Light Filtering / Nightlight Aug 2, 2025
@ludo237
Copy link
Copy Markdown
Contributor

ludo237 commented Aug 2, 2025

Going to try this one out because i had issues with a custom implementation i did with hyprsunset. If it works it's a good thing to have.

@riegojerey
Copy link
Copy Markdown

in auto enabling time, geo location, i use sunsetr. It uses hyprsunset and automatically enables if in your location is sunset and disables if sunrise

https://github.com/psi4j/sunsetr

@dhh
Copy link
Copy Markdown
Member

dhh commented Aug 2, 2025

This is a nice implementation, but I don't think it's worth a default spot in the icon toolbar. You don't actually need the indication that it's on, imo. So I think we're better off doing this like we did toggle-idle. It's on a hotkey and we tell you status using notify-send. Let's give that a try instead of using the icon.

@JaxonWright
Copy link
Copy Markdown
Contributor Author

@dhh ok, I will work on that. Could I at least leave the waybar module in there, but commented out? I feel that many people will want control over this in that spot, similar to a phone's quick settings or the Gnome Desktop.

@dhh
Copy link
Copy Markdown
Member

dhh commented Aug 2, 2025

I think better to document how to add this in the Manual section of discussions.

@JaxonWright
Copy link
Copy Markdown
Contributor Author

@dhh this should be good to go unless the migration needs to do something to the omarchy-toggle-nightlight script.

Comment thread config/waybar/style.css Outdated
Comment thread migrations/1754109724.sh Outdated
Comment thread bin/omarchy-toggle-nightlight Outdated
Comment thread bin/omarchy-toggle-nightlight Outdated
@dhh dhh merged commit 3fb1bf9 into basecamp:dev Aug 3, 2025
@JaxonWright JaxonWright deleted the hyprsunset branch August 3, 2025 16:49
@gravewhisper
Copy link
Copy Markdown

@JaxonWright thanks for this. removing my failed hyprsunset install xd

chriopter pushed a commit to chriopter/omarchy that referenced this pull request Nov 18, 2025
* install hyprsunset when installing other hypr packages

* add hyprsunset to autostart

* add default hyprsunset config to make it do nothing by default

* waybar: add hyprsunset shortcut next to bluetooth shortcut to quickly toggle blue light filtering

* waybar: fix icon switching for hyprsunset widget

* add migration for hyprsunset

* waybar: rename "Blue Light Filter" to "Nightlight"

* waybar: make nightlight module appear next to bluetooth module

* waybar: do not include nightlight module by default

* add omarchy-toggle-nightlight script

* add default keybinding for toggling hyprsunset nightlight (SUPER + CTRL + N)

* waybar: remove nightlight module from config entirely

* waybar: remove nightlight from css

* update hyprsunset migration to skip yay install if already installed

* omarchy-toggle-nightlight: use `omarchy-restart-waybar` script instead of pkill with -SIG

* omarchy-toggle-nightlight: only restart waybar if nightlight is in the waybar config

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants