Dvsk

An open-source alternative to f.lux for macOS: a small menu bar app that makes your screen warmer in the evening.
Dvsk changes each display’s gamma tables, the same way f.lux does. It is a proof of concept, kept small and readable.
Features
- Scheduled warm-up: turns warm at fixed times (default 20:00 to 07:00) with a smooth 30-minute fade.
- Night temperature slider: 1200K to 6500K, with a live preview.
- Darkroom mode: the whole screen goes red, to protect your night vision.
- Disable for an hour: a countdown appears next to the menu bar icon while it’s paused.
- Launch at login: an option in the menu bar menu, off until you turn it on. It needs the installed app, so it is unavailable under
swift run. You can also switch it off in System Settings → General → Login Items & Extensions.
- Safe exit: normal colours come back when you quit, press Ctrl-C or send
kill -TERM.
Requirements
- macOS 15 or later (Apple Silicon or Intel)
- To build from source: Xcode 16 or the Swift 6 toolchain
Install
With Homebrew:
brew install --cask fabianwgl/tap/dvsk
Or download Dvsk-<version>.dmg from Releases, open it and drag Dvsk to Applications.
Release builds are signed with a Developer ID and notarized by Apple, so macOS opens them without the “could not verify” block.
Build and run
git clone https://github.com/fabianwgl/dvsk.git && cd dvsk
swift run Dvsk
To build the app and a DMG yourself (universal, ad-hoc signed, with no Dock icon):
./scripts/bundle.sh
open build/Dvsk.app # or open build/Dvsk-<version>.dmg to install
To build a signed and notarized release DMG, set a Developer ID Application identity and a notarytool keychain profile:
DEVELOPER_ID="Developer ID Application: Your Name (TEAMID)" NOTARY_PROFILE=dvsk-notary ./scripts/bundle.sh
To run the tests:
swift test
If your screen stays tinted
If Dvsk crashes or is force-killed, your colours may not come back. To restore them, run:
swift run Dvsk --reset
Or, if you installed the app:
/Applications/Dvsk.app/Contents/MacOS/Dvsk --reset
Known limitations
- Turn off Night Shift (System Settings → Displays) and True Tone, because they stack on top of Dvsk.
- DisplayLink adapters, AirPlay and some Sidecar setups ignore gamma tables.
- HDR content can partly bypass the tint.
- There’s no sunrise/sunset location support yet.
How it works
Sources/DvskCore holds the colour and schedule logic: converting colour temperature (Kelvin) to RGB, the fixed-time schedule, choosing the current mode, and what the launch-at-login option shows. It’s plain Swift and fully unit tested.
Sources/Dvsk is the app itself. Once a second it works out the target colour, eases toward it, and writes it to every display with CGSetDisplayTransferByTable. It composes its tint on top of whatever table is on each display, so colour-table software dimmers (BetterDisplay, MonitorControl, Lunar) keep working. After sleep or a display change it applies the tint again. When it returns to neutral or you quit, it puts back the table that was under the tint, and falls back to ColorSync if that write fails at quit. Launch at login goes through macOS’s SMAppService.
Contributing
Issues and pull requests are welcome. Please run swift test before opening a pull request.
License
MIT
评论