Ubuntu 21.04 nvidia brightness control

sn flag

I have MacBookAir 3,2 (2010) that works surprisingly well with Ubuntu 21.04 (GNOME), when its NVidia driver is correctly enabled.

The problem comes when controlling the screen brightness. The default hotkeys work, xbacklight and nvidia-settings -a BacklightBrightness=## both work, but the brightness setting set through any of these means does not persist between reboots or shutdowns.

From a few similar questions on here I believe it might not be possible, in my case, to make the setting persistent, as no solution attempted has made a difference so far. I am open to suggestions I might not have tried yet but, I thought of a workaround: use what I know works as soon as possible.

I would like to know a means to run either xbacklight and nvidia-settings as soon as they can possibly run with a graphical session available. The closest I have gotten to this is with a .desktop file in either autostart folder, but it is not what I want. I want the brightness setting to be set as soon as the main graphical session (not on login but before or right on the login screen) would allow xbacklight or nvidia-settings to work.

All of this, in short, is 2 questions:

  • is there any way to make the screen brightness persist after reboot or shutdown with this configuration?
  • if there isn't, when and how, as soon as possible, could I run a script to set the brightness?

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.