Merge pull request #8 from nagbalae/development

Fullscreen
This commit is contained in:
Bazsi 2020-06-17 19:33:52 +02:00 committed by GitHub
commit 9d269887a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 2 deletions

View File

@ -49,12 +49,16 @@ static const Rule rules[] = {
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */ static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
#include "fibonacci.c"
static const Layout layouts[] = { static const Layout layouts[] = {
/* symbol arrange function */ /* symbol arrange function */
{ "[]=", tile }, /* first entry is default */ { "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */ { "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle }, { "[M]", monocle },
{ "[@]", spiral },
{ "[\\]", dwindle },
{ NULL, NULL },
}; };
/* key definitions */ /* key definitions */
@ -96,7 +100,12 @@ static Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_z, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_z, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_u, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_u, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_i, setlayout, {.v = &layouts[3]} },
{ MODKEY|ShiftMask, XK_i, setlayout, {.v = &layouts[4]} },
{ MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } },
{ MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } },
{ MODKEY, XK_s, togglesticky, {0} }, { MODKEY, XK_s, togglesticky, {0} },
{ MODKEY, XK_f, fullscreen, {0} },
{ MODKEY, XK_m, spawn, SHCMD("$TERM -e ncmpcpp")}, { MODKEY, XK_m, spawn, SHCMD("$TERM -e ncmpcpp")},
{ MODKEY|ShiftMask, XK_m, spawn, SHCMD("$TERM -e pulsemixer")}, { MODKEY|ShiftMask, XK_m, spawn, SHCMD("$TERM -e pulsemixer")},
{ MODKEY, XK_space, setlayout, {0} }, { MODKEY, XK_space, setlayout, {0} },

32
dwm.c
View File

@ -184,6 +184,7 @@ static void configure(Client *c);
static void configurenotify(XEvent *e); static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e); static void configurerequest(XEvent *e);
static Monitor *createmon(void); static Monitor *createmon(void);
static void cyclelayout(const Arg *arg);
static void destroynotify(XEvent *e); static void destroynotify(XEvent *e);
static void detach(Client *c); static void detach(Client *c);
static void detachstack(Client *c); static void detachstack(Client *c);
@ -230,6 +231,7 @@ 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 fullscreen(const Arg *arg);
static void setgaps(int oh, int ov, int ih, int iv); static void setgaps(int oh, int ov, int ih, int iv);
static void incrgaps(const Arg *arg); static void incrgaps(const Arg *arg);
static void incrigaps(const Arg *arg); static void incrigaps(const Arg *arg);
@ -762,6 +764,23 @@ createmon(void)
return m; return m;
} }
void
cyclelayout(const Arg *arg) {
Layout *l;
for(l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++);
if(arg->i > 0) {
if(l->symbol && (l + 1)->symbol)
setlayout(&((Arg) { .v = (l + 1) }));
else
setlayout(&((Arg) { .v = layouts }));
} else {
if(l != layouts && (l - 1)->symbol)
setlayout(&((Arg) { .v = (l - 1) }));
else
setlayout(&((Arg) { .v = &layouts[LENGTH(layouts) - 2] }));
}
}
void void
destroynotify(XEvent *e) destroynotify(XEvent *e)
{ {
@ -1710,6 +1729,19 @@ setfullscreen(Client *c, int fullscreen)
arrange(c->mon); arrange(c->mon);
} }
} }
Layout *last_layout;
void
fullscreen(const Arg *arg)
{
if (selmon->showbar) {
for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
setlayout(&((Arg) { .v = &layouts[2] }));
} else {
setlayout(&((Arg) { .v = last_layout }));
}
togglebar(arg);
}
void void
setgaps(int oh, int ov, int ih, int iv) setgaps(int oh, int ov, int ih, int iv)
{ {