From 37b838f4558691e16afd3c2d940947186c8bc13c Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Fri, 26 Jan 2024 20:54:53 -0500 Subject: Implement fullscreen patch --- config.def.h | 1 + dwm.c | 14 ++++++++++++++ dwmc | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index 0329d62..f56825a 100644 --- a/config.def.h +++ b/config.def.h @@ -184,4 +184,5 @@ static Signal signals[] = { { "togglegaps", togglegaps }, { "defaultgaps", defaultgaps }, { "sigstatusbar", sigstatusbar }, + { "fullscreen", fullscreen }, }; diff --git a/dwm.c b/dwm.c index 942a33f..2d6c0b2 100644 --- a/dwm.c +++ b/dwm.c @@ -217,6 +217,7 @@ static void sendmon(Client *c, Monitor *m); static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); +static void fullscreen(const Arg *arg); static void setlayout(const Arg *arg); static void setcfact(const Arg *arg); static void setmfact(const Arg *arg); @@ -1733,6 +1734,19 @@ setfullscreen(Client *c, int fullscreen) } } +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[1] })); + } else { + setlayout(&((Arg) { .v = last_layout })); + } + togglebar(arg); +} + void setlayout(const Arg *arg) { diff --git a/dwmc b/dwmc index 5ba22cc..784892f 100755 --- a/dwmc +++ b/dwmc @@ -7,7 +7,7 @@ signal() { case $# in 1) case $1 in - setlayout | view | viewall | togglebar | togglefloating | zoom | killclient | quit | togglegaps | defaultgaps) + setlayout | view | viewall | togglebar | togglefloating | zoom | killclient | quit | togglegaps | defaultgaps | fullscreen) signal "$1" ;; *) -- cgit v1.2.3