Update awesomebar patch to new version with new keybinds
This commit is contained in:
parent
d0bc5bd0d2
commit
dbe4cb0f74
|
@ -28,12 +28,10 @@
|
|||
- Super+j/k | Move focus between visible windows
|
||||
- Super+Alt+j/k | Increase/decrease gaps between windows in tiling layout by 1
|
||||
- Super+Alt+u/d | Increase/decrease gaps between windows in tiling layout by 5
|
||||
- Super+Control+j/k | Move focus between hidden windows
|
||||
- Super+Control+j/k | Move focus between hidden windows (Can then 'Show')
|
||||
- Super+a/d | Increase/decrease size of each window
|
||||
- Super+o | Hide a window
|
||||
- Super+Control+o | Show a window
|
||||
- Super+w | Hide all windows except focused
|
||||
- Super+Control+w | Show all windows except focused
|
||||
- Super+Control+o | Show a hidden focused window
|
||||
- Super+a/d | Move to the next/previous tag
|
||||
- Super+Minus | Show the scratchpad
|
||||
- Super+Equal | Remove the scratchpad
|
||||
|
|
|
@ -132,10 +132,8 @@ static Key keys[] = {
|
|||
{ SMODKEY, -1, XK_d, viewtoright, {0} },
|
||||
|
||||
/* Hide/Show keybinds */
|
||||
{ MODKEY, -1, XK_o, hidewin, {0} },
|
||||
{ MODKEY|ControlMask, -1, XK_o, restorewin, {0} },
|
||||
{ MODKEY, -1, XK_w, hideotherwins, {0} },
|
||||
{ MODKEY|ControlMask, -1, XK_w, restoreotherwins, {0} },
|
||||
{ MODKEY, -1, XK_o, hide, {0} },
|
||||
{ MODKEY|ControlMask, -1, XK_o, show, {0} },
|
||||
|
||||
/* Chained keybinds */
|
||||
{ MODKEY, XK_c, XK_w, spawn, SHCMD(TERMINAL "speedwm-core -curl-weather") },
|
||||
|
|
355
speedwm.c
355
speedwm.c
|
@ -278,17 +278,17 @@ static void expose(XEvent *e);
|
|||
static void focus(Client *c);
|
||||
static void focusin(XEvent *e);
|
||||
static void focusmon(const Arg *arg);
|
||||
static void focusstack(int inc, int vis);
|
||||
static void focusstackvis(const Arg *arg);
|
||||
static void focusstackhid(const Arg *arg);
|
||||
static void focusstack(int inc, int vis);
|
||||
static Atom getatomprop(Client *c, Atom prop);
|
||||
static Picture geticonprop(Window w, unsigned int *icw, unsigned int *ich);
|
||||
static int getrootptr(int *x, int *y);
|
||||
static long getstate(Window w);
|
||||
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 hide(Client *c);
|
||||
static void hide(const Arg *arg);
|
||||
static void hidewin(Client *c);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void keypress(XEvent *e);
|
||||
static int fake_signal(void);
|
||||
|
@ -348,7 +348,7 @@ static void setcfact(const Arg *arg);
|
|||
static void setmfact(const Arg *arg);
|
||||
static void setup(void);
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void show(Client *c);
|
||||
static void show(const Arg *arg);
|
||||
static void showwin(Client *c);
|
||||
static void showhide(Client *c);
|
||||
static void showtagpreview(unsigned int i);
|
||||
|
@ -369,10 +369,6 @@ static void tile54(Monitor *);
|
|||
static void togglebar(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void toggleopacity(const Arg *arg);
|
||||
static void hidewin(const Arg *arg);
|
||||
static void restorewin(const Arg *arg);
|
||||
static void hideotherwins(const Arg *arg);
|
||||
static void restoreotherwins(const Arg *arg);
|
||||
static void togglefullscr(const Arg *arg);
|
||||
static void freeicon(Client *c);
|
||||
static void togglewin(const Arg *arg);
|
||||
|
@ -460,10 +456,6 @@ static Monitor *mons, *selmon;
|
|||
static Window root, wmcheckwin;
|
||||
static KeySym keychain = -1;
|
||||
|
||||
#define hiddenWinStackMax 100
|
||||
static int hiddenWinStackTop = -1;
|
||||
static Client *hiddenWinStack[hiddenWinStackMax];
|
||||
|
||||
/* scratchpad */
|
||||
#define SCRATCHPAD_MASK (1u << sizeof tags / sizeof * tags)
|
||||
static Client * scratchpad_last_showed = NULL;
|
||||
|
@ -1747,10 +1739,19 @@ expose(XEvent *e)
|
|||
void
|
||||
focus(Client *c)
|
||||
{
|
||||
if (!c || !ISVISIBLE(c) || HIDDEN(c))
|
||||
for (c = selmon->stack; c && (!ISVISIBLE(c) || HIDDEN(c)); c = c->snext);
|
||||
if (selmon->sel && selmon->sel != c)
|
||||
if (!c || !ISVISIBLE(c))
|
||||
for (c = selmon->stack; c && (!ISVISIBLE(c) || HIDDEN(c)); c = c->snext);
|
||||
if (selmon->sel && selmon->sel != c) {
|
||||
unfocus(selmon->sel, 0);
|
||||
|
||||
if (selmon->hidsel) {
|
||||
hidewin(selmon->sel);
|
||||
if (c)
|
||||
arrange(c->mon);
|
||||
selmon->hidsel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (c) {
|
||||
if (c->mon != selmon)
|
||||
selmon = c->mon;
|
||||
|
@ -1772,31 +1773,6 @@ focus(Client *c)
|
|||
drawbars();
|
||||
}
|
||||
|
||||
void
|
||||
hide(Client *c) {
|
||||
if (!c || HIDDEN(c))
|
||||
return;
|
||||
|
||||
Window w = c->win;
|
||||
static XWindowAttributes ra, ca;
|
||||
|
||||
// more or less taken directly from blackbox's hide() function
|
||||
XGrabServer(dpy);
|
||||
XGetWindowAttributes(dpy, root, &ra);
|
||||
XGetWindowAttributes(dpy, w, &ca);
|
||||
// prevent UnmapNotify events
|
||||
XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
|
||||
XSelectInput(dpy, w, ca.your_event_mask & ~StructureNotifyMask);
|
||||
XUnmapWindow(dpy, w);
|
||||
setclientstate(c, IconicState);
|
||||
XSelectInput(dpy, root, ra.your_event_mask);
|
||||
XSelectInput(dpy, w, ca.your_event_mask);
|
||||
XUngrabServer(dpy);
|
||||
|
||||
focus(c->snext);
|
||||
arrange(c->mon);
|
||||
}
|
||||
|
||||
/* there are some broken focus acquiring clients needing extra handling */
|
||||
void
|
||||
focusin(XEvent *e)
|
||||
|
@ -1834,7 +1810,6 @@ focusstackhid(const Arg *arg)
|
|||
focusstack(arg->i, 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
focusstack(int inc, int hid)
|
||||
{
|
||||
|
@ -1879,6 +1854,7 @@ focusstack(int inc, int hid)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
Atom
|
||||
getatomprop(Client *c, Atom prop)
|
||||
{
|
||||
|
@ -2067,6 +2043,36 @@ grabkeys(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
hide(const Arg *arg)
|
||||
{
|
||||
hidewin(selmon->sel);
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
hidewin(Client *c) {
|
||||
if (!c || HIDDEN(c))
|
||||
return;
|
||||
|
||||
Window w = c->win;
|
||||
static XWindowAttributes ra, ca;
|
||||
|
||||
// more or less taken directly from blackbox's hide() function
|
||||
XGrabServer(dpy);
|
||||
XGetWindowAttributes(dpy, root, &ra);
|
||||
XGetWindowAttributes(dpy, w, &ca);
|
||||
// prevent UnmapNotify events
|
||||
XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
|
||||
XSelectInput(dpy, w, ca.your_event_mask & ~StructureNotifyMask);
|
||||
XUnmapWindow(dpy, w);
|
||||
setclientstate(c, IconicState);
|
||||
XSelectInput(dpy, root, ra.your_event_mask);
|
||||
XSelectInput(dpy, w, ca.your_event_mask);
|
||||
XUngrabServer(dpy);
|
||||
}
|
||||
|
||||
void
|
||||
incnmaster(const Arg *arg)
|
||||
{
|
||||
|
@ -2205,6 +2211,66 @@ getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc)
|
|||
*nc = n; // number of clients
|
||||
}
|
||||
|
||||
void
|
||||
show(const Arg *arg)
|
||||
{
|
||||
if (selmon->hidsel)
|
||||
selmon->hidsel = 0;
|
||||
showwin(selmon->sel);
|
||||
}
|
||||
|
||||
void
|
||||
showwin(Client *c)
|
||||
{
|
||||
if (!c || !HIDDEN(c))
|
||||
return;
|
||||
|
||||
XMapWindow(dpy, c->win);
|
||||
setclientstate(c, NormalState);
|
||||
arrange(c->mon);
|
||||
}
|
||||
|
||||
void
|
||||
showhide(Client *c)
|
||||
{
|
||||
if (!c)
|
||||
return;
|
||||
if (ISVISIBLE(c)) {
|
||||
/* show clients top down */
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
if (c->needresize) {
|
||||
c->needresize = 0;
|
||||
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
|
||||
} else {
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
}
|
||||
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
|
||||
resize(c, c->x, c->y, c->w, c->h, 0);
|
||||
showhide(c->snext);
|
||||
} else {
|
||||
/* hide clients bottom up */
|
||||
showhide(c->snext);
|
||||
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
togglewin(const Arg *arg)
|
||||
{
|
||||
Client *c = (Client*)arg->v;
|
||||
|
||||
if (c == selmon->sel) {
|
||||
hidewin(c);
|
||||
focus(NULL);
|
||||
arrange(c->mon);
|
||||
} else {
|
||||
if (HIDDEN(c))
|
||||
showwin(c);
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
togglegaps(const Arg *arg)
|
||||
{
|
||||
|
@ -2457,7 +2523,7 @@ manage(Window w, XWindowAttributes *wa)
|
|||
XChangeProperty(dpy, root, netatom[NetClientListStacking], XA_WINDOW, 32, PropModePrepend,
|
||||
(unsigned char *) &(c->win), 1);
|
||||
XMoveResizeWindow(dpy, c->win, c->x + 2 * tw, c->y, c->w, c->h); /* some windows require this */
|
||||
setclientstate(c, NormalState);
|
||||
//setclientstate(c, NormalState);
|
||||
if (!HIDDEN(c))
|
||||
setclientstate(c, NormalState);
|
||||
if (c->mon == selmon)
|
||||
|
@ -3178,13 +3244,15 @@ quit(const Arg *arg)
|
|||
Monitor *m;
|
||||
Client *c;
|
||||
|
||||
for (m = mons; m; m = m->next) {
|
||||
if (m) {
|
||||
for (c = m->stack; c; c = c->next)
|
||||
if (c && HIDDEN(c)) show(c);
|
||||
}
|
||||
// fix: reloading dwm keeps all the hidden clients hidden
|
||||
for (m = mons; m; m = m->next) {
|
||||
if (m) {
|
||||
for (c = m->stack; c; c = c->next)
|
||||
if (c && HIDDEN(c)) showwin(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(arg->i) restart = 1;
|
||||
running = 0;
|
||||
|
||||
|
@ -3794,66 +3862,6 @@ seturgent(Client *c, int urg)
|
|||
XFree(wmh);
|
||||
}
|
||||
|
||||
void
|
||||
show(Client *c)
|
||||
{
|
||||
if (!c || !HIDDEN(c))
|
||||
return;
|
||||
|
||||
XMapWindow(dpy, c->win);
|
||||
setclientstate(c, NormalState);
|
||||
arrange(c->mon);
|
||||
}
|
||||
|
||||
void
|
||||
showwin(Client *c)
|
||||
{
|
||||
if (!c || !HIDDEN(c))
|
||||
return;
|
||||
|
||||
XMapWindow(dpy, c->win);
|
||||
setclientstate(c, NormalState);
|
||||
arrange(c->mon);
|
||||
}
|
||||
|
||||
void
|
||||
showhide(Client *c)
|
||||
{
|
||||
if (!c)
|
||||
return;
|
||||
if (ISVISIBLE(c)) {
|
||||
/* show clients top down */
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
if (c->needresize) {
|
||||
c->needresize = 0;
|
||||
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
|
||||
} else {
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
}
|
||||
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
|
||||
resize(c, c->x, c->y, c->w, c->h, 0);
|
||||
showhide(c->snext);
|
||||
} else {
|
||||
/* hide clients bottom up */
|
||||
showhide(c->snext);
|
||||
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
togglewin(const Arg *arg)
|
||||
{
|
||||
Client *c = (Client*)arg->v;
|
||||
if (c == selmon->sel)
|
||||
hide(c);
|
||||
else {
|
||||
if (HIDDEN(c))
|
||||
show(c);
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
showtagpreview(unsigned int i)
|
||||
{
|
||||
|
@ -4159,122 +4167,6 @@ togglefloating(const Arg *arg)
|
|||
arrange(selmon);
|
||||
}
|
||||
|
||||
void hidewin(const Arg *arg) {
|
||||
if (!selmon->sel)
|
||||
return;
|
||||
Client *c = (Client *)selmon->sel;
|
||||
hide(c);
|
||||
hiddenWinStack[++hiddenWinStackTop] = c;
|
||||
}
|
||||
|
||||
void restorewin(const Arg *arg) {
|
||||
int i = hiddenWinStackTop;
|
||||
while (i > -1) {
|
||||
if (HIDDEN(hiddenWinStack[i]) &&
|
||||
hiddenWinStack[i]->tags == selmon->tagset[selmon->seltags]) {
|
||||
show(hiddenWinStack[i]);
|
||||
focus(hiddenWinStack[i]);
|
||||
restack(selmon);
|
||||
for (int j = i; j < hiddenWinStackTop; ++j) {
|
||||
hiddenWinStack[j] = hiddenWinStack[j + 1];
|
||||
}
|
||||
--hiddenWinStackTop;
|
||||
return;
|
||||
}
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
void hideotherwins(const Arg *arg) {
|
||||
Client *c = NULL, *i;
|
||||
if (!selmon->sel)
|
||||
return;
|
||||
c = (Client *)selmon->sel;
|
||||
for (i = selmon->clients; i; i = i->next) {
|
||||
if (i != c && ISVISIBLE(i)) {
|
||||
hide(i);
|
||||
hiddenWinStack[++hiddenWinStackTop] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void restoreotherwins(const Arg *arg) {
|
||||
int i;
|
||||
for (i = 0; i <= hiddenWinStackTop; ++i) {
|
||||
if (HIDDEN(hiddenWinStack[i]) &&
|
||||
hiddenWinStack[i]->tags == selmon->tagset[selmon->seltags]) {
|
||||
show(hiddenWinStack[i]);
|
||||
restack(selmon);
|
||||
memcpy(hiddenWinStack + i, hiddenWinStack + i + 1,
|
||||
(hiddenWinStackTop - i) * sizeof(Client *));
|
||||
--hiddenWinStackTop;
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
int issinglewin(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
int cot = 0;
|
||||
int tag = selmon->tagset[selmon->seltags];
|
||||
for (c = selmon->clients; c; c = c->next) {
|
||||
if (ISVISIBLE(c) && !HIDDEN(c) && c->tags == tag) {
|
||||
cot++;
|
||||
}
|
||||
if (cot > 1) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
void focuswin(const Arg *arg) {
|
||||
Client *c = NULL, *i;
|
||||
int j;
|
||||
|
||||
if (arg->i > 0) {
|
||||
for (c = selmon->sel->next;
|
||||
c && !(c->tags == selmon->tagset[selmon->seltags]); c = c->next)
|
||||
;
|
||||
if (!c)
|
||||
for (c = selmon->clients;
|
||||
c && !(c->tags == selmon->tagset[selmon->seltags]);
|
||||
c = c->next)
|
||||
;
|
||||
} else {
|
||||
for (i = selmon->clients; i != selmon->sel; i = i->next)
|
||||
if (i->tags == selmon->tagset[selmon->seltags])
|
||||
c = i;
|
||||
if (!c)
|
||||
for (; i; i = i->next)
|
||||
if (i->tags == selmon->tagset[selmon->seltags])
|
||||
c = i;
|
||||
}
|
||||
|
||||
i = selmon->sel;
|
||||
|
||||
if (c && c != i) {
|
||||
hide(i);
|
||||
for (j = 0; j <= hiddenWinStackTop; ++j) {
|
||||
if (HIDDEN(hiddenWinStack[j]) &&
|
||||
hiddenWinStack[j]->tags == selmon->tagset[selmon->seltags] &&
|
||||
hiddenWinStack[j] == c) {
|
||||
show(c);
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
memcpy(hiddenWinStack + j, hiddenWinStack + j + 1,
|
||||
(hiddenWinStackTop - j) * sizeof(Client *));
|
||||
hiddenWinStack[hiddenWinStackTop] = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void
|
||||
togglesticky(const Arg *arg)
|
||||
{
|
||||
|
@ -4301,23 +4193,6 @@ freeicon(Client *c)
|
|||
updatecurrentdesktop();
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
togglewin(const Arg *arg)
|
||||
{
|
||||
Client *c = (Client*)arg->v;
|
||||
if (c == selmon->sel)
|
||||
hide(c);
|
||||
else {
|
||||
if (HIDDEN(c))
|
||||
show(c);
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void
|
||||
unfocus(Client *c, int setfocus)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue