From 3af76b3c34d401f90bf85ce36974a15d6fb6b393 Mon Sep 17 00:00:00 2001 From: Arthur Khachaturov Date: Sat, 20 Jul 2024 01:50:40 +0300 Subject: [PATCH] feat: make fullscreen windows movable (idk why they weren't) --- config.h | 28 ++++++++++++++-------------- dwm.c | 7 ++++--- util.c | 8 +++++--- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/config.h b/config.h index 7552745..3d7c3e9 100644 --- a/config.h +++ b/config.h @@ -1,4 +1,5 @@ /* appearance */ +#include static const unsigned int borderpx = 2; static const unsigned int snap = 0; static const unsigned int swallowfloating = 0; @@ -147,18 +148,17 @@ static const Key keys[] = { /* button definitions */ /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static const Button buttons[] = { - /* click event mask button function argument */ - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, - { ClkClientWin, MODKEY, Button1, movemouse, {0} }, - { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, - { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, - { ClkClientWin, MODKEY|ControlMask, Button1, resizemouse, {0} }, - { ClkTagBar, 0, Button1, view, {0} }, - { ClkTagBar, 0, Button3, toggleview, {0} }, - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, -}; + /* click event mask button function argument */ + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkClientWin, MODKEY|ControlMask, Button1, resizemouse, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, ShiftMask, Button1, tagview, {0} }, + { ClkTagBar, ControlMask, Button1, tag, {0} }, + { ClkTagBar, Mod1Mask, Button1, toggletag, {0} }, + { ClkTagBar, ControlMask|ShiftMask, Button1, toggleview, {0} }, +}; diff --git a/dwm.c b/dwm.c index a882718..f8cf1a4 100644 --- a/dwm.c +++ b/dwm.c @@ -918,7 +918,6 @@ focus(Client *c) } setfocus(c); } else { - notify("SELMON STACK EMPTY"); XSetInputFocus(dpy, root, RevertToNone, CurrentTime); XDeleteProperty(dpy, root, netatom[NetActiveWindow]); } @@ -1307,8 +1306,10 @@ movemouse(const Arg *arg) if (!(c = selmon->sel)) return; - if (c->isfullscreen) /* no support moving fullscreen windows by mouse */ - return; + + if (c->isfullscreen) + setfullscreen(selmon->sel, !selmon->sel->isfullscreen); + restack(selmon); ocx = c->x; ocy = c->y; diff --git a/util.c b/util.c index 6f28e1f..51498ab 100644 --- a/util.c +++ b/util.c @@ -36,12 +36,14 @@ ecalloc(size_t nmemb, size_t size) } void -notify(const char *fmt, ...) { +notify(const char *fmt, ...) +{ va_list ap; - char cmd[1024] = "notify-send "; + char cmd[1024] = "nt() { notify-send \"$*\"; }; nt "; + int cmd_size = strlen(cmd)-1; va_start(ap, fmt); - sprintf(cmd+12, fmt, ap); + snprintf(cmd+cmd_size, 1024-cmd_size, fmt, ap); va_end(ap); system(cmd);