removing a bunch of features for dwm that I just dont use, like I never use my mouse for the bar or moving windows
This commit is contained in:
@@ -11,20 +11,19 @@ static const char *colors[][3] = {
|
|||||||
|
|
||||||
static const char *tags[] = { "1", "2", "3" };
|
static const char *tags[] = { "1", "2", "3" };
|
||||||
static const Rule rules[] = {
|
static const Rule rules[] = {
|
||||||
{ "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 },
|
{ "st-256color", "st-256color", NULL, 1, 0, -1 },
|
||||||
|
{ "librewolf", "Navigator", NULL, 1 << 1, 0, -1 },
|
||||||
|
{ "PrismLauncher", "prismlauncher", NULL, 1 << 2, 0, -1 },
|
||||||
|
{ "steam", "steamwebhelper", NULL, 1 << 2, 0, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const float mfact = 0.55;
|
static const float mfact = 0.55;
|
||||||
static const int nmaster = 1;
|
static const int nmaster = 1;
|
||||||
static const int resizehints = 1;
|
static const int resizehints = 1;
|
||||||
static const int lockfullscreen = 1;
|
static const int lockfullscreen = 1;
|
||||||
static const int refreshrate = 120;
|
|
||||||
|
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
{ "[]=", tile },
|
{ "L: Tile", tile },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
@@ -36,20 +35,15 @@ static const Layout layouts[] = {
|
|||||||
|
|
||||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
|
|
||||||
static char dmenumon[2] = "0";
|
|
||||||
static const char *dmenucmd[] = { "dmenu_run", NULL };
|
|
||||||
static const char *termcmd[] = { "st", NULL };
|
|
||||||
static const char *browsercmd[] = { "librewolf", NULL };
|
|
||||||
|
|
||||||
#include "X11/XF86keysym.h"
|
#include "X11/XF86keysym.h"
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
{ MODKEY, XK_Return, spawn, SHCMD("st") },
|
||||||
{ MODKEY, XK_space, spawn, {.v = dmenucmd } },
|
{ MODKEY, XK_space, spawn, SHCMD("dmenu_run") },
|
||||||
{ MODKEY, XK_f, spawn, {.v = browsercmd } },
|
{ MODKEY, XK_f, spawn, SHCMD("librewolf") },
|
||||||
{ MODKEY, XK_h, focusstack, {.i = +1 } },
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
{ MODKEY, XK_l, focusstack, {.i = -1 } },
|
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||||
{ MODKEY, XK_j, setmfact, {.f = -0.05} },
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
{ MODKEY, XK_k, setmfact, {.f = +0.05} },
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
{ MODKEY, XK_q, killclient, {0} },
|
{ MODKEY, XK_q, killclient, {0} },
|
||||||
@@ -57,7 +51,6 @@ static const Key keys[] = {
|
|||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
|
|
||||||
{ MODKEY, XK_c, spawn, SHCMD("sh /home/andrew/.config/suckless/dwm/scripts/calc.sh") },
|
|
||||||
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("sh /home/andrew/.config/suckless/dwm/scripts/volume.sh up") },
|
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("sh /home/andrew/.config/suckless/dwm/scripts/volume.sh up") },
|
||||||
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("sh /home/andrew/.config/suckless/dwm/scripts/volume.sh down") },
|
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("sh /home/andrew/.config/suckless/dwm/scripts/volume.sh down") },
|
||||||
|
|
||||||
@@ -66,18 +59,3 @@ static const Key keys[] = {
|
|||||||
TAGKEYS( XK_3, 2 )
|
TAGKEYS( XK_3, 2 )
|
||||||
TAGKEYS( XK_4, 3 )
|
TAGKEYS( XK_4, 3 )
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Button buttons[] = {
|
|
||||||
/* click event mask button function argument */
|
|
||||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
|
||||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
|
||||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
|
||||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
|
||||||
{ ClkTagBar, 0, Button1, view, {0} },
|
|
||||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
|
||||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
|
||||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
|
||||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
|
||||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
|
||||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
|
||||||
};
|
|
||||||
|
|||||||
+30
-254
@@ -120,7 +120,6 @@ static void arrange(Monitor *m);
|
|||||||
static void arrangemon(Monitor *m);
|
static void arrangemon(Monitor *m);
|
||||||
static void attach(Client *c);
|
static void attach(Client *c);
|
||||||
static void attachstack(Client *c);
|
static void attachstack(Client *c);
|
||||||
static void buttonpress(XEvent *e);
|
|
||||||
static void cleanup(void);
|
static void cleanup(void);
|
||||||
static void cleanupmon(Monitor *mon);
|
static void cleanupmon(Monitor *mon);
|
||||||
static void clientmessage(XEvent *e);
|
static void clientmessage(XEvent *e);
|
||||||
@@ -142,7 +141,6 @@ static Atom getatomprop(Client *c, Atom prop);
|
|||||||
static int getrootptr(int *x, int *y);
|
static int getrootptr(int *x, int *y);
|
||||||
static long getstate(Window w);
|
static long getstate(Window w);
|
||||||
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||||
static void grabbuttons(Client *c, int focused);
|
|
||||||
static void grabkeys(void);
|
static void grabkeys(void);
|
||||||
static void incnmaster(const Arg *arg);
|
static void incnmaster(const Arg *arg);
|
||||||
static void keypress(XEvent *e);
|
static void keypress(XEvent *e);
|
||||||
@@ -151,23 +149,19 @@ static void manage(Window w, XWindowAttributes *wa);
|
|||||||
static void mappingnotify(XEvent *e);
|
static void mappingnotify(XEvent *e);
|
||||||
static void maprequest(XEvent *e);
|
static void maprequest(XEvent *e);
|
||||||
static void motionnotify(XEvent *e);
|
static void motionnotify(XEvent *e);
|
||||||
static void movemouse(const Arg *arg);
|
|
||||||
static Client *nexttiled(Client *c);
|
static Client *nexttiled(Client *c);
|
||||||
static void pop(Client *c);
|
static void pop(Client *c);
|
||||||
static void propertynotify(XEvent *e);
|
static void propertynotify(XEvent *e);
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
static Monitor *recttomon(int x, int y, int w, int h);
|
||||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||||
static void resizemouse(const Arg *arg);
|
|
||||||
static void restack(Monitor *m);
|
static void restack(Monitor *m);
|
||||||
static void run(void);
|
static void run(void);
|
||||||
static void scan(void);
|
static void scan(void);
|
||||||
static int sendevent(Client *c, Atom proto);
|
static int sendevent(Client *c, Atom proto);
|
||||||
static void sendmon(Client *c, Monitor *m);
|
|
||||||
static void setclientstate(Client *c, long state);
|
static void setclientstate(Client *c, long state);
|
||||||
static void setfocus(Client *c);
|
static void setfocus(Client *c);
|
||||||
static void setfullscreen(Client *c, int fullscreen);
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
static void setlayout(const Arg *arg);
|
|
||||||
static void setmfact(const Arg *arg);
|
static void setmfact(const Arg *arg);
|
||||||
static void setup(void);
|
static void setup(void);
|
||||||
static void seturgent(Client *c, int urg);
|
static void seturgent(Client *c, int urg);
|
||||||
@@ -181,9 +175,7 @@ static void toggleview(const Arg *arg);
|
|||||||
static void unfocus(Client *c, int setfocus);
|
static void unfocus(Client *c, int setfocus);
|
||||||
static void unmanage(Client *c, int destroyed);
|
static void unmanage(Client *c, int destroyed);
|
||||||
static void unmapnotify(XEvent *e);
|
static void unmapnotify(XEvent *e);
|
||||||
static void updatebarpos(Monitor *m);
|
|
||||||
static void updatebars(void);
|
static void updatebars(void);
|
||||||
static void updateclientlist(void);
|
|
||||||
static int updategeom(void);
|
static int updategeom(void);
|
||||||
static void updatenumlockmask(void);
|
static void updatenumlockmask(void);
|
||||||
static void updatesizehints(Client *c);
|
static void updatesizehints(Client *c);
|
||||||
@@ -208,7 +200,6 @@ static int lrpad; /* sum of left and right padding for text */
|
|||||||
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||||
static unsigned int numlockmask = 0;
|
static unsigned int numlockmask = 0;
|
||||||
static void (*handler[LASTEvent]) (XEvent *) = {
|
static void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
[ButtonPress] = buttonpress,
|
|
||||||
[ClientMessage] = clientmessage,
|
[ClientMessage] = clientmessage,
|
||||||
[ConfigureRequest] = configurerequest,
|
[ConfigureRequest] = configurerequest,
|
||||||
[ConfigureNotify] = configurenotify,
|
[ConfigureNotify] = configurenotify,
|
||||||
@@ -379,48 +370,6 @@ attachstack(Client *c)
|
|||||||
c->mon->stack = c;
|
c->mon->stack = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
buttonpress(XEvent *e)
|
|
||||||
{
|
|
||||||
unsigned int i, x, click;
|
|
||||||
Arg arg = {0};
|
|
||||||
Client *c;
|
|
||||||
Monitor *m;
|
|
||||||
XButtonPressedEvent *ev = &e->xbutton;
|
|
||||||
|
|
||||||
click = ClkRootWin;
|
|
||||||
/* focus monitor if necessary */
|
|
||||||
if ((m = wintomon(ev->window)) && m != selmon) {
|
|
||||||
unfocus(selmon->sel, 1);
|
|
||||||
selmon = m;
|
|
||||||
focus(NULL);
|
|
||||||
}
|
|
||||||
if (ev->window == selmon->barwin) {
|
|
||||||
i = x = 0;
|
|
||||||
do
|
|
||||||
x += TEXTW(tags[i]);
|
|
||||||
while (ev->x >= x && ++i < LENGTH(tags));
|
|
||||||
if (i < LENGTH(tags)) {
|
|
||||||
click = ClkTagBar;
|
|
||||||
arg.ui = 1 << i;
|
|
||||||
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
|
|
||||||
click = ClkLtSymbol;
|
|
||||||
else if (ev->x > selmon->ww - (int)TEXTW(stext))
|
|
||||||
click = ClkStatusText;
|
|
||||||
else
|
|
||||||
click = ClkWinTitle;
|
|
||||||
} else if ((c = wintoclient(ev->window))) {
|
|
||||||
focus(c);
|
|
||||||
restack(selmon);
|
|
||||||
XAllowEvents(dpy, ReplayPointer, CurrentTime);
|
|
||||||
click = ClkClientWin;
|
|
||||||
}
|
|
||||||
for (i = 0; i < LENGTH(buttons); i++)
|
|
||||||
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
|
|
||||||
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
|
|
||||||
buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cleanup(void)
|
cleanup(void)
|
||||||
{
|
{
|
||||||
@@ -742,7 +691,6 @@ focus(Client *c)
|
|||||||
seturgent(c, 0);
|
seturgent(c, 0);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
grabbuttons(c, 1);
|
|
||||||
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
|
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
|
||||||
setfocus(c);
|
setfocus(c);
|
||||||
} else {
|
} else {
|
||||||
@@ -856,27 +804,6 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
grabbuttons(Client *c, int focused)
|
|
||||||
{
|
|
||||||
updatenumlockmask();
|
|
||||||
{
|
|
||||||
unsigned int i, j;
|
|
||||||
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
|
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
|
||||||
if (!focused)
|
|
||||||
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
|
|
||||||
BUTTONMASK, GrabModeSync, GrabModeSync, None, None);
|
|
||||||
for (i = 0; i < LENGTH(buttons); i++)
|
|
||||||
if (buttons[i].click == ClkClientWin)
|
|
||||||
for (j = 0; j < LENGTH(modifiers); j++)
|
|
||||||
XGrabButton(dpy, buttons[i].button,
|
|
||||||
buttons[i].mask | modifiers[j],
|
|
||||||
c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grabkeys(void)
|
grabkeys(void)
|
||||||
{
|
{
|
||||||
@@ -985,7 +912,6 @@ manage(Window w, XWindowAttributes *wa)
|
|||||||
updatesizehints(c);
|
updatesizehints(c);
|
||||||
updatewmhints(c);
|
updatewmhints(c);
|
||||||
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
|
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
|
||||||
grabbuttons(c, 0);
|
|
||||||
if (!c->isfloating)
|
if (!c->isfloating)
|
||||||
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
||||||
if (c->isfloating)
|
if (c->isfloating)
|
||||||
@@ -1043,58 +969,6 @@ motionnotify(XEvent *e)
|
|||||||
mon = m;
|
mon = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
movemouse(const Arg *arg)
|
|
||||||
{
|
|
||||||
int x, y, ocx, ocy, nx, ny;
|
|
||||||
Client *c;
|
|
||||||
Monitor *m;
|
|
||||||
XEvent ev;
|
|
||||||
Time lasttime = 0;
|
|
||||||
|
|
||||||
if (!(c = selmon->sel))
|
|
||||||
return;
|
|
||||||
if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
|
|
||||||
return;
|
|
||||||
restack(selmon);
|
|
||||||
ocx = c->x;
|
|
||||||
ocy = c->y;
|
|
||||||
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
|
||||||
None, cursor[CurMove]->cursor, CurrentTime) != GrabSuccess)
|
|
||||||
return;
|
|
||||||
if (!getrootptr(&x, &y))
|
|
||||||
return;
|
|
||||||
do {
|
|
||||||
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
|
|
||||||
switch(ev.type) {
|
|
||||||
case ConfigureRequest:
|
|
||||||
case Expose:
|
|
||||||
case MapRequest:
|
|
||||||
handler[ev.type](&ev);
|
|
||||||
break;
|
|
||||||
case MotionNotify:
|
|
||||||
if ((ev.xmotion.time - lasttime) <= (1000 / refreshrate))
|
|
||||||
continue;
|
|
||||||
lasttime = ev.xmotion.time;
|
|
||||||
|
|
||||||
nx = ocx + (ev.xmotion.x - x);
|
|
||||||
ny = ocy + (ev.xmotion.y - y);
|
|
||||||
if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
|
|
||||||
&& (abs(nx - c->x) > 0 || abs(ny - c->y) > 0))
|
|
||||||
togglefloating(NULL);
|
|
||||||
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
|
||||||
resize(c, nx, ny, c->w, c->h, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (ev.type != ButtonRelease);
|
|
||||||
XUngrabPointer(dpy, CurrentTime);
|
|
||||||
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
|
|
||||||
sendmon(c, m);
|
|
||||||
selmon = m;
|
|
||||||
focus(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
nexttiled(Client *c)
|
nexttiled(Client *c)
|
||||||
{
|
{
|
||||||
@@ -1184,63 +1058,6 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
|||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
resizemouse(const Arg *arg)
|
|
||||||
{
|
|
||||||
int ocx, ocy, nw, nh;
|
|
||||||
Client *c;
|
|
||||||
Monitor *m;
|
|
||||||
XEvent ev;
|
|
||||||
Time lasttime = 0;
|
|
||||||
|
|
||||||
if (!(c = selmon->sel))
|
|
||||||
return;
|
|
||||||
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
|
|
||||||
return;
|
|
||||||
restack(selmon);
|
|
||||||
ocx = c->x;
|
|
||||||
ocy = c->y;
|
|
||||||
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
|
||||||
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
|
|
||||||
return;
|
|
||||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
|
||||||
do {
|
|
||||||
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
|
|
||||||
switch(ev.type) {
|
|
||||||
case ConfigureRequest:
|
|
||||||
case Expose:
|
|
||||||
case MapRequest:
|
|
||||||
handler[ev.type](&ev);
|
|
||||||
break;
|
|
||||||
case MotionNotify:
|
|
||||||
if ((ev.xmotion.time - lasttime) <= (1000 / refreshrate))
|
|
||||||
continue;
|
|
||||||
lasttime = ev.xmotion.time;
|
|
||||||
|
|
||||||
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
|
|
||||||
nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
|
|
||||||
if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
|
|
||||||
&& c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh)
|
|
||||||
{
|
|
||||||
if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
|
|
||||||
&& (abs(nw - c->w) > 0 || abs(nh - c->h) > 0))
|
|
||||||
togglefloating(NULL);
|
|
||||||
}
|
|
||||||
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
|
||||||
resize(c, c->x, c->y, nw, nh, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (ev.type != ButtonRelease);
|
|
||||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
|
||||||
XUngrabPointer(dpy, CurrentTime);
|
|
||||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
|
||||||
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
|
|
||||||
sendmon(c, m);
|
|
||||||
selmon = m;
|
|
||||||
focus(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
restack(Monitor *m)
|
restack(Monitor *m)
|
||||||
{
|
{
|
||||||
@@ -1304,22 +1121,6 @@ scan(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
sendmon(Client *c, Monitor *m)
|
|
||||||
{
|
|
||||||
if (c->mon == m)
|
|
||||||
return;
|
|
||||||
unfocus(c, 1);
|
|
||||||
detach(c);
|
|
||||||
detachstack(c);
|
|
||||||
c->mon = m;
|
|
||||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
|
||||||
attach(c);
|
|
||||||
attachstack(c);
|
|
||||||
focus(NULL);
|
|
||||||
arrange(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
setclientstate(Client *c, long state)
|
setclientstate(Client *c, long state)
|
||||||
{
|
{
|
||||||
@@ -1394,20 +1195,6 @@ setfullscreen(Client *c, int fullscreen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
setlayout(const Arg *arg)
|
|
||||||
{
|
|
||||||
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
|
||||||
selmon->sellt ^= 1;
|
|
||||||
if (arg && arg->v)
|
|
||||||
selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
|
||||||
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
|
|
||||||
if (selmon->sel)
|
|
||||||
arrange(selmon);
|
|
||||||
else
|
|
||||||
drawbar(selmon);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* arg > 1.0 will set mfact absolutely */
|
/* arg > 1.0 will set mfact absolutely */
|
||||||
void
|
void
|
||||||
setmfact(const Arg *arg)
|
setmfact(const Arg *arg)
|
||||||
@@ -1536,8 +1323,6 @@ spawn(const Arg *arg)
|
|||||||
{
|
{
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
if (arg->v == dmenucmd)
|
|
||||||
dmenumon[0] = '0' + selmon->num;
|
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
if (dpy)
|
if (dpy)
|
||||||
close(ConnectionNumber(dpy));
|
close(ConnectionNumber(dpy));
|
||||||
@@ -1639,7 +1424,6 @@ unfocus(Client *c, int setfocus)
|
|||||||
{
|
{
|
||||||
if (!c)
|
if (!c)
|
||||||
return;
|
return;
|
||||||
grabbuttons(c, 0);
|
|
||||||
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
|
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
|
||||||
if (setfocus) {
|
if (setfocus) {
|
||||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||||
@@ -1669,7 +1453,13 @@ unmanage(Client *c, int destroyed)
|
|||||||
}
|
}
|
||||||
free(c);
|
free(c);
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
updateclientlist();
|
|
||||||
|
XDeleteProperty(dpy, root, netatom[NetClientList]);
|
||||||
|
for (m = mons; m; m = m->next)
|
||||||
|
for (c = m->clients; c; c = c->next)
|
||||||
|
XChangeProperty(dpy, root, netatom[NetClientList],
|
||||||
|
XA_WINDOW, 32, PropModeAppend,
|
||||||
|
(unsigned char *) &(c->win), 1);
|
||||||
arrange(m);
|
arrange(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1709,32 +1499,6 @@ updatebars(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
updatebarpos(Monitor *m)
|
|
||||||
{
|
|
||||||
m->wy = m->my;
|
|
||||||
m->wh = m->mh;
|
|
||||||
if (m->showbar) {
|
|
||||||
m->wh -= bh;
|
|
||||||
m->by = m->topbar ? m->wy : m->wy + m->wh;
|
|
||||||
m->wy = m->topbar ? m->wy + bh : m->wy;
|
|
||||||
} else
|
|
||||||
m->by = -bh;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
updateclientlist(void)
|
|
||||||
{
|
|
||||||
Client *c;
|
|
||||||
Monitor *m;
|
|
||||||
|
|
||||||
XDeleteProperty(dpy, root, netatom[NetClientList]);
|
|
||||||
for (m = mons; m; m = m->next)
|
|
||||||
for (c = m->clients; c; c = c->next)
|
|
||||||
XChangeProperty(dpy, root, netatom[NetClientList],
|
|
||||||
XA_WINDOW, 32, PropModeAppend,
|
|
||||||
(unsigned char *) &(c->win), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
updategeom(void)
|
updategeom(void)
|
||||||
@@ -1748,7 +1512,15 @@ updategeom(void)
|
|||||||
dirty = 1;
|
dirty = 1;
|
||||||
mons->mw = mons->ww = sw;
|
mons->mw = mons->ww = sw;
|
||||||
mons->mh = mons->wh = sh;
|
mons->mh = mons->wh = sh;
|
||||||
updatebarpos(mons);
|
mons->wy = mons->my;
|
||||||
|
mons->wh = mons->mh;
|
||||||
|
if (mons->showbar) {
|
||||||
|
mons->wh -= bh;
|
||||||
|
mons->by = mons->topbar ? mons->wy : mons->wy + mons->wh;
|
||||||
|
mons->wy = mons->topbar ? mons->wy + bh : mons->wy;
|
||||||
|
} else
|
||||||
|
mons->by = -bh;
|
||||||
|
// updatebarpos(mons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dirty) {
|
if (dirty) {
|
||||||
@@ -1789,34 +1561,39 @@ updatesizehints(Client *c)
|
|||||||
} else if (size.flags & PMinSize) {
|
} else if (size.flags & PMinSize) {
|
||||||
c->basew = size.min_width;
|
c->basew = size.min_width;
|
||||||
c->baseh = size.min_height;
|
c->baseh = size.min_height;
|
||||||
} else
|
} else {
|
||||||
c->basew = c->baseh = 0;
|
c->basew = c->baseh = 0;
|
||||||
|
}
|
||||||
if (size.flags & PResizeInc) {
|
if (size.flags & PResizeInc) {
|
||||||
c->incw = size.width_inc;
|
c->incw = size.width_inc;
|
||||||
c->inch = size.height_inc;
|
c->inch = size.height_inc;
|
||||||
} else
|
} else {
|
||||||
c->incw = c->inch = 0;
|
c->incw = c->inch = 0;
|
||||||
|
}
|
||||||
if (size.flags & PMaxSize) {
|
if (size.flags & PMaxSize) {
|
||||||
c->maxw = size.max_width;
|
c->maxw = size.max_width;
|
||||||
c->maxh = size.max_height;
|
c->maxh = size.max_height;
|
||||||
} else
|
} else {
|
||||||
c->maxw = c->maxh = 0;
|
c->maxw = c->maxh = 0;
|
||||||
|
}
|
||||||
if (size.flags & PMinSize) {
|
if (size.flags & PMinSize) {
|
||||||
c->minw = size.min_width;
|
c->minw = size.min_width;
|
||||||
c->minh = size.min_height;
|
c->minh = size.min_height;
|
||||||
} else if (size.flags & PBaseSize) {
|
} else if (size.flags & PBaseSize) {
|
||||||
c->minw = size.base_width;
|
c->minw = size.base_width;
|
||||||
c->minh = size.base_height;
|
c->minh = size.base_height;
|
||||||
} else
|
} else {
|
||||||
c->minw = c->minh = 0;
|
c->minw = c->minh = 0;
|
||||||
|
}
|
||||||
if (size.flags & PAspect) {
|
if (size.flags & PAspect) {
|
||||||
c->mina = (float)size.min_aspect.y / size.min_aspect.x;
|
c->mina = (float)size.min_aspect.y / size.min_aspect.x;
|
||||||
c->maxa = (float)size.max_aspect.x / size.max_aspect.y;
|
c->maxa = (float)size.max_aspect.x / size.max_aspect.y;
|
||||||
} else
|
} else {
|
||||||
c->maxa = c->mina = 0.0;
|
c->maxa = c->mina = 0.0;
|
||||||
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
||||||
c->hintsvalid = 1;
|
c->hintsvalid = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
updatestatus(void)
|
updatestatus(void)
|
||||||
@@ -1856,15 +1633,14 @@ updatewmhints(Client *c)
|
|||||||
if (c == selmon->sel && wmh->flags & XUrgencyHint) {
|
if (c == selmon->sel && wmh->flags & XUrgencyHint) {
|
||||||
wmh->flags &= ~XUrgencyHint;
|
wmh->flags &= ~XUrgencyHint;
|
||||||
XSetWMHints(dpy, c->win, wmh);
|
XSetWMHints(dpy, c->win, wmh);
|
||||||
} else
|
} else {
|
||||||
c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0;
|
c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0;
|
||||||
if (wmh->flags & InputHint)
|
if (wmh->flags & InputHint) c->neverfocus = !wmh->input;
|
||||||
c->neverfocus = !wmh->input;
|
else c->neverfocus = 0;
|
||||||
else
|
|
||||||
c->neverfocus = 0;
|
|
||||||
XFree(wmh);
|
XFree(wmh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view(const Arg *arg)
|
view(const Arg *arg)
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
q=$(echo -e "Add\nSubtract\nMultiply\nDivide" | dmenu -l 4 -p "Options: ")
|
|
||||||
f=$(dmenu -p "First: " < /dev/null)
|
|
||||||
s=$(dmenu -p "Second: " < /dev/null)
|
|
||||||
r=""
|
|
||||||
|
|
||||||
case "$q" in
|
|
||||||
Add) r=$((f + s)) ;;
|
|
||||||
Subtract) r=$((f - s)) ;;
|
|
||||||
Multiply) r=$((f * s)) ;;
|
|
||||||
Divide) r=$(echo "scale=2; $f / $s" | bc) ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "$r" | dmenu -p "Answer: "
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
const char* vol() {
|
const char* vol() {
|
||||||
|
|||||||
Reference in New Issue
Block a user