Re: Need help controlling laptom display brightness via sysctl

From: Christos Margiolis <christos_at_freebsd.org>
Date: Thu, 04 Jul 2024 22:59:44 UTC
Hello Anton,

Anton Shepelev wrote:
> I wrote:
> 
> > I need your help in setting up the brightness control on
> > HP 15-b0xx laptop via sysctl.
> 
> I was infored that this ability has been discountinued in
> favour of the backlight utility, so I gave up and wrote the
> following devd rule:
>
> [...]

In case you find this helpful, I wrote this very simple wrapper script
today:

	#!/bin/sh

	bright=$(backlight -q -f /dev/backlight/backlight0)
	test $# -eq 0 && echo ${bright} && exit
	test ${bright} -le 10 -a "$(echo ${1} | grep "^[+|-]")" == "-" && exit
	backlight -f /dev/backlight/backlight0 "${1}"

Then I modified my DWM config to bind Mod+F5 to "bind -" (decrease by
10%) and Mod+F6 to "bind +" (increase by 10%). The script also makes
sure that if we want to decrease the brightness, we do not go below 10.
If no arguments are passed it prints out the current brightness level.

Christos