feat: make fullscreen windows movable

(idk why they weren't)
This commit is contained in:
Arthur Khachaturov 2024-07-20 01:50:40 +03:00
parent 765fb16e7d
commit 3af76b3c34
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55
3 changed files with 23 additions and 20 deletions

View file

@ -1,4 +1,5 @@
/* appearance */
#include <X11/X.h>
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} },
};

7
dwm.c
View file

@ -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;

8
util.c
View file

@ -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);