fix systray toggle keybind
This commit is contained in:
parent
32cedf19d5
commit
89b757e682
|
@ -8,9 +8,12 @@ width_systray(Bar *bar, BarWidthArg *a)
|
|||
Client *i;
|
||||
if (!systray)
|
||||
return 1;
|
||||
if (!selmon->hidesystray)
|
||||
if (!selmon->hidesystray) {
|
||||
for (i = systray->icons; i; w += i->w + systrayspacing, i = i->next);
|
||||
return w ? w + lrpad - systrayspacing : 0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -19,7 +22,6 @@ draw_systray(Bar *bar, BarDrawArg *a)
|
|||
if (selmon->hidesystray) {
|
||||
if (systray)
|
||||
XMoveWindow(dpy, systray->win, -500, bar->by);
|
||||
return a->x;
|
||||
}
|
||||
|
||||
XSetWindowAttributes wa;
|
||||
|
@ -91,8 +93,9 @@ removesystrayicon(Client *i)
|
|||
{
|
||||
Client **ii;
|
||||
|
||||
if (selmon->hidesystray || !i)
|
||||
if (!i)
|
||||
return;
|
||||
|
||||
for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
|
||||
if (ii)
|
||||
*ii = i->next;
|
||||
|
@ -143,7 +146,7 @@ updatesystrayiconstate(Client *i, XPropertyEvent *ev)
|
|||
long flags;
|
||||
int code = 0;
|
||||
|
||||
if (hidesystray || !systray || !i || ev->atom != xatom[XembedInfo] ||
|
||||
if (selmon->hidesystray || !systray || !i || ev->atom != xatom[XembedInfo] ||
|
||||
!(flags = getatomprop(i, xatom[XembedInfo])))
|
||||
return;
|
||||
|
||||
|
@ -171,7 +174,7 @@ wintosystrayicon(Window w)
|
|||
if (!systray)
|
||||
return NULL;
|
||||
Client *i = NULL;
|
||||
if (hidesystray || !w)
|
||||
if (selmon->hidesystray || !w)
|
||||
return i;
|
||||
for (i = systray->icons; i && i->win != w; i = i->next);
|
||||
return i;
|
||||
|
|
|
@ -85,6 +85,11 @@ static Key keys[] = {
|
|||
{ MODIFIER1, -1, XK_Tab, switcherstart, {0} },
|
||||
#endif
|
||||
|
||||
/* Systray */
|
||||
#if USESYSTRAY
|
||||
{ MODIFIER1, -1, XK_s, togglesystray, {0} },
|
||||
#endif
|
||||
|
||||
/* Layout keybinds */
|
||||
{ MODIFIER1|CONTROL|SHIFT, -1, XK_a, cyclelayout, {.i = -1 } },
|
||||
{ MODIFIER1|CONTROL|SHIFT, -1, XK_d, cyclelayout, {.i = +1 } },
|
||||
|
|
25
speedwm.c
25
speedwm.c
|
@ -648,6 +648,9 @@ static void set_s_layout(const Arg *arg);
|
|||
/* bar items */
|
||||
static void togglebar(const Arg *arg);
|
||||
static void togglebartags(const Arg *arg);
|
||||
#if USESYSTRAY
|
||||
static void togglesystray(const Arg *arg);
|
||||
#endif
|
||||
static void togglebaremptytags(const Arg *arg);
|
||||
static void togglebartitle(const Arg *arg);
|
||||
static void togglebarlt(const Arg *arg);
|
||||
|
@ -5488,6 +5491,28 @@ togglebar(const Arg *arg)
|
|||
arrange(selmon);
|
||||
}
|
||||
|
||||
#if USESYSTRAY
|
||||
void
|
||||
togglesystray(const Arg *arg)
|
||||
{
|
||||
Bar *bar;
|
||||
Client *c;
|
||||
|
||||
selmon->hidesystray = !selmon->hidesystray;
|
||||
|
||||
/*
|
||||
if (selmon->hidesystray) {
|
||||
removesystrayicon(systray->icons);
|
||||
//XUnmapWindow(dpy, systray->win);
|
||||
//XDestroyWindow(dpy, systray->win);
|
||||
free(systray);
|
||||
}
|
||||
*/
|
||||
|
||||
updatebarpos(selmon);
|
||||
arrange(selmon);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
togglebartags(const Arg *arg)
|
||||
|
|
Loading…
Reference in a new issue