Toggle fullscreen. Fixed gaps due to resizehints enabled

This commit is contained in:
j4nk 2023-04-09 14:46:41 -04:00
parent 7c451d3c75
commit 45dddfa436
3 changed files with 27 additions and 17 deletions

View File

@ -2,7 +2,7 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const unsigned int snap = 0; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
//static const char *fonts[] = { "monospace:size=10" };
@ -39,16 +39,16 @@ static const Rule rules[] = {
};
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
{ "[T]", tile }, /* first entry is default */
{ "[O]", NULL }, /* no layout function means floating behavior */
{ "[F]", monocle },
};
/* key definitions */
@ -89,7 +89,7 @@ static Key keys[] = {
// win+shift+b sets floating on selected program
{ MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[1]} },
// win+f sets monocle (fullscreen) on selected program
{ MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_f, togglefullscreen, {0} },
{ MODKEY, XK_p, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
@ -123,4 +123,3 @@ static const Button buttons[] = {
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};

View File

@ -2,7 +2,7 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const unsigned int snap = 0; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
//static const char *fonts[] = { "monospace:size=10" };
@ -39,16 +39,16 @@ static const Rule rules[] = {
};
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
{ "[T]", tile }, /* first entry is default */
{ "[O]", NULL }, /* no layout function means floating behavior */
{ "[F]", monocle },
};
/* key definitions */
@ -89,7 +89,7 @@ static Key keys[] = {
// win+shift+b sets floating on selected program
{ MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[1]} },
// win+f sets monocle (fullscreen) on selected program
{ MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_f, togglefullscreen, {0} },
{ MODKEY, XK_p, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
@ -123,4 +123,3 @@ static const Button buttons[] = {
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};

View File

@ -212,6 +212,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus);
@ -712,7 +713,7 @@ drawbar(Monitor *m)
/* draw status first so it can be overdrawn by tags later */
//if (m == selmon || 1) { /* status is only drawn on selected monitor */
if (m->num == 1) {
if (m->num == 0) {
drw_setscheme(drw, scheme[SchemeNorm]);
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
@ -1720,6 +1721,17 @@ togglefloating(const Arg *arg)
arrange(selmon);
}
void
togglefullscreen(const Arg *arg)
{
if (&layouts[0] == selmon->lt[selmon->sellt]) {
setlayout(&((Arg) { .v = &layouts[2]}));
}
else if (&layouts[2] == selmon->lt[selmon->sellt]) {
setlayout(&((Arg) { .v = &layouts[0]}));
}
}
void
toggletag(const Arg *arg)
{