Create settings module
This commit is contained in:
parent
e213029729
commit
24a42e8607
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
SRC = atoms.c drw.c dwm.c services/datetime.c services/status.c util.c
|
SRC = atoms.c drw.c dwm.c services/datetime.c services/status.c settings.c util.c
|
||||||
OBJ = ${SRC:.c=.o}
|
OBJ = ${SRC:.c=.o}
|
||||||
|
|
||||||
all: options dwm
|
all: options dwm
|
||||||
|
|
|
@ -5,7 +5,6 @@ static const unsigned int borderpx = 2; /* border pixel of windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
static const int focusonwheel = 1;
|
|
||||||
static const char *fonts[] = { "monospace:size=10" };
|
static const char *fonts[] = { "monospace:size=10" };
|
||||||
static const char dmenufont[] = "monospace:size=10";
|
static const char dmenufont[] = "monospace:size=10";
|
||||||
static const char col_gray1[] = "#222222";
|
static const char col_gray1[] = "#222222";
|
||||||
|
|
5
dwm.c
5
dwm.c
|
@ -45,6 +45,7 @@
|
||||||
#include "drw.h"
|
#include "drw.h"
|
||||||
#include "services/datetime.h"
|
#include "services/datetime.h"
|
||||||
#include "services/status.h"
|
#include "services/status.h"
|
||||||
|
#include "settings.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/* macros */
|
/* macros */
|
||||||
|
@ -468,7 +469,7 @@ buttonpress(XEvent *e)
|
||||||
click = ClkRootWin;
|
click = ClkRootWin;
|
||||||
/* focus monitor if necessary */
|
/* focus monitor if necessary */
|
||||||
if ((m = wintomon(ev->window)) && m != selmon
|
if ((m = wintomon(ev->window)) && m != selmon
|
||||||
&& (focusonwheel || (ev->button != Button4 && ev->button != Button5))) {
|
&& (settings_get_focus_on_wheel() || (ev->button != Button4 && ev->button != Button5))) {
|
||||||
unfocus(selmon->sel, 1);
|
unfocus(selmon->sel, 1);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
|
@ -493,7 +494,7 @@ buttonpress(XEvent *e)
|
||||||
else
|
else
|
||||||
click = ClkWinTitle;
|
click = ClkWinTitle;
|
||||||
} else if ((c = wintoclient(ev->window))) {
|
} else if ((c = wintoclient(ev->window))) {
|
||||||
if (focusonwheel || (ev->button != Button4 && ev->button != Button5))
|
if (settings_get_focus_on_wheel() || (ev->button != Button4 && ev->button != Button5))
|
||||||
focus(c);
|
focus(c);
|
||||||
XAllowEvents(dpy, ReplayPointer, CurrentTime);
|
XAllowEvents(dpy, ReplayPointer, CurrentTime);
|
||||||
click = ClkClientWin;
|
click = ClkClientWin;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
static bool focus_on_wheel = true;
|
||||||
|
|
||||||
|
bool settings_get_focus_on_wheel()
|
||||||
|
{
|
||||||
|
return focus_on_wheel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void settings_set_focus_on_wheel(const bool new_focus_on_wheel)
|
||||||
|
{
|
||||||
|
focus_on_wheel = new_focus_on_wheel;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef _SETTINGS_H
|
||||||
|
#define _SETTINGS_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
bool settings_get_focus_on_wheel();
|
||||||
|
void settings_set_focus_on_wheel(bool new_focus_on_wheel);
|
||||||
|
|
||||||
|
#endif // _SETTINGS_H
|
Loading…
Reference in New Issue