sowm

An itsy bitsy floating window manager (220~ sloc!).
git clone git://mfeller.io/sowm.git
Log | Files | Refs | README | LICENSE

commit 9cf2ce8736f4e0f3c6ea3339c72ca2f63a418471
parent 277bd8d2decb215f00b6cbf2e6e5aa12fa765198
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Fri, 11 Oct 2019 20:22:10 +0300

catwm: fs toggle

Diffstat:
Mcatwm.c | 25++++++++++++++++++++++++-
Mconfig.h | 1+
2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/catwm.c b/catwm.c @@ -37,8 +37,9 @@ typedef struct client client; struct client{ client *next; client *prev; - Window win; + + int f, x, y, w, h; }; typedef struct desktop desktop; @@ -52,6 +53,7 @@ static void add_window(Window w); static void buttonpress(XEvent *e); static void buttonrelease(XEvent *e); static void center_window(); +static void fullscreen_toggle(); static void change_desktop(const Arg arg); static void client_to_desktop(const Arg arg); static void configurerequest(XEvent *e); @@ -150,6 +152,27 @@ void center_window() { XMoveWindow(dis, current->win, x, y); } +void fullscreen_toggle() { + if (current->f != 1) { + XGetWindowAttributes(dis, current->win, &attr); + + current->f = 1; + current->x = attr.x; + current->y = attr.y; + current->w = attr.width; + current->h = attr.height; + + XMoveResizeWindow(dis, current->win, 0, 0, sw, sh); + } + + else { + current->f = 0; + + XMoveResizeWindow(dis, current->win, current->x, current->y, \ + current->w, current->h); + } +} + void client_to_desktop(const Arg arg) { client *tmp = current; int tmp2 = curr_desk; diff --git a/config.h b/config.h @@ -34,6 +34,7 @@ static struct key keys[] = { // MOD KEY FUNCTION ARGS { MOD, XK_q, kill_client, {NULL}}, { MOD, XK_c, center_window, {NULL}}, + { MOD, XK_f, fullscreen_toggle, {NULL}}, { Mod1Mask, XK_Tab, next_win, {NULL}}, { 0, XF86XK_AudioLowerVolume, spawn, {.com = voldown}}, { 0, XF86XK_AudioRaiseVolume, spawn, {.com = volup}},