-
Notifications
You must be signed in to change notification settings - Fork 416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add media key example hotkeys to sxhkdrc #1202
base: master
Are you sure you want to change the base?
Conversation
I don't get why you say that these are system-independent changes; |
I've updated my comment to remove that phrase. The current |
I like the idea of these examples! But I feel like making them system-independent isn't really necessary (cause I mean if you're using some BSD you should be able to figure this stuff out by yourself, I think). Also, I think using |
I think we should definitely make the commands as portable as possible, while also being realistic. That being said, in my opinion it is more portable to use the I knew that the |
Makes sense! brightness_file="/sys/class/backlight/*/brightness"; \
original_brightness=$(cat "$brightness_file"); \
echo $((original_brightness + 15 * {1,5} * {-2,2})) > "$brightness_file" It could even work as an example for "pseudo multi-line" hotkeys. Again, it's just a suggestion! |
@SeerLite Have you tried that before suggesting it? That won't work! You quoted the brightness_file=/sys/class/backlight/*/brightness; \
original_brightness="$(cat $brightness_file)"; \
echo "$((original_brightness + 15 * {1,5} * {-2,2}))" > $brightness_file Even if you fix the mistake you made in your script, this approach is still very problematic. On my laptop, a 2011 thinkpad T420 with ArchLinux using kernel "Linux 5.4.68-1-lts", I have two matches for $ printf "%s\n" /sys/class/backlight/*/brightness
/sys/class/backlight/acpi_video0/brightness
/sys/class/backlight/intel_backlight/brightness If we want to make this script not "laptops which only have one backlight device"-specific, we need more changes (the previous script won't work on my laptop for example): brightness_file="$(printf '%s\n' /sys/class/backlight/*/brightness | head -1)"; \
original_brightness="$(cat "$brightness_file")"; \
echo "$((original_brightness + 15 * {1,5} * {-2,2}))" > "$brightness_file" But hold on, this still won't work on my laptop. $ getent passwd "$USER"
emanuele6:x:1000:998::/home/emanuele6:/bin/bash
$ id "$USER"
uid=1000(emanuele6) gid=998(wheel) groups=998(wheel),5(tty)
$ echo 20 > /sys/class/backlight/acpi_video0/brightness
dash: 3: cannot create /sys/class/backlight/acpi_video0/brightness: Permission denied
$ echo 20 > /sys/class/backlight/intel_backlight/brightness
dash: 4: cannot create /sys/class/backlight/intel_backlight/brightness: Permission denied So, this approach will only work if you run There's still another problem that prevents this from working on my laptop: $ echo 20 | sudo tee /sys/class/backlight/acpi_video0/brightness
20
tee: /sys/class/backlight/acpi_video0/brightness: Invalid argument
$ echo 20 | sudo tee /sys/class/backlight/intel_backlight/brightness
20 Only one of the two devices actually works ( Note that XF86MonBrightness{Up,Down}{_, + shift}
xbacklight -{inc,dec} {15, 30} The fact that this don't work on my laptop shows that this method is not as "portable" as you think since it highly relies on the specific kind of hardware your laptop has. Also note that as soon as you connect an external monitor which has a Also, I think that LED displays don't have a Using the EDIT: |
@emanuele6 thank you for your extensive testing. I took a peek at the
Since my user is part of the
Unfortunately the That being said, is |
whoops :S Also, I completely forgot about the whole group/permissions thing. I remember having to do it manually on Arch, but maybe other distros come with it by default?
I think
Careful, though: It also requires the user to be in the What I'd do is just use |
That may be true. |
@SeerLite, as you can see from the output of $ id "$USER"
uid=1000(emanuele6) gid=998(wheel) groups=998(wheel),5(tty) I can use
Could the problem here possibly be that you guys are running a display manager or something similar as root and that that causes If that's the case, can you guys try to start #!/bin/sh
exec bspwm and then try to run Also note that $ light -U 10; echo "$?"
1
$ sudo light -U 10; echo "$?"
0
$ sudo usermod -a -Gvideo emanuele6
$ # after a reboot
$ id
uid=1000(emanuele6) gid=998(wheel) groups=998(wheel),5(tty),986(video)
$ light -U 10; echo "$?"
0 |
I am running a display manager (I guess that runs as root?) but even when i try using Perhaps
Also I checked and |
@jallbrit The Arch wiki says that there are some limitations with I haven't mentioned this, but my current display actually doesn't support backlight control at all. I've only been speaking from my experience of when I used to have a laptop. This means I can't really test if |
I went ahead and committed the change to use |
I don't get why there has to be a separate commit for the switch to using ..in the example {_,shift + ,super + }XF86MonBrightness{Down,Up}
bright {-1,-10,min,+1,+10,max} This furhter shows how futile this PR is: this example has nothing to do with |
Right, but that's the sxhkd README on the sxhkd repo. Not example/base configuration files that are (AFAIK) installed with packages or as documentation. I don't think many people see the examples on the sxhkd repo. That said, I have never heard of @jallbrit Btw, you can do |
It is my understanding that squashing commits changes git history, which would require a
While it's great that
@SeerLite I appreciate the recommendation, but the current syntax...
works because |
Can you justify why Once it gets added to
example :)
There are useful examples related to I personally wouldn't like looking on the internet for
In this comment of mine #1202 (comment), you can see that I didn't need to use XF86MonBrightness{Up,Down}{_, + shift}
light -{A,U} {15,30} An alternative solution would be: {_,shift + }XF86MonBrightness{Up,Down}
light {-A 15,-A 30,-U 15,-U 30} |
It's something I've read before but don't have experience with, so that's why I left the question open-ended. I see now that I should squash the commits.
This is a better way. |
The example
sxhkdrc
is pretty bare bones and could use some simple,system-independentchanges. I've added hotkeys for some common laptop media keys like adjusting volume and brightness. This helps bspwm work more out-of-the-box. New users may not expect having to manually map their brightness control/volume adjustment.