Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New feature: fullscreen mode #20

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rwmpelstilzchen
Copy link

Hi,

First of all, I want to thank you for monsterwm. I've been using it for some days now, and it's my favourite window manager so far (after years of using Ion, StumpWM and other tiling window managers) ☺

There's a feature I like which is on StumpWM but isn't on monsterwm: the ability to move to a fullscreen mode and return from it to the previous state with a single key binding. You can mimic this by using the monocle layout and then returning to the layout you used before, but this is not as easy as hitting M-f and then M-f again when you're done (and there's the issue of manually turning the bar off and on).
I use this feature a lot: when I need to do something in a window that requires the whole screen, I just pop in fullscreen mode, do whatever I need to, and than returning to the usual tiling layout.
This is very convenient IMHO, and I'd like to see this feature incorporated into the main branch of monsterwm, or at least given as a patch/branch on your repo.

This is my implementation of it, with some additional editing of the documentation.

Have a wonderful day,
Júda

@c00kiemon5ter
Copy link
Owner

Hi, I will be busy tomorrow but I will review this as soon as I can :)
Thanks!

@rwmpelstilzchen
Copy link
Author

Thanks :-)

@rwmpelstilzchen
Copy link
Author

I've been using a modified version for some days now and it works smoothly; I haven't noticed any bugs.

@c00kiemon5ter
Copy link
Owner

hey, so I was looking into that and here's some thoughts.

If this is going to be used only for a sort time then you can get away
with storing state in each desktop and do something like this:

diff --git a/config.def.h b/config.def.h
index 4b2175d..3e75812 100644
--- a/config.def.h
+++ b/config.def.h
@@ -56,6 +56,7 @@ static const char *menucmd[] = { "dmenu_run", NULL };
  */
 static Key keys[] = {
     /* modifier          key            function           argument */
+    {  MOD1,             XK_m,          togglemax,         {NULL}},
     {  MOD1,             XK_b,          togglepanel,       {NULL}},
     {  MOD1,             XK_BackSpace,  focusurgent,       {NULL}},
     {  MOD1|SHIFT,       XK_c,          killclient,        {NULL}},
diff --git a/monsterwm.c b/monsterwm.c
index 8d0b9d9..5be15c3 100644
--- a/monsterwm.c
+++ b/monsterwm.c
@@ -83,6 +83,7 @@ static void client_to_desktop(const Arg *arg);
 static void focusurgent();
 static void killclient();
 static void last_desktop();
+static void togglemax();
 static void move_down();
 static void move_up();
 static void moveresize(const Arg *arg);
@@ -778,6 +779,14 @@ void mousemotion(const Arg *arg) {
     XUngrabPointer(dis, CurrentTime);
 }

+void togglemax(void) {
+    static int pmode = DEFAULT_MODE, psbar = SHOW_PANEL;
+    Desktop *d = &desktops[currdeskidx];
+    if (d->mode == MONOCLE && !d->sbar) { d->mode = pmode; d->sbar = psbar; }
+    else { pmode = d->mode; psbar = d->sbar; d->mode = MONOCLE; d->sbar = False; }
+    tile(d); focus(d->curr, d);
+}
+
 /**
  * monocle aka max aka fullscreen mode/layout
  * each window should cover all the available screen space

The only drawback is that you can't use that in two desktops at the same time - that's why I said for a short time above. If you use it in another desktop then the layouts of the two desktops will be mixed (ie one of the desktops will "lose" its previous layout).

If that is not good and we're going to be storing state in each desktop we might as well make this a new layout (which will actually wrap MONOCLE) and then provide a generic toggle-layout function (which can probably accept the layout to change to as an argument provided in config.h).
Such a layout could probably do more like keep the current window on top of even the floating windows etc


oh, btw thanks for fixing the typos and the documentation :)

@Cloudef
Copy link

Cloudef commented Apr 15, 2014

Is there any reason you aren't just using the NET_WM hint for fullscreen and toggle that?
ex. http://github.com/Cloudef/monsterwm/blob/personal/monsterwm.c#L1474-1480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants