Hi, thanks for the nice window manager - I came from ion, used wmii for
a long time and was attracted by the speed and master-window-idea of
dwm.

I only miss a comfortable way to deal with floating windows.
- moving and resizing with keyboard shortcuts
- (un)hide selected/all floating windows
- and an intelligent placement of new windows

I wrote a small patch for moving and resizing. - It misuses arg->i
heavily :/

Bye.

Jan Christoph

PS: I added the following to my config.h
PPS: I use Mod4 as MODKEY
        { MODKEY|Mod1Mask,              XK_h,   moveresize,             { .i = 
5 | MOVEX | NEGATIVE } }, \
        { MODKEY|Mod1Mask,              XK_l,   moveresize,             { .i = 
5 | MOVEX } }, \
        { MODKEY|Mod1Mask,              XK_j,   moveresize,             { .i = 
5 | MOVEY } }, \
        { MODKEY|Mod1Mask,              XK_k,   moveresize,             { .i = 
5 | MOVEY | NEGATIVE } }, \
        { MODKEY,               XK_h,   moveresize,             { .i = 25 | 
MOVEX | NEGATIVE } }, \
        { MODKEY,               XK_l,   moveresize,             { .i = 25 | 
MOVEX } }, \
        { MODKEY,               XK_j,   moveresize,             { .i = 25 | 
MOVEY } }, \
        { MODKEY,               XK_k,   moveresize,             { .i = 25 | 
MOVEY | NEGATIVE } }, \
        { MODKEY|ControlMask,           XK_h,   moveresize,             { .i = 
0    | MOVEX | ABSOLUTE } }, \
        { MODKEY|ControlMask,           XK_l,   moveresize,             { .i = 
9000 | MOVEX | ABSOLUTE } }, \
        { MODKEY|ControlMask,           XK_j,   moveresize,             { .i = 
9000 | MOVEY | ABSOLUTE } }, \
        { MODKEY|ControlMask,           XK_k,   moveresize,             { .i = 
15   | MOVEY | ABSOLUTE } }, \
        { MODKEY|ShiftMask,             XK_h,   moveresize,             { .i = 
25 | RESIZEX | NEGATIVE } }, \
        { MODKEY|ShiftMask,             XK_l,   moveresize,             { .i = 
25 | RESIZEX } }, \
        { MODKEY|ShiftMask,             XK_j,   moveresize,             { .i = 
25 | RESIZEY } }, \
        { MODKEY|ShiftMask,             XK_k,   moveresize,             { .i = 
25 | RESIZEY | NEGATIVE } }, \
        { MODKEY|Mod1Mask|ShiftMask,            XK_h,   moveresize,             
{ .i = 5 | RESIZEX | NEGATIVE } }, \
        { MODKEY|Mod1Mask|ShiftMask,            XK_l,   moveresize,             
{ .i = 5 | RESIZEX } }, \
        { MODKEY|Mod1Mask|ShiftMask,            XK_j,   moveresize,             
{ .i = 5 | RESIZEY } }, \
        { MODKEY|Mod1Mask|ShiftMask,            XK_k,   moveresize,             
{ .i = 5 | RESIZEY | NEGATIVE } }, \
-- 
For everything there is a season, and a time for every purpose under
heaven. Ecclesiastes 3,1
diff -r 7c5d5b1e49c9 dwm.h
--- a/dwm.h	Thu Feb 08 14:09:52 2007 +0100
+++ b/dwm.h	Fri Feb 09 22:56:57 2007 +0100
@@ -36,6 +36,13 @@
 
 /* mask shorthands, used in event.c and client.c */
 #define BUTTONMASK		(ButtonPressMask | ButtonReleaseMask)
+
+#define MOVEX		1<<30
+#define MOVEY		1<<29
+#define RESIZEX		1<<28
+#define RESIZEY		1<<27
+#define ABSOLUTE	1<<26
+#define NEGATIVE	1<<25
 
 enum { NetSupported, NetWMName, NetLast };		/* EWMH atoms */
 enum { WMProtocols, WMDelete, WMState, WMLast };	/* default atoms */
@@ -153,3 +160,4 @@ extern void toggleview(Arg *arg);		/* to
 extern void toggleview(Arg *arg);		/* toggles the tag with arg's index (in)visible */
 extern void view(Arg *arg);			/* views the tag with arg's index */
 extern void zoom(Arg *arg);			/* zooms the focused client to master area, arg is ignored */
+extern void moveresize(Arg *arg);		/* resizes or moves selected window */
diff -r 7c5d5b1e49c9 view.c
--- a/view.c	Thu Feb 08 14:09:52 2007 +0100
+++ b/view.c	Fri Feb 09 23:03:45 2007 +0100
@@ -269,3 +269,65 @@ zoom(Arg *arg) {
 	focus(c);
 	arrange();
 }
+
+/* 
+ * arg i = int
+ * 2^30 = x
+ * 2^29 = y
+ * 2^28 = w
+ * 2^27 = h
+ * 2^26 = absolute value
+ * 2^25 = negative value
+ * 2^0-2^24 = values
+ */
+void
+moveresize(Arg *arg) {
+    int value = arg->i & (((1<<25) - 1) | 1<<31);
+    value = arg->i & NEGATIVE ? 0-value : value;
+    int i = 32;
+	if (!sel || !sel->isfloat) { return; }
+
+	if (arg->i & MOVEX)
+    {
+        if (arg->i & ABSOLUTE)
+        {
+            if ((sel->w + value) > sw)
+                value = sw - sel->w;
+            sel->x = value;
+        } else
+        {
+            sel->x += value;
+        }
+    } else if (arg->i & MOVEY)
+    {
+        if (arg->i & ABSOLUTE)
+        {
+            if ((sel->h + value) > sh)
+                value = sh - sel->h;
+            sel->y = value;
+        } else
+        {
+            sel->y += value;
+        }
+    } else if (arg->i & RESIZEX)
+    {
+        if (arg->i & ABSOLUTE)
+        {
+            sel->w = value;
+        } else
+        {
+            sel->w += value;
+        }
+    } else if (arg->i & RESIZEY)
+    {
+        if (arg->i & ABSOLUTE)
+        {
+            sel->h = value;
+        } else
+        {
+            sel->h += value;
+        }
+    }
+
+    resize(sel, False);
+}

Attachment: pgpjNqWmMD6UD.pgp
Description: PGP signature

Reply via email to