I've added a display brightness control menu to dmenu on my Dingoo, which makes it possible to easily adjust the display backlight brightness. The brightness setting will be saved to disk and automatically loaded on boot.
Here is what I've done to accomplish this.
First I have created two shell scripts. One for saving the new brightness setting (brightness.save) and another for actually adjusting the brightness (brightness.set). Both files need to be in the local/sbin directory.
brightness.save (56 bytes)
brightness.set (138 bytes)
Then I have added a new submenu to my dmenu.cfg with menu entries for various brightness settings (10 %, 25 %, 33 %, 50 %, 66 %, 75 %, 100 %). I have used a light bulb image as the menu icon. It needs to be in the res directory inside the dmenu folder.
First I have created two shell scripts. One for saving the new brightness setting (brightness.save) and another for actually adjusting the brightness (brightness.set). Both files need to be in the local/sbin directory.
brightness.save (56 bytes)
brightness.set (138 bytes)
Then I have added a new submenu to my dmenu.cfg with menu entries for various brightness settings (10 %, 25 %, 33 %, 50 %, 66 %, 75 %, 100 %). I have used a light bulb image as the menu icon. It needs to be in the res directory inside the dmenu folder.
Menu Brightness { Icon = "res/brightness.png" Name = "Display Brightness"
MenuItem Brightness100 { Icon = "res/brightness.png" Name = "100 %" Executable = "./brightness.save 100" WorkDir = "/usr/local/sbin" }
MenuItem Brightness75 { Icon = "res/brightness.png" Name = "75 %" Executable = "./brightness.save 75" WorkDir = "/usr/local/sbin" }
MenuItem Brightness66 { Icon = "res/brightness.png" Name = "66 %" Executable = "./brightness.save 66" WorkDir = "/usr/local/sbin" }
MenuItem Brightness50 { Icon = "res/brightness.png" Name = "50 %" Executable = "./brightness.save 50" WorkDir = "/usr/local/sbin" }
MenuItem Brightness33 { Icon = "res/brightness.png" Name = "33 %" Executable = "./brightness.save 33" WorkDir = "/usr/local/sbin" }
MenuItem Brightness25 { Icon = "res/brightness.png" Name = "25 %" Executable = "./brightness.save 25" WorkDir = "/usr/local/sbin" }
MenuItem Brightness10 { Icon = "res/brightness.png" Name = "10 %" Executable = "./brightness.save 10" WorkDir = "/usr/local/sbin" } }
Finally, I've inserted an additional line into the local/sbin/main script to load the brightness setting on boot.
/usr/local/sbin/brightness.set
This line needs to be inserted before running dmenu.
That's it.
UPDATE: As you can read in the comments below, there was a bug in the scripts, which caused the screen to turn all black when using it for the first time. I've modified and updated the brightness.set script such, that it sets the brightness only when there has been a value stored before.