You are not logged in.
Hello guys, first post here. Before making the post I tried several searches and didn't find anything matching the issue I'm having, but being xbindkeys and brightness such an extensive topic (from what I've seen in my search) and maybe by my lack of knowledge on what's going on I may be missing something, so sorry if there is a similar thread around I totally missed.
I have an MSI GT72 Laptop running gnome shell 3.22.2 and it works nice and smooth, but I'm having a problem with the brightness keys. After reading the backlight wiki I found some things:
- The brightness is handled by acpi, since it's present under /sys/class/backlight
- From what I've seen in other threads and posts max brightness should list the steps of brightness increase which are usually around 15, but mine outputs 100 which I found weird already
- Changing the value on brightness file will indeed change the value reflected on gnome brightness slider and the slider on the animation that pops up when I press the Fn + brightness up key combination (look at the image for reference), but doesn't actually change the brightness
- None of the kernel command line options did work
- Checking the backlight utilities listed, xbacklight does change the display brightness
- I have an nVidia GTX 980M card, and based on my previous observations my case is exactly the one reported at the end, and the script works but there's a considerable delay on response to the command and the brightness popup lags a lot.
Considering xbacklight works without any negative effect, I thought on binding xbacklight command to my brightness up and down keys using xbindkeys but it's not working as it should. This are the key combinations on my .xbindkeysrc file:
#BrightnessUp
"xbacklight +15"
c:233
XF86MonBrightnessUp
#BrightnessDown
"xbacklight -15"
c:232
XF86MonBrightnessDownI also added xbindkeys to my .xinitrc file, located at my user home folder, to make sure xbindkeys starts as soon as my X session:
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
xbindkeys &
exec xterm -geometry 80x66+0+0 -name loginThe first thing I noticed after a restart and running ps -Ae | grep "xbindkeys" is xbindkeys it's not starting at boot as it should, and the next is after running xbindkeys from a terminal the command works once, doesn't pops the brightness animation and then stops working. If I run xbindkeys -n happens the same everytime I run it: the command works the first time I press Fn + Brightness Up / Down without prompting the brightness animation from gnome, and the next time I press Fn + Brightness Up/Down the animation pops and the command doesn't work anymore, but xbindkeys -n won't return any error output.
Looks like gnome is overwriting my key binding after the first time I use it but I didn't find any Brightness Up/ Down setup under the Keyboard section on the control center. Am I doing something wrong? Is the concept of binding the brightness up/down actually wrong? Any additional information you may need I'd be more than glad to help, just let me know ![]()
Thanks in advance ![]()
Last edited by jc-arch (2017-01-22 12:22:00)
Offline
Gnome doesn't read your .xinitrc. To autostart xbindkeys, create a desktop file: https://wiki.archlinux.org/index.php/GN … plications
Offline
Thanks, following your suggestion, I created a .desktop entry named xbindkeys.desktop under ~/.config/autostart with the following format:
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=xbindkeys
GenericName=xbindkeys
Exec=xbindkeys
Terminal=true
NoDisplay=true
Type=Application
GenericName[en_US]=xbindkeys
Name[en_US]=xbindkeys.desktopwhich was correctly detected by the gnome tweak tool under the startup applications section. Still, brightness keys do not work when I restart Arch Linux, but now there's a process running at start for xbindkeys, and xbindkeys -n now says it can't grab the keys on my configuration file, won't trigger the command even inside this mode and won't print any additional error messages after pressing Fn + Brightness Up/Down.
EDIT: as an additional note, if I kill the process created at startup and execute xbindkeys from a terminal, the initial process repeats again: works once without the gnome brightness animation prompting, the next time animation prompts and command doesn't work anymore until I kill the xbindkeys process and repeat
Any idea what could be wrong now? Here's a sample of the console output for the above commands:
[jc@JC-PC ~]$ ps -Ae | grep "xbindkeys"
1328 ? 00:00:00 xbindkeys
[jc@JC-PC ~]$ xbindkeys -n
*** Warning ***
Please verify that there is not another program running
which captures one of the keys captured by xbindkeys.
It seems that there is a conflict, and xbindkeys can't
grab all the keys defined in its configuration file.
^C
[jc@JC-PC ~]$Last edited by jc-arch (2017-01-22 06:24:30)
Offline
I don't know anything about Gnome, but I would imagine that it is trying to control those keypresses...
Offline
That's the weird thing, is there a way to change the default behavior for such keys on gnome? The shortcuts under control center -> keyboard don't include any brightness shortcut
Offline
Fixed, inotify-tools was the way to go in the end to modify brightness default behavior. I assume the problem was my lack of understanding on how startup applications with gnome worked. Previously I tried to make the script to load via systemctl which caused the lags on the animation and the response between the key press and the execution itself, now adding the file ~/.config/autostart/xbacklightd.desktop does the trick in conjunction with the script located at /usr/local/bin/xbacklightd
This is the .desktop file
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=xbacklightd
GenericName=xbacklightd
Exec=xbacklightd
Terminal=false
NoDisplay=true
Type=Application
GenericName[en_US]=xbacklightd
Name[en_US]=xbacklightdAnd this is the xbacklightd file
#!/bin/sh
path=/sys/class/backlight/acpi_video0
luminance() {
read -r level < "$path"/actual_brightness
factor=$((100 / max))
printf '%d\n' "$((level * factor))"
}
read -r max < "$path"/max_brightness
xbacklight -set "$(luminance)"
inotifywait -me modify --format '' "$path"/actual_brightness | while read; do
xbacklight -set "$(luminance)"
doneNow it does show the brightness popup animation while increasing or decreasing brightness using the Fn + Brightness Up/Down keys and backlight default value also is saved between sessions without adding an additional udev rule. The only drawback is I can't control the number of brightness steps which is set to 20, but I don't mind it at all as long as it's working.
Thank you very much for your help ![]()
Last edited by jc-arch (2017-01-22 12:19:57)
Offline