deal with window click to show/hide support
This commit is contained in:
parent
d49e4dab44
commit
e324a890d5
|
@ -234,6 +234,7 @@ These binds can be activated using your mouse
|
|||
- Layout indicator (Right click) - Switch to the previous layout
|
||||
- Layout indicator (Middle click) - Open a dmenu list of all layouts (requires speedwm-extras)
|
||||
- Layout indicator (Scrolling up/down) - Switch to the next/previous layout
|
||||
- Window title (Left click) - Show/hide the window
|
||||
- Window title (Right click) - Open speedwm-utils (requires speedwm-extras)
|
||||
- Focused window (Super+Alt+Left click) - Move the focused window around
|
||||
- Focused window (Super+Alt+Middle click) - Make the focused window floating
|
||||
|
|
11
bar/title.c
11
bar/title.c
|
@ -37,15 +37,18 @@ draw_title(Bar *bar, BarDrawArg *a)
|
|||
if (!ISVISIBLE(c))
|
||||
continue;
|
||||
|
||||
if (bar->mon->sel == c && colorselectedtitle)
|
||||
if (bar->mon->sel == c)
|
||||
scm = SchemeTitleSel;
|
||||
else if (!colorselectedtitle)
|
||||
scm = SchemeTitleNorm;
|
||||
else if (HIDDEN(c) && !selmon->hideunselectedtitle)
|
||||
else if (HIDDEN(c))
|
||||
scm = SchemeTitleHidden;
|
||||
else
|
||||
scm = SchemeTitleNorm;
|
||||
|
||||
if (!colorselectedtitle && !HIDDEN(c))
|
||||
scm = SchemeTitleNorm;
|
||||
else if (!colorselectedtitle && HIDDEN(c))
|
||||
scm = SchemeTitleHidden;
|
||||
|
||||
/* hide unselected title */
|
||||
if (bar->mon->sel != c && selmon->hideunselectedtitle) {
|
||||
continue;
|
||||
|
|
|
@ -183,6 +183,7 @@ These binds can be activated using your mouse
|
|||
- Layout indicator (Right click) - Switch to the previous layout
|
||||
- Layout indicator (Middle click) - Open a dmenu list of all layouts (requires speedwm-extras)
|
||||
- Layout indicator (Scrolling up/down) - Switch to the next/previous layout
|
||||
- Window title (Left click) - Show/hide the window
|
||||
- Window title (Right click) - Open speedwm-utils (requires speedwm-extras)
|
||||
- Focused window (Super+Alt+Left click) - Move the focused window around
|
||||
- Focused window (Super+Alt+Middle click) - Make the focused window floating
|
||||
|
|
1
mouse.h
1
mouse.h
|
@ -37,6 +37,7 @@ static const Button buttons[] = {
|
|||
{ clickstatusbar, 0, Button2, spawn, {.v = clickstatus } },
|
||||
{ clickstatusbar, 0, Button3, spawn, {.v = clickstatus } },
|
||||
{ clicktitle, 0, Button3, spawn, cmd( "speedwm-utils" ) },
|
||||
{ clicktitle, 0, Button1, togglewin, {0} },
|
||||
{ clickroot, 0, Button3, spawn, cmd( "j4-dmenu-desktop --term=st --dmenu='dmenu -l 20 -p Open:'" ) },
|
||||
{ clicktags, 0, Button1, view, {0} },
|
||||
{ clicktags, 0, Button4, viewtoleft, {0} },
|
||||
|
|
|
@ -471,6 +471,8 @@ Layout indicator (Middle click) - Open a dmenu list of all layouts
|
|||
Layout indicator (Scrolling up/down) - Switch to the next/previous
|
||||
layout
|
||||
.IP \[bu] 2
|
||||
Window title (Left click) - Show/hide the window
|
||||
.IP \[bu] 2
|
||||
Window title (Right click) - Open speedwm-utils (requires
|
||||
speedwm-extras)
|
||||
.IP \[bu] 2
|
||||
|
|
28
speedwm.c
28
speedwm.c
|
@ -533,6 +533,7 @@ static int sendevent(Client *c, Atom proto);
|
|||
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||
static void grabbuttons(Client *c, int focused);
|
||||
static void hide(const Arg *arg);
|
||||
static void togglewin(const Arg *arg);
|
||||
static void hidewin(Client *c);
|
||||
static void incmastercount(const Arg *arg);
|
||||
#if USEIPC
|
||||
|
@ -1426,7 +1427,7 @@ buttonpress(XEvent *e)
|
|||
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 == clicktags && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
|
||||
buttons[i].func((click == clicktags || click == clicktitle) && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6689,5 +6690,30 @@ centerwindow(const Arg *arg)
|
|||
resizeclient(selmon->sel, (selmon->mw - selmon->mw * 0.5) / 2, (selmon->mh - selmon->mh * 0.5) / 2, selmon->mw * 0.5, selmon->mh * 0.5);
|
||||
}
|
||||
|
||||
void
|
||||
togglewin(const Arg *arg)
|
||||
{
|
||||
Client *c = (Client*)arg->v;
|
||||
if (!c)
|
||||
c = selmon->sel;
|
||||
if (!c)
|
||||
return;
|
||||
|
||||
/* because it's useless with only one window */
|
||||
if (selmon->hideunselectedtitle) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (HIDDEN(c)) {
|
||||
showwin(c);
|
||||
} else {
|
||||
hidewin(c);
|
||||
}
|
||||
|
||||
restack(c->mon);
|
||||
focus(c);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
/* Layout code */
|
||||
#include "layouts.c" /* Enable patched layouts */
|
||||
|
|
Loading…
Reference in a new issue