You are not logged in.

#1 2020-03-27 11:48:25

miomio
Member
Registered: 2016-01-17
Posts: 159

[SOLVED] Fn + F keys with dwm

Switched to dwm from xfce and am unable to adjust brightness with Fn+F5/6 anymore. I thought of mapping Fn+F5/6 to `xbacklight -inc/-dec 10` in dwm config.h however I realise that doing this implies dwm won't recognise all the other secondary functions of the F keys too unless I configure them. Is there a better way?

Last edited by miomio (2020-03-28 13:59:11)

Offline

#2 2020-03-27 13:42:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,270
Website

Re: [SOLVED] Fn + F keys with dwm

miomio wrote:

I realise that doing this implies dwm won't recognise all the other secondary functions of the F keys too

Huh?  One has nothing to do with the other.  If you want to have those keys do something, you need to bind them to the functions you want.  Binding two of them will not impact any of the others.

miomio wrote:

... unless I configure them. Is there a better way?

No.  Again, if you want the keys to be bound to something, you need to bind them.  It's as simple as that.  You could use xbindkeys, but personally I find using dwm's config.h cleaner and simpler.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2020-03-28 12:30:19

miomio
Member
Registered: 2016-01-17
Posts: 159

Re: [SOLVED] Fn + F keys with dwm

Can anyone walk me through editing config.h for new key bindings? I've been able to figure out adding new key bindings but only by copying a binding already defined and changing the key... I just want to use a single key and not right alt.

Offline

#4 2020-03-28 12:39:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,270
Website

Re: [SOLVED] Fn + F keys with dwm

Then remove the MODKEY column - replace it with 0.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2020-03-28 13:13:59

miomio
Member
Registered: 2016-01-17
Posts: 159

Re: [SOLVED] Fn + F keys with dwm

Trilby wrote:

Then remove the MODKEY column - replace it with 0.

Would you provide code to demonstrate what you mean. If you a saying what I think you are, that's not a solution!

Last edited by miomio (2020-03-28 13:14:13)

Offline

#6 2020-03-28 13:20:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,270
Website

Re: [SOLVED] Fn + F keys with dwm

How is it "not a solution!"  What problem are you having, or what error are you seeing?  Frankly your attitude is not very conducive to recieving help.  You want a hand-holding demonstration from others who - frankly - don't really give a damn if you're happy or not, but you will not make any effort to demonstrate what you have done or what has gone wrong.

But hey, if you just want an answer without gaining any understanding, here you go:

   { 0,                  XF86XK_MonBrightnessUp,      spawn,          {.v = "xbacklight -inc 10" } },

Last edited by Trilby (2020-03-28 13:20:29)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2020-03-28 13:26:17

miomio
Member
Registered: 2016-01-17
Posts: 159

Re: [SOLVED] Fn + F keys with dwm

XF86XK_MonBrightnessUp and not XF86MonBrightnessUp ?

Offline

#8 2020-03-28 13:30:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,270
Website

Re: [SOLVED] Fn + F keys with dwm

It's your key, how should I know, but I'd suspect the former as that's the one defined in X11's keysymdef.h

EDIT: in fairness - there is a slight mismatch between the actual C code macro definitions and the strings that Xlib uses internally and prints out for progams like xev.  If that's the source of your confusion, my abruptness - in this specific response - may have been unwarranted.  However, my abruptness here is also the result of your performance in this thread earning zero (or in fact negative) goodwill - thus not getting much benefit of the doubt.  Show that you are participating in the process constructively and I - and most other members here - will bend over backwards to help you; but if you demonstrate that you just want quick fixes and are not cooperative, you'll quickly be shown the door.

Last edited by Trilby (2020-03-28 13:37:44)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#9 2020-03-28 13:31:14

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 4,129

Re: [SOLVED] Fn + F keys with dwm

miomio, you have been warned about being a help vampire. Do not ask for hand-holding here; do a little research on your own.


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

#10 2020-03-28 13:53:57

miomio
Member
Registered: 2016-01-17
Posts: 159

Re: [SOLVED] Fn + F keys with dwm

Solved, but needed to add `#include <X11/XF86keysym.h>` to dwm.c.

config.h:

...
static const char *inclight[]  = { "xbacklight", "-inc", "10", NULL };
static const char *declight[]  = { "xbacklight", "-dec", "10", NULL };
...
{ 0,                            XF86XK_MonBrightnessUp,     spawn,      {.v = inclight } },
{ 0,                            XF86XK_MonBrightnessDown,   spawn,      {.v = declight } },
...

xev reported brightness fkeys as XF86MonBrightnessUp/Down, all keys in config.h prepended with "XK_", but neither XF86MonBrightnessUp/Down nor XK_XF86MonBrightnessUp/Down are known keys in default header files, so who knows where xev is picking those keys up from so add X11/XF86keysym.h.

Last edited by miomio (2020-03-28 13:57:06)

Offline

#11 2020-03-28 13:56:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,270
Website

Re: [SOLVED] Fn + F keys with dwm

Nicely done.  I see you fixed my use of the full command in a single string (it's been a while since I used dwm).  Please remember to mark the thread as SOLVED.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB