dwm-backlight-20241021-351084d.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-backlight-20241021-351084d.diff (1734B)
       ---
            1 From 351084dabc6dbee742a3bf3b8829d530eb146e0d Mon Sep 17 00:00:00 2001
            2 From: elbachir-one <bachiralfa@gmail.com>
            3 Date: Mon, 21 Oct 2024 14:03:49 +0100
            4 Subject: [PATCH] Keybinds to control the backlight
            5 
            6 ---
            7  config.def.h | 4 ++++
            8  dwm.c        | 1 +
            9  2 files changed, 5 insertions(+)
           10 
           11 diff --git a/config.def.h b/config.def.h
           12 index 9efa774..908c645 100644
           13 --- a/config.def.h
           14 +++ b/config.def.h
           15 @@ -59,6 +59,8 @@ static const Layout layouts[] = {
           16  static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
           17  static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
           18  static const char *termcmd[]  = { "st", NULL };
           19 +static const char *upbrightness[]   = { "xbacklight", "-inc", "10", NULL };
           20 +static const char *downbrightness[] = { "xbacklight", "-dec", "10", NULL };
           21  
           22  static const Key keys[] = {
           23          /* modifier                     key        function        argument */
           24 @@ -95,6 +97,8 @@ static const Key keys[] = {
           25          TAGKEYS(                        XK_8,                      7)
           26          TAGKEYS(                        XK_9,                      8)
           27          { MODKEY|ShiftMask,             XK_q,      quit,           {0} },
           28 +        { 0,            XF86XK_MonBrightnessUp,    spawn,          {.v = upbrightness } },
           29 +        { 0,            XF86XK_MonBrightnessDown,  spawn,          {.v = downbrightness } },
           30  };
           31  
           32  /* button definitions */
           33 diff --git a/dwm.c b/dwm.c
           34 index 1443802..5439d3e 100644
           35 --- a/dwm.c
           36 +++ b/dwm.c
           37 @@ -36,6 +36,7 @@
           38  #include <X11/Xlib.h>
           39  #include <X11/Xproto.h>
           40  #include <X11/Xutil.h>
           41 +#include <X11/XF86keysym.h>
           42  #ifdef XINERAMA
           43  #include <X11/extensions/Xinerama.h>
           44  #endif /* XINERAMA */
           45 -- 
           46 2.46.2
           47