[dwm] mouse clicks

From: pancake <pancake_AT_youterm.com>
Date: Sat, 25 Aug 2007 21:28:05 +0200

I have created a simple patch to be able to manage windows with the mouse,
it's useful for the laptop use too, because of the mouse buttons and pointer
near the keyboard, so you can manage the windows more eficiently.

I feel very confortable with it. On my laptop I can use a single click to
switch between the last two windows if I place the cursor on the menubar
and closing it with the other button.

Using my external mouse I can use the wheel to switch between clients and
zoom the one I'm interested on.

PD: The wheel support for tagging switching would be really useful too.

Here's the patch, let me know what do you think:

pancake@~/prg/dwm-4.4$ diff -u event.c.orig event.c
--- event.c.orig 2007-08-25 21:11:52.000000000 +0200
+++ event.c 2007-08-25 21:24:57.000000000 +0200
@@ -135,6 +135,15 @@
                }
                if((ev->x < x + blw) && ev->button == Button1)
                        setlayout(NULL);
+
+ if(ev->x > x + blw)
+ switch(ev->button) {
+ case Button1: zoom(NULL); break;
+ case Button2: togglefloating(NULL); break;
+ case Button3: killclient(NULL); break;
+ case Button4: focusnext(NULL); break;
+ case Button5: focusprev(NULL); break;
+ }
        }
        else if((c = getclient(ev->window))) {
                focus(c);
pancake@~/prg/dwm-4.4$

  --pancake
Received on Sat Aug 25 2007 - 21:27:38 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:51:15 UTC