dwm-fullscreen-6.2.diff 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From 54719285bd1a984e2efce6e8a8eab184fec11abf Mon Sep 17 00:00:00 2001
  2. From: Sermak <sermak@jarvis.com>
  3. Date: Mon, 8 Jul 2019 01:06:44 +0200
  4. Subject: [PATCH] Simulate toggleable fullscreen mode
  5. ---
  6. config.def.h | 1 +
  7. dwm.c | 14 ++++++++++++++
  8. 2 files changed, 15 insertions(+)
  9. diff --git a/config.def.h b/config.def.h
  10. index 1c0b587..f774cc5 100644
  11. --- a/config.def.h
  12. +++ b/config.def.h
  13. @@ -76,6 +76,7 @@ static Key keys[] = {
  14. { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
  15. { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
  16. { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
  17. + { MODKEY|ShiftMask, XK_f, fullscreen, {0} },
  18. { MODKEY, XK_space, setlayout, {0} },
  19. { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
  20. { MODKEY, XK_0, view, {.ui = ~0 } },
  21. diff --git a/dwm.c b/dwm.c
  22. index 4465af1..04b1e06 100644
  23. --- a/dwm.c
  24. +++ b/dwm.c
  25. @@ -199,6 +199,7 @@ static void sendmon(Client *c, Monitor *m);
  26. static void setclientstate(Client *c, long state);
  27. static void setfocus(Client *c);
  28. static void setfullscreen(Client *c, int fullscreen);
  29. +static void fullscreen(const Arg *arg);
  30. static void setlayout(const Arg *arg);
  31. static void setmfact(const Arg *arg);
  32. static void setup(void);
  33. @@ -1497,6 +1498,19 @@ setfullscreen(Client *c, int fullscreen)
  34. }
  35. }
  36. +Layout *last_layout;
  37. +void
  38. +fullscreen(const Arg *arg)
  39. +{
  40. + if (selmon->showbar) {
  41. + for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
  42. + setlayout(&((Arg) { .v = &layouts[2] }));
  43. + } else {
  44. + setlayout(&((Arg) { .v = last_layout }));
  45. + }
  46. + togglebar(arg);
  47. +}
  48. +
  49. void
  50. setlayout(const Arg *arg)
  51. {
  52. --
  53. 2.22.0