add preserveonrestart
This commit is contained in:
parent
916b7ed459
commit
8e77981703
1 changed files with 37 additions and 1 deletions
38
dwm.c
38
dwm.c
|
|
@ -85,7 +85,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||||
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||||
enum { NetSupported, NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetWMCheck,
|
enum { NetSupported, NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetWMCheck,
|
||||||
NetSystemTrayOrientationHorz, NetWMName, NetWMState, NetWMFullscreen, NetActiveWindow,
|
NetSystemTrayOrientationHorz, NetWMName, NetWMState, NetWMFullscreen, NetActiveWindow,
|
||||||
NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetClientListStacking, NetWMWindowTypeDock, NetLast }; /* EWMH atoms */
|
NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetClientListStacking, NetWMWindowTypeDock, NetClientInfo, NetLast }; /* EWMH atoms */
|
||||||
enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
|
enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
|
||||||
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
||||||
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||||
|
|
@ -249,6 +249,7 @@ static void scan(void);
|
||||||
static int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, long d4);
|
static int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, long d4);
|
||||||
static void sendmon(Client *c, Monitor *m);
|
static void sendmon(Client *c, Monitor *m);
|
||||||
static void setclientstate(Client *c, long state);
|
static void setclientstate(Client *c, long state);
|
||||||
|
static void setclienttagprop(Client *c);
|
||||||
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 setlayout(const Arg *arg);
|
||||||
|
|
@ -1353,6 +1354,26 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
updatewindowtype(c);
|
updatewindowtype(c);
|
||||||
updatesizehints(c);
|
updatesizehints(c);
|
||||||
updatewmhints(c);
|
updatewmhints(c);
|
||||||
|
{
|
||||||
|
int format;
|
||||||
|
unsigned long *data, n, extra;
|
||||||
|
Monitor *m;
|
||||||
|
Atom atom;
|
||||||
|
if (XGetWindowProperty(dpy, c->win, netatom[NetClientInfo], 0L, 2L, False, XA_CARDINAL,
|
||||||
|
&atom, &format, &n, &extra, (unsigned char **)&data) == Success && n == 2) {
|
||||||
|
c->tags = *data;
|
||||||
|
for (m = mons; m; m = m->next) {
|
||||||
|
if (m->num == *(data+1)) {
|
||||||
|
c->mon = m;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (n > 0)
|
||||||
|
XFree(data);
|
||||||
|
}
|
||||||
|
setclienttagprop(c);
|
||||||
|
|
||||||
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
|
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
|
||||||
grabbuttons(c, 0);
|
grabbuttons(c, 0);
|
||||||
if (!c->isfloating)
|
if (!c->isfloating)
|
||||||
|
|
@ -1969,6 +1990,7 @@ sendmon(Client *c, Monitor *m)
|
||||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||||
attach(c);
|
attach(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
|
setclienttagprop(c);
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -2190,6 +2212,7 @@ setup(void)
|
||||||
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
|
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||||
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
|
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
|
||||||
netatom[NetClientListStacking] = XInternAtom(dpy, "_NET_CLIENT_LIST_STACKING", False);
|
netatom[NetClientListStacking] = XInternAtom(dpy, "_NET_CLIENT_LIST_STACKING", False);
|
||||||
|
netatom[NetClientInfo] = XInternAtom(dpy, "_NET_CLIENT_INFO", False);
|
||||||
xatom[Manager] = XInternAtom(dpy, "MANAGER", False);
|
xatom[Manager] = XInternAtom(dpy, "MANAGER", False);
|
||||||
xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False);
|
xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False);
|
||||||
xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
|
xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
|
||||||
|
|
@ -2219,6 +2242,7 @@ setup(void)
|
||||||
PropModeReplace, (unsigned char *) netatom, NetLast);
|
PropModeReplace, (unsigned char *) netatom, NetLast);
|
||||||
XDeleteProperty(dpy, root, netatom[NetClientList]);
|
XDeleteProperty(dpy, root, netatom[NetClientList]);
|
||||||
XDeleteProperty(dpy, root, netatom[NetClientListStacking]);
|
XDeleteProperty(dpy, root, netatom[NetClientListStacking]);
|
||||||
|
XDeleteProperty(dpy, root, netatom[NetClientInfo]);
|
||||||
/* select events */
|
/* select events */
|
||||||
wa.cursor = cursor[CurNormal]->cursor;
|
wa.cursor = cursor[CurNormal]->cursor;
|
||||||
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
|
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
|
||||||
|
|
@ -2305,11 +2329,22 @@ unswallow(Client *c)
|
||||||
c->swallowing = NULL;
|
c->swallowing = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setclienttagprop(Client *c)
|
||||||
|
{
|
||||||
|
long data[] = { (long) c->tags, (long) c->mon->num };
|
||||||
|
XChangeProperty(dpy, c->win, netatom[NetClientInfo], XA_CARDINAL, 32,
|
||||||
|
PropModeReplace, (unsigned char *) data, 2);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tag(const Arg *arg)
|
tag(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
Client *c;
|
||||||
if (selmon->sel && arg->ui & TAGMASK) {
|
if (selmon->sel && arg->ui & TAGMASK) {
|
||||||
|
c = selmon->sel;
|
||||||
selmon->sel->tags = arg->ui & TAGMASK;
|
selmon->sel->tags = arg->ui & TAGMASK;
|
||||||
|
setclienttagprop(c);
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
@ -2410,6 +2445,7 @@ toggletag(const Arg *arg)
|
||||||
newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
|
newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
|
||||||
if (newtags) {
|
if (newtags) {
|
||||||
selmon->sel->tags = newtags;
|
selmon->sel->tags = newtags;
|
||||||
|
setclienttagprop(selmon->sel);
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue