wip
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
# dwm - dynamic window manager
|
||||
# See LICENSE file for copyright and license details.
|
||||
|
||||
include config.mk
|
||||
|
||||
SRC = drw.c dwm.c util.c
|
||||
@@ -13,22 +10,11 @@ all: dwm
|
||||
|
||||
${OBJ}: config.h config.mk
|
||||
|
||||
config.h:
|
||||
cp config.def.h $@
|
||||
|
||||
dwm: ${OBJ}
|
||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
|
||||
clean:
|
||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
||||
|
||||
dist: clean
|
||||
mkdir -p dwm-${VERSION}
|
||||
cp -R LICENSE Makefile README config.def.h config.mk\
|
||||
dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION}
|
||||
tar -cf dwm-${VERSION}.tar dwm-${VERSION}
|
||||
gzip dwm-${VERSION}.tar
|
||||
rm -rf dwm-${VERSION}
|
||||
rm -f dwm ${OBJ}
|
||||
|
||||
install: all
|
||||
mkdir -p ${DESTDIR}${PREFIX}/bin
|
||||
@@ -37,6 +23,5 @@ install: all
|
||||
|
||||
uninstall:
|
||||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
||||
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||
|
||||
.PHONY: all clean dist install uninstall
|
||||
.PHONY: all install clean uninstall
|
||||
|
||||
@@ -13,11 +13,10 @@ static const char *colors[][3] = {
|
||||
|
||||
static const char *tags[] = { "1", "2", "3", "4" };
|
||||
static const Rule rules[] = {
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "PrismLauncher", "prismlauncher", NULL, 1 << 2, 0, -1 },
|
||||
{ "mercury-default", "Navigator", NULL, 1 << 1, 0, -1 },
|
||||
{ "steam", "steamwebhelper", NULL, 1 << 2, 0, -1 },
|
||||
{ "st-256color", "st-256color", NULL, 1, 0, -1 },
|
||||
{ "PrismLauncher", "prismlauncher", NULL, 1 << 2, 0, -1 },
|
||||
{ "librewolf", "Navigator", NULL, 1 << 1, 0, -1 },
|
||||
{ "steam", "steamwebhelper", NULL, 1 << 2, 0, -1 },
|
||||
{ "st-256color", "st-256color", NULL, 1, 0, -1 },
|
||||
};
|
||||
|
||||
static const float mfact = 0.55;
|
||||
@@ -25,7 +24,10 @@ static const int nmaster = 1;
|
||||
static const int resizehints = 1;
|
||||
static const int lockfullscreen = 1;
|
||||
|
||||
static const Layout layouts[] = { { "[]=", tile } };
|
||||
static const Layout layouts[] = {
|
||||
{ "[]=", tile },
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
};
|
||||
|
||||
#define MODKEY Mod1Mask
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
@@ -39,12 +41,13 @@ static const Layout layouts[] = { { "[]=", tile } };
|
||||
static char dmenumon[2] = "0";
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
static const char *browsercmd[] = { "librewolf", NULL };
|
||||
|
||||
#include "X11/XF86keysym.h"
|
||||
static const Key keys[] = {
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_space, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_f, spawn, SHCMD("cd /home/andrew/mercury-browser/ && ./MERCURY_PORTABLE") },
|
||||
{ MODKEY, XK_f, spawn, {.v = browsercmd } },
|
||||
{ MODKEY, XK_h, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_l, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_j, setmfact, {.f = -0.05} },
|
||||
@@ -64,9 +67,9 @@ static const Key keys[] = {
|
||||
{ 0, XF86XK_AudioMute, spawn, SHCMD("pactl set-sink-mute @DEFAULT_SINK@ toggle") },
|
||||
|
||||
TAGKEYS( XK_1, 0 )
|
||||
TAGKEYS( XK_2, 1 )
|
||||
TAGKEYS( XK_3, 2 )
|
||||
TAGKEYS( XK_4, 3 )
|
||||
TAGKEYS( XK_2, 1 )
|
||||
TAGKEYS( XK_3, 2 )
|
||||
TAGKEYS( XK_4, 3 )
|
||||
};
|
||||
|
||||
static const Button buttons[] = {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
VERSION = 6.5
|
||||
|
||||
# paths
|
||||
PREFIX = /usr/local
|
||||
|
||||
X11INC = /usr/X11R6/include
|
||||
X11LIB = /usr/X11R6/lib
|
||||
|
||||
# Xinerama, comment if you don't want it
|
||||
XINERAMALIBS = -lXinerama
|
||||
XINERAMAFLAGS = -DXINERAMA
|
||||
# XINERAMALIBS = -lXinerama
|
||||
# XINERAMAFLAGS = -DXINERAMA
|
||||
|
||||
# freetype
|
||||
FREETYPELIBS = -lfontconfig -lXft
|
||||
@@ -16,14 +15,13 @@ FREETYPEINC = /usr/include/freetype2
|
||||
|
||||
# includes and libs
|
||||
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
||||
LIBS = -L${X11LIB} -lX11 ${FREETYPELIBS}
|
||||
|
||||
# flags
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\"
|
||||
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
|
||||
LDFLAGS = ${LIBS}
|
||||
|
||||
|
||||
# compiler and linker
|
||||
CC = gcc
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/Xutil.h>
|
||||
#ifdef XINERAMA
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#endif /* XINERAMA */
|
||||
#include <X11/Xft/Xft.h>
|
||||
|
||||
#include "drw.h"
|
||||
@@ -128,7 +125,6 @@ static void arrangemon(Monitor *m);
|
||||
static void attach(Client *c);
|
||||
static void attachstack(Client *c);
|
||||
static void buttonpress(XEvent *e);
|
||||
static void checkotherwm(void);
|
||||
static void cleanup(void);
|
||||
static void cleanupmon(Monitor *mon);
|
||||
static void clientmessage(XEvent *e);
|
||||
@@ -206,7 +202,6 @@ static Client *wintoclient(Window w);
|
||||
static Monitor *wintomon(Window w);
|
||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
@@ -432,17 +427,6 @@ buttonpress(XEvent *e)
|
||||
buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
|
||||
}
|
||||
|
||||
void
|
||||
checkotherwm(void)
|
||||
{
|
||||
xerrorxlib = XSetErrorHandler(xerrorstart);
|
||||
/* this causes an error if some other window manager is running */
|
||||
XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask);
|
||||
XSync(dpy, False);
|
||||
XSetErrorHandler(xerror);
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
void
|
||||
cleanup(void)
|
||||
{
|
||||
@@ -992,18 +976,6 @@ incnmaster(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
static int
|
||||
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
|
||||
{
|
||||
while (n--)
|
||||
if (unique[n].x_org == info->x_org && unique[n].y_org == info->y_org
|
||||
&& unique[n].width == info->width && unique[n].height == info->height)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
|
||||
void
|
||||
keypress(XEvent *e)
|
||||
{
|
||||
@@ -1855,62 +1827,6 @@ updategeom(void)
|
||||
{
|
||||
int dirty = 0;
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (XineramaIsActive(dpy)) {
|
||||
int i, j, n, nn;
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
XineramaScreenInfo *info = XineramaQueryScreens(dpy, &nn);
|
||||
XineramaScreenInfo *unique = NULL;
|
||||
|
||||
for (n = 0, m = mons; m; m = m->next, n++);
|
||||
/* only consider unique geometries as separate screens */
|
||||
unique = ecalloc(nn, sizeof(XineramaScreenInfo));
|
||||
for (i = 0, j = 0; i < nn; i++)
|
||||
if (isuniquegeom(unique, j, &info[i]))
|
||||
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
|
||||
XFree(info);
|
||||
nn = j;
|
||||
|
||||
/* new monitors if nn > n */
|
||||
for (i = n; i < nn; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
if (m)
|
||||
m->next = createmon();
|
||||
else
|
||||
mons = createmon();
|
||||
}
|
||||
for (i = 0, m = mons; i < nn && m; m = m->next, i++)
|
||||
if (i >= n
|
||||
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|
||||
|| unique[i].width != m->mw || unique[i].height != m->mh)
|
||||
{
|
||||
dirty = 1;
|
||||
m->num = i;
|
||||
m->mx = m->wx = unique[i].x_org;
|
||||
m->my = m->wy = unique[i].y_org;
|
||||
m->mw = m->ww = unique[i].width;
|
||||
m->mh = m->wh = unique[i].height;
|
||||
updatebarpos(m);
|
||||
}
|
||||
/* removed monitors if n > nn */
|
||||
for (i = nn; i < n; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
while ((c = m->clients)) {
|
||||
dirty = 1;
|
||||
m->clients = c->next;
|
||||
detachstack(c);
|
||||
c->mon = mons;
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
}
|
||||
if (m == selmon)
|
||||
selmon = mons;
|
||||
cleanupmon(m);
|
||||
}
|
||||
free(unique);
|
||||
} else
|
||||
#endif /* XINERAMA */
|
||||
{ /* default monitor setup */
|
||||
if (!mons)
|
||||
mons = createmon();
|
||||
@@ -2105,15 +2021,6 @@ xerrordummy(Display *dpy, XErrorEvent *ee)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Startup Error handler to check if another window manager
|
||||
* is already running. */
|
||||
int
|
||||
xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||
{
|
||||
die("dwm: another window manager is already running");
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
zoom(const Arg *arg)
|
||||
{
|
||||
@@ -2129,15 +2036,8 @@ zoom(const Arg *arg)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
if (argc == 2 && !strcmp("-v", argv[1]))
|
||||
die("dwm-"VERSION);
|
||||
if (argc != 1)
|
||||
die("usage: dwm [-v]");
|
||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||
fputs("warning: no locale support\n", stderr);
|
||||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
die("dwm: cannot open display");
|
||||
checkotherwm();
|
||||
setup();
|
||||
scan();
|
||||
run();
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/* cc transient.c -o transient -lX11 */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
int main(void) {
|
||||
Display *d;
|
||||
Window r, f, t = None;
|
||||
XSizeHints h;
|
||||
XEvent e;
|
||||
|
||||
d = XOpenDisplay(NULL);
|
||||
if (!d)
|
||||
exit(1);
|
||||
r = DefaultRootWindow(d);
|
||||
|
||||
f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
|
||||
h.min_width = h.max_width = h.min_height = h.max_height = 400;
|
||||
h.flags = PMinSize | PMaxSize;
|
||||
XSetWMNormalHints(d, f, &h);
|
||||
XStoreName(d, f, "floating");
|
||||
XMapWindow(d, f);
|
||||
|
||||
XSelectInput(d, f, ExposureMask);
|
||||
while (1) {
|
||||
XNextEvent(d, &e);
|
||||
|
||||
if (t == None) {
|
||||
sleep(5);
|
||||
t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
|
||||
XSetTransientForHint(d, t, f);
|
||||
XStoreName(d, t, "transient");
|
||||
XMapWindow(d, t);
|
||||
XSelectInput(d, t, ExposureMask);
|
||||
}
|
||||
}
|
||||
|
||||
XCloseDisplay(d);
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
||||
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
||||
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
|
||||
|
||||
Reference in New Issue
Block a user