community/sxmo-utils: switch from light to brightnessctl

As light has been dropped, we moved to brightnessctl. Here the patch we
already merged into master:

d0384a7cae

This also take maintainership as a Sxmo co-maintainer.
This commit is contained in:
Willow Barraco 2023-08-11 08:59:34 +02:00 committed by Kevin Daudt
parent a872a65e20
commit e39bf8c011
2 changed files with 76 additions and 3 deletions

View File

@ -0,0 +1,70 @@
From d0384a7caed036d25228fa3279c36c0230795e4a Mon Sep 17 00:00:00 2001
From: Willow Barraco <contact@willowbarraco.fr>
Date: Fri, 11 Aug 2023 08:49:37 +0200
Subject: [PATCH sxmo-utils] Switch from light to brightnessctl
light has been flagged as orphan by its developper, and dropped from
aports.
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/49859
https://github.com/haikarainen/light/issues/147
We switch to brightnessctl that works the same, and that also support
flashlight and leds.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
---
scripts/core/sxmo_brightness.sh | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/scripts/core/sxmo_brightness.sh b/scripts/core/sxmo_brightness.sh
index aec00020..5bbeed7a 100755
--- a/scripts/core/sxmo_brightness.sh
+++ b/scripts/core/sxmo_brightness.sh
@@ -10,27 +10,36 @@
notify() {
if [ "$SXMO_WM" = "sway" ] && [ -z "$SXMO_WOB_DISABLE" ]; then
- light | grep -o "^[0-9]*" > "$XDG_RUNTIME_DIR"/sxmo.wobsock
+ getvalue > "$XDG_RUNTIME_DIR"/sxmo.wobsock
else
- light | xargs dunstify -r 888 "$icon_brightness Brightness"
+ getvalue | xargs dunstify -r 888 "$icon_brightness Brightness"
fi
}
setvalue() {
- light -S "$1"
+ brightnessctl set "$1"%
}
up() {
- light -A 5
+ brightnessctl set 5%+
}
down() {
- light -N "${SXMO_MIN_BRIGHTNESS:-5}"
- light -U 5
+ # bugged https://github.com/Hummer12007/brightnessctl/issues/82
+ # brightnessctl --min-value "${SXMO_MIN_BRIGHTNESS:-5}" set 5%-
+
+ if [ "$(getvalue)" -gt "${SXMO_MIN_BRIGHTNESS:-5}" ]; then
+ brightnessctl set 5%-
+ else
+ brightnessctl set "${SXMO_MIN_BRIGHTNESS:-5}"%
+ fi
}
getvalue() {
- light
+ brightnessctl info \
+ | grep "Current brightness:" \
+ | awk '{ print $NF }' \
+ | grep -o "[0-9]*"
}
"$@"
--
2.41.0

View File

@ -1,8 +1,9 @@
# Maintainer: Anjandev Momi <anjan@momi.ca>
# Contributor: Anjandev Momi <anjan@momi.ca>
# Contributor: Maarten van Gompel <proycon@anaproy.nl>
# Maintainer: Willow Barraco <contact@willowbarraco.fr>
pkgname=sxmo-utils
pkgver=1.14.2
pkgrel=4
pkgrel=5
pkgdesc="Utility scripts, programs, and configs that hold the Sxmo UI environment together"
url="https://git.sr.ht/~mil/sxmo-utils"
arch="all !ppc64le" # limited by codemadness-frontends
@ -37,6 +38,7 @@ subpackages="
"
source="
$pkgname-$pkgver.tar.gz::https://git.sr.ht/~mil/sxmo-utils/archive/$pkgver.tar.gz
0001-Switch-from-light-to-brightnessctl.patch
rootfs-etc-NetworkManager-conf.d-00-sxmo.conf
rootfs-etc-polkit-1-rules.d-00-sxmo.rules
rootfs-etc-polkit-1-rules.d-50-org.freedesktop.NetworkManager.rules
@ -69,6 +71,7 @@ common() {
adwaita-icon-theme
alsa-utils
brightnessctl
callaudiod
codemadness-frontends
conky
@ -79,7 +82,6 @@ common() {
font-dejavu-sans-mono-nerd
geoclue
inotify-tools
light
linux-tools-iio
lisgd
mediainfo
@ -243,6 +245,7 @@ audio_bluetooth_pulseaudio() {
sha512sums="
c56ad0ed416ac08a15533b808af962de69f6ebefe15b9ff66fbe9d40a6149875794928ff146eadf517cfa929e2e6a58057b3ce0c2185cf3b1a1a26161adc86ae sxmo-utils-1.14.2.tar.gz
d6fb44927f8e356c4dd186eac0a30629c3c29c33d45cf68b7d95e0151e816ef411302b85165ee2287d63c8b08fb95cb9c4ec6ba25a20849597fe238fce59e622 0001-Switch-from-light-to-brightnessctl.patch
67a031f309a3232ac1e8abc3fedeaee912c035f9c81b4f709248895905a27ab5844ec92c65e55b79af3894450ba3883549d4004f11efebb47114d41f730e4a5f rootfs-etc-NetworkManager-conf.d-00-sxmo.conf
32532ad5071588b80f43d539b3bd140e3f5b4100fca244be2ade5b8c697c76043ce5278ae7bf14762106aed2c9690f34c14e73031e5d86c11cc042c8f7245421 rootfs-etc-polkit-1-rules.d-00-sxmo.rules
7b34e861bc4ec57d970d2a7aacca36e3c3742a63ff995af1336f80b666e4a38c1035b35e129322e0d62dc75011bfaf495eb2bcae5392f2bf39f1d7b1400afcce rootfs-etc-polkit-1-rules.d-50-org.freedesktop.NetworkManager.rules