Move bar code to "src/dwm/bar.h"
This commit is contained in:
parent
f86dc0a9f4
commit
e674a2da7e
4 changed files with 43 additions and 36 deletions
1
Makefile
1
Makefile
|
@ -31,6 +31,7 @@ MODULES_SRC = \
|
|||
src/xbase.c
|
||||
|
||||
DWM_SRC = \
|
||||
src/dwm/bar.c \
|
||||
src/dwm/handlers.c \
|
||||
src/dwm/layouts.c \
|
||||
src/dwm/xerror.c
|
||||
|
|
38
src/dwm.c
38
src/dwm.c
|
@ -210,13 +210,13 @@ static void updatesizehints(Client *c);
|
|||
static void updatetitle(Client *c);
|
||||
static void updatewindowtype(Client *c);
|
||||
static void updatewmhints(Client *c);
|
||||
static bool winpolybar(Window w);
|
||||
static Client *wintoclient(Window w);
|
||||
static Monitor *wintomon(Window w);
|
||||
static void wmcheckwin_create();
|
||||
static void wmcheckwin_destroy();
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
#include "dwm/bar.h"
|
||||
#include "dwm/handlers.h"
|
||||
#include "dwm/layouts.h"
|
||||
#include "dwm/xerror.h"
|
||||
|
@ -334,6 +334,7 @@ static Button buttons[] = {
|
|||
* Private function implementations *
|
||||
************************************/
|
||||
|
||||
#include "dwm/bar.c"
|
||||
#include "dwm/handlers.c"
|
||||
#include "dwm/layouts.c"
|
||||
#include "dwm/xerror.c"
|
||||
|
@ -2318,41 +2319,6 @@ Client *wintoclient(Window w)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool winpolybar(const Window w)
|
||||
{
|
||||
XClassHint ch = { NULL, NULL };
|
||||
bool result = true;
|
||||
|
||||
if (XGetClassHint(xbase->x_display, w, &ch)) {
|
||||
if (
|
||||
ch.res_class
|
||||
&&
|
||||
strstr(ch.res_class, "Polybar") == NULL
|
||||
&&
|
||||
strstr(ch.res_class, "polybar") == NULL
|
||||
) {
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (
|
||||
ch.res_name
|
||||
&&
|
||||
strstr(ch.res_name, "Polybar") == NULL
|
||||
&&
|
||||
strstr(ch.res_name, "polybar") == NULL
|
||||
) {
|
||||
result = false;
|
||||
}
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (ch.res_class) XFree(ch.res_class);
|
||||
if (ch.res_name) XFree(ch.res_name);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Monitor *wintomon(Window w)
|
||||
{
|
||||
{
|
||||
|
|
34
src/dwm/bar.c
Normal file
34
src/dwm/bar.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
bool winpolybar(const Window w)
|
||||
{
|
||||
XClassHint ch = { NULL, NULL };
|
||||
bool result = true;
|
||||
|
||||
if (XGetClassHint(xbase->x_display, w, &ch)) {
|
||||
if (
|
||||
ch.res_class
|
||||
&&
|
||||
strstr(ch.res_class, "Polybar") == NULL
|
||||
&&
|
||||
strstr(ch.res_class, "polybar") == NULL
|
||||
) {
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (
|
||||
ch.res_name
|
||||
&&
|
||||
strstr(ch.res_name, "Polybar") == NULL
|
||||
&&
|
||||
strstr(ch.res_name, "polybar") == NULL
|
||||
) {
|
||||
result = false;
|
||||
}
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (ch.res_class) XFree(ch.res_class);
|
||||
if (ch.res_name) XFree(ch.res_name);
|
||||
|
||||
return result;
|
||||
}
|
6
src/dwm/bar.h
Normal file
6
src/dwm/bar.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef _DWM_BAR_H
|
||||
#define _DWM_BAR_H
|
||||
|
||||
static bool winpolybar(Window w);
|
||||
|
||||
#endif // _DWM_BAR_H
|
Loading…
Reference in a new issue