Skip to content

Autostart

Systemd service

For simplicity, a Systemd user service running either uvx for the latest releases (in case of driver updates), or a prebuilt binary directly should cover most users, and integrates well with dotfiles.

Create a file at ~/.config/systemd/user/nvibrant.service with the content:

[Unit]
Description=Apply nvibrant
After=graphical.target

[Service]
Type=oneshot
ExecStartPre=/bin/sleep 5
ExecStart=uvx nvibrant 1023 1023

[Install]
WantedBy=default.target

Change values, enable the service with systemctl --user enable --now nvibrant.service

Tips

  • You can pin it to a specific version with uvx nvibrant==1.2.1 (args) to have more control/security
  • Local binary at ~/.local/bin/nvibrant and use ExecStart=%h/.local/bin/nvibrant (args)
  • Sleeping for a few seconds can prevent racing conditions with the display server starting up

Environment variables

For autostarting dithering or multigpus, which are done via environment variables, systemd syntax does not run commands in a shell - a few options are:

[Service]
ExecStart=/usr/bin/env ATTRIBUTE=dithering uvx nvibrant
[Service]
ExecStart=/bin/bash -c "ATTRIBUTE=dithering uvx nvibrant"

You may add two ExecStart to the service, a combined setup may look like:

1
2
3
4
5
[Service]
Type=oneshot
ExecStartPre=/bin/sleep 5
ExecStart=/usr/bin/env ATTRIBUTE=dithering uvx nvibrant
ExecStart=/usr/bin/env ATTRIBUTE=vibrance  uvx nvibrant 1023 1023
1
2
3
4
5
[Service]
Type=oneshot
ExecStartPre=/bin/sleep 5
ExecStart=/bin/bash -c "ATTRIBUTE=dithering uvx nvibrant"
ExecStart=/bin/bash -c "ATTRIBUTE=vibrance  uvx nvibrant 1023 1023"