You are not logged in.
Hi all. This is my first post in the forum, so I don't really know how this thing goes. I will try to give as much info as I can though....
So, I just installed arch and I am in the process of setting it up in my free time with as many cool features as I want.
Right now, I'm trying to change the brightness with a MOD+F11 and MOD+F12. I know how to change the keys in the config.h file for dwm and rebuild and all that.
The issue is now that I want to change the brightness, I need to change it with a script to read where the brightness is and increment it but not above the max or below 1.
With this general idea I wrote a bash script
#!/bin/bash
TARGET="/sys/class/backlight/amdgpu_b10"
MAX="$(cat "${TARGET}/max_brightness")"
# takes the first input and checks if it is inc or dec
if [[ "$1" == "inc" ]]; then
BRIGHTNESS="$(echo "($2 + ${MAX})/1" | bc)"
elif [[ "$2" == "dec" ]]; then
BRIGHTNESS="$(echo "(${MAX} - $2)/1" | bc)"
fi
# then it either increases or decreases the brightness by the second input
# i don't know what this loop does tbh i didn't write it
# i think it's kind of important tho
#for i in */; do
# if [[ "${TARGET}/" != "$i" && -e "${i}brightness" ]]; then
# cat "${i}max_brightness" > "${i}brightness"
# fi
#done
echo "${BRIGHTNESS}" > "${TARGET}/brightness"I'm not sure if this script will do exactly what I want, but I haven't gotten that far in the problem solving because I can't edit the files I need to with this script.
[nick@MoTile ~]$ echo 100 > /sys/class/backlight/amdgpu_bl0/brightness
I can do the above. No issues. I instantly see my brightness go down from wherever I had it. I can also cat the max_brightness file.
But when I run my script (I want to make sure it works before I hand it to dwm to run on a keyboard shortcut), it gives me this:
[nick@MoTile ~]$ sudo backlight inc 15
cat: /sys/class/backlight/amdgpu_b10/max_brightness: No such file or directory
(standard_in) 1: syntax error
/usr/bin/backlight: line 19: /sys/class/backlight/amdgpu_b10/brightness: No such file or directory
Am I missing something here? I have all users read permissions set on for max_brightness and all users write permissions on for brightness.
On top of that, I'm running it with sudo. Thanks to anybody who doesn't mind taking a look!
EDIT: I forgot to add that I tried xbacklight but apparently it does not support anything other than intel? I assume I have amd because of the only directory in backlight being amdgpu_b10.
Last edited by TheJaava (2021-07-26 22:32:14)
Offline
Check your typos, amdgpu_bl0 != amdgpu_b10 you want the former your script tries the latter.
Last edited by V1del (2021-07-06 22:53:38)
Offline
Oh. I won't tell you how long I've been trying to figure this out. This is why fonts where a lowercase L and a numeral 1 look the same should be criminalized. Thanks, though. is there a way to mark this as solved? i can get the bash script to work from here
Offline
Well it's up to you to choose your fonts in a less criminal manner ![]()
You can edit the title in your first post and prepend [SOLVED] or so.
Offline