I’ve set up [super]+[volume+]/[super]+[volume-] to trigger raise/lower of this makefile I made but one part is still not working correctly (besides my monitor’s backlight apparently not responding to said commands).
BY?=5
BCTL=$(if $(wildcard /bin/brightnessctl),DISPLAY=:$(ON) && brightnessctl $1)
XBKL=$(if $(wildcard /bin/xbacklight),DISPLAY=:$(ON) && xbacklight $1)
PAPLAY=$(if $(wildcard /bin/paplay),paplay $1)
BCTL_FETCH:=$(call BCTL,get)
BCTL_RAISE:=$(call BCTL,set +$(BY)%)
BCTL_LOWER:=$(call BCTL,set $(BY)%-)
XBKL_RAISE:=$(call XBKL,-inc $(BY))
XBKL_LOWER:=$(call XBKL,-dec $(BY))
FAIL_RAISE:=echo "Failed to raise brightness"
FAIL_LOWER:=echo "Failed to lower brightness"
CALL=$(or $(BCTL_$1),$(XBKL_$1),$(FAIL_$1))
FETCH=$(or $(BCTL_FETCH),echo Cannot fetch)
HINT_AUDIO:=stereo/message
NOTIFY_HINT_AUDIO:=--hint=STRING:SOUND_FILE:"$(HINT_AUDIO)"
NOTIFY_CHANGED=notify-send $(NOTIFY_HINT_AUDIO) "Backlight strength $1" "$$($$(call FETCH))"
PAPLAY_FILE=$(call PAPLAY,"/usr/share/sounds/$(or $2,freedesktop)/$(HINT_AUDIO).oga")
raise:
$(call CALL,RAISE)
$(call NOTIFY_CHANGED,Raised)
$(PAPLAY_FILE)
lower:
$(call CALL,LOWER)
$(call NOTIFY_CHANGED,Lowered)
$(PAPLAY_FILE)
.PHONY: raise lower
Everything but the grabbing of the new brightness value seems to be executing correctly (get the notification and sound, just no retrieved value). Anyone able to help me fix that last bit, and then maybe help me identify why my monitor is not responding the the commands. As an aside I did try xrandr (which was already installed unlike brightnessctl) but that was such a nuisance to try and define the command correctly that I just gave up on it.