]> git.mdlowis.com Git - proto/anvil.git/commitdiff
added shortcut to toggle between floating and tiled
authorMichael D. Lowis <mike@mdlowis.com>
Sun, 5 Apr 2020 02:00:20 +0000 (22:00 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Sun, 5 Apr 2020 02:00:20 +0000 (22:00 -0400)
anvil.h
build.sh
keys.c
mouse.c
tile.c

diff --git a/anvil.h b/anvil.h
index 13b9331f6543147a77af3955ecde173ae5838071..db027759791db30a98970c5da7b0c3fbe6a03efe 100644 (file)
--- a/anvil.h
+++ b/anvil.h
 #define max(a,b) (a > b ? a : b)
 
 /* TODO: warp mouse pointer to title bars on new windows */
+/* TODO: Add shortcuts to transfer windows between monitors */
+/* TODO: warp the mouse to titlebar on various locations */
+/* TODO: make sure mouse warps to the correct titlebar and floating windows don't get in the way */
+/* TODO: add floating addclient function */
 
 enum {
     M_INIT,
index ca67477580d11d8f2b7bfb4e91ded4f367b7f29a..ab48db1b7b9c9a33809ee974227201c3894a5669 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -2,7 +2,7 @@
 cc -g -Wall -Wextra -Werror -I/usr/X11R6/include -L/usr/X11R6/lib -o anvil *.c -lX11 -lXinerama -lm
 error="$?"
 ctags *
-grep -n 'TODO' *.| sed -e 's/: \+/: /' -e 's/\/\* *//g' -e 's/ *\*\/$//' -e 's/TODO: *//'
+grep -n 'TODO' *.[ch]| sed -e 's/: \+/: /' -e 's/\/\* *//g' -e 's/ *\*\/$//' -e 's/TODO: *//'
 printf "\a"
 if [ $error -ne 0 ]; then
     printf "\a"
diff --git a/keys.c b/keys.c
index 5dabd8bcbcf9f065baa23771ea9c47e2fadb902e..9cdf4da62dbaef3071c43297b002dc6dd4f1d5d2 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -50,21 +50,29 @@ static void colsplit(Arg *arg)
     mons_colsplit();
 }
 
+static void togfloat(Arg *arg)
+{
+    (void)arg;
+    Location loc;
+    if (Focused && mons_find(Focused->win, &loc))
+    {
+        mons_togglefloat(&loc);
+    }
+}
+
 static char* pickexec[]  = { "pickexec", NULL };
 static char* terminal[]  = { "xterm", NULL };
 static char* locker[]  = { "slock", NULL };
 
-/* TODO: Add shortcuts to resize columns */
-/* TODO: Add shortcuts to transfer windows between monitors */
-/* TODO: Add shortcuts to toggle between tiled and floating */
 static Key keys[] = {
-    { MODKEY|ShiftMask, XK_q,      quit,    { 0 } },
-    { MODKEY,           XK_p,      runcmd,  { .cmd = pickexec } },
-    { MODKEY|ShiftMask, XK_Return, runcmd,  { .cmd = terminal } },
-    { MODKEY|ShiftMask, XK_l,      runcmd,  { .cmd = locker   } },
-    { MODKEY|ShiftMask, XK_c,      killwin, { 0 } },
+    { MODKEY,           XK_p,      runcmd,   { .cmd = pickexec } },
     { MODKEY,           XK_minus,  coljoin,  { 0 } },
     { MODKEY,           XK_equal,  colsplit, { 0 } },
+    { MODKEY|ShiftMask, XK_q,      quit,     { 0 } },
+    { MODKEY|ShiftMask, XK_Return, runcmd,   { .cmd = terminal } },
+    { MODKEY|ShiftMask, XK_l,      runcmd,   { .cmd = locker   } },
+    { MODKEY|ShiftMask, XK_c,      killwin,  { 0 } },
+    { MODKEY|ShiftMask, XK_f,      togfloat, { 0 } },
 
     { MODKEY,   XK_1,   set_workspace,  { .i = 0 } },
     { MODKEY,   XK_2,   set_workspace,  { .i = 1 } },
diff --git a/mouse.c b/mouse.c
index 2b81e63c59d8dc170c77e0b0e90802eecdc284fe..548a77d49c84960acbf6ebc66b82b047ffcd34a9 100644 (file)
--- a/mouse.c
+++ b/mouse.c
@@ -1,8 +1,5 @@
 #include "anvil.h"
 
-/* TODO: warp the mouse to titlebar on various locations */
-/* TODO: make sure mouse warps to the correct titlebar and floating windows don't get in the way */
-
 static inline int PRESSED(int mods, int btn)
 {
     return ((mods & (1 << (btn + 7))) == (1 << (btn + 7)));
diff --git a/tile.c b/tile.c
index 43cc049649944f107a28b3434074883703019a5d..af2b20526498f267d4f9b1fee78064db99a38f06 100644 (file)
--- a/tile.c
+++ b/tile.c
@@ -1,6 +1,6 @@
 #include "anvil.h"
 
-static void coldims(Monitor* mon, Column* col, int *x, int *y, int *w, int *h)
+static void coldims(Monitor *mon, Column *col, int *x, int *y, int *w, int *h)
 {
     Column* c;
     *x = mon->x, *y = mon->y, *w = col->width-2, *h = mon->h-2;
@@ -55,7 +55,6 @@ void monocled_set(Monitor* mon, Column* col, Client* c)
 
 void stacked_add(Monitor* mon, Column* col, Client* c)
 {
-    /* TODO: add floating client add function */
     coldims(mon, col, &(c->x), &(c->y), &(c->w), &(c->h));
     if (col->clients)
     {