Re: [dwm] dmenu, slock patches; slock DPMS crash

2008-04-09 Thread Anselm R. Garbe
On Tue, Apr 08, 2008 at 09:31:03PM +0200, Matthias-Christian Ott wrote:
 Maybe one could a rc script as a Plan 9 like alternative, if a lot of
 users request Plan 9 tools support.

Well, p9p is no objective anymore for the vanilla dmenu, because
dmenu_path is a sh-script anyways, so it is expected to prefer
the sh-related userland first, even if in use with wmii. Though,
I'm not totally sure if the sort -u breaks anything with wmii.
This needs to be tested first.

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] togglemax substiute in 4.9?

2008-04-09 Thread Anselm R. Garbe
On Tue, Apr 08, 2008 at 07:52:03PM +0200, Matthias-Christian Ott wrote:
 yy [EMAIL PROTECTED] wrote:
 
  Well, this is my proposal in patch form. I'm not sure about the
  convenience of setting fx and fy in tileresize, but you get the idea.
 
 I posted a similar patch on 31st March, so it is wasted effort.

Hehe, indeed your both solutions are very close.

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] togglemax substiute in 4.9?

2008-04-09 Thread yy
2008/4/9, Anselm R. Garbe [EMAIL PROTECTED]:
 On Tue, Apr 08, 2008 at 07:52:03PM +0200, Matthias-Christian Ott wrote:
  yy [EMAIL PROTECTED] wrote:
 
   Well, this is my proposal in patch form. I'm not sure about the
   convenience of setting fx and fy in tileresize, but you get the idea.
 
  I posted a similar patch on 31st March, so it is wasted effort.

 Hehe, indeed your both solutions are very close.


I'm not a fan of restoring floating geometries, that's why I didn't
look at Matthias' patch; I just wanted to show how once you implement
it, you don't need to change geometries in focus() to have the wanted
behaviour in monocle. The difference between his patch and mine is
that mine also restore geometries when coming back from monocle.
Anyway, I have already done some changes (but I have them in my
laptop, which I don't have at hand now). One is a check to not modify
geometries with the mouse while in monocle layout when lt-isfloating
is true, the other ones are some little improvements in the previous
patch (I think I even removed some loc). If you are interested I will
send them to the list this afternoon.

greets,

-- 


- yiyus || JGL .



Re: [dwm] dmenu, slock patches; slock DPMS crash

2008-04-09 Thread markus schnalke
Anselm R. Garbe [EMAIL PROTECTED] wrote:
 Though,
 I'm not totally sure if the sort -u breaks anything with wmii.
 This needs to be tested first.

What is the problem with `sort | uniq'.
Okay, it may be a bit slower, but beside that ...?

If it is more portable than `sort -u', so why don't use it?


meillo



Re: [dwm] togglemax substiute in 4.9?

2008-04-09 Thread Anselm R. Garbe
On Wed, Apr 09, 2008 at 11:40:09AM +0200, yy wrote:
 2008/4/9, Anselm R. Garbe [EMAIL PROTECTED]:
  On Tue, Apr 08, 2008 at 07:52:03PM +0200, Matthias-Christian Ott wrote:
   yy [EMAIL PROTECTED] wrote:
  
Well, this is my proposal in patch form. I'm not sure about the
convenience of setting fx and fy in tileresize, but you get the idea.
  
   I posted a similar patch on 31st March, so it is wasted effort.
 
  Hehe, indeed your both solutions are very close.
 
 
 I'm not a fan of restoring floating geometries, that's why I didn't
 look at Matthias' patch; I just wanted to show how once you implement
 it, you don't need to change geometries in focus() to have the wanted
 behaviour in monocle. The difference between his patch and mine is
 that mine also restore geometries when coming back from monocle.
 Anyway, I have already done some changes (but I have them in my
 laptop, which I don't have at hand now). One is a check to not modify
 geometries with the mouse while in monocle layout when lt-isfloating
 is true, the other ones are some little improvements in the previous
 patch (I think I even removed some loc). If you are interested I will
 send them to the list this afternoon.

Yea just send me the bundle diff to 4.9 tonight.

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] dmenu, slock patches; slock DPMS crash

2008-04-09 Thread Anselm R. Garbe
On Tue, Apr 08, 2008 at 02:37:10PM +0200, Peter Hartlich wrote:
  Also, with the new DPMS code from changeset 31, slock crashes here
  (X.org server 1.4.0.90, DPMS disabled in xorg.conf):
  
  | X Error of failed request:  BadMatch (invalid parameter attributes)
  |   Major opcode of failed request:  136 (DPMS)
  |   Minor opcode of failed request:  6 (DPMSForceLevel)
  |   Serial number of failed request:  27
  |   Current serial number in output stream:  28
  
  Right, should be fixed in hg tip now. Please confirm this due to
  a recheck.
 
 Still crashes at DPMSForceLevel. It seems that DPMSCapable returns True
 even with DPMS disabled...

Well, then I need to add an error handler.

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] togglemax substiute in 4.9?

2008-04-09 Thread Anselm R. Garbe
On Tue, Apr 08, 2008 at 07:16:03PM +0200, yy wrote:
 Well, this is my proposal in patch form. I'm not sure about the
 convenience of setting fx and fy in tileresize, but you get the idea.

I think about your solution.

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] dmenu, slock patches; slock DPMS crash

2008-04-09 Thread Anselm R. Garbe
On Wed, Apr 09, 2008 at 11:49:33AM +0200, markus schnalke wrote:
 Anselm R. Garbe [EMAIL PROTECTED] wrote:
  Though,
  I'm not totally sure if the sort -u breaks anything with wmii.
  This needs to be tested first.
 
 What is the problem with `sort | uniq'.
 Okay, it may be a bit slower, but beside that ...?

There is no problem apart this. So if sort -u works with wmii as
well, I see no reason to use | uniq.

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



[dwm] Preventing xterm from closing by killclient()

2008-04-09 Thread Martin Sander
Hey.
In the last time I repeatedly closed xterm windows on accident by my
killclient binding (MODKEY|ShiftMask, XK_c) because I did not see that
the xterm had focus and not that stupid other client that does not
provide a convenient keyboard shortcut of its own to close.

I always close xterms with Ctrl-D when I want them to close, so I am
looking for a way to prevent xterm from closing with killclient().

I have already looked for a solution in xterm, but there seems to be
none.  IceWM provides a way to disable the close-button
(killclient-equivalent in WIMP..) for certain clients, so I thought
maybe it is easy to do that in dwm, too. I have looked at the source,
but I don't know anything about X programming and have to admit I don't
know if I would have to disable the XKillClient or the XSendEvent part
to do it properly.

Any hints?

Thanks in advance


Martin



[dwm] fgeom patch

2008-04-09 Thread yy
As discussed before, this is the patch with the floating geometry
functionality. I removed some loc in restack, but I had to add more in
other places to correctly manage mouse actions when in monocle layout
(isn't a bug the current possibility of moving and resizing windows
while in monocle layout?).
Basically, the patch makes dwm to remember floating geometries when
you change to tiled or monocle layout.
I'm not sure about setting fx and fy on tileresize(), but note that if
you don't do it you will need to add them in movemouse() and
resizemouse() before togglefloating().
I don't really like the idea of remembering floating geometries (at
least floating positions), as I don't like the idea of resizing
floating clients in the tile layout (as in monocle) but this is how I
would implement it.

I'd like to hear what do you think, greetings,

-- 


- yiyus || JGL .

PS: The patch adds 15 lines to dwm.c, but 2 of them comes from my
previous patch to viewprevtag() when you try to view the only selected
tag(s).
diff -r 595ed1a4447c dwm.c
--- a/dwm.c	Tue Apr 08 11:49:35 2008 +0100
+++ b/dwm.c	Wed Apr 09 19:18:24 2008 +0200
@@ -66,6 +66,7 @@ struct Client {
 struct Client {
 	char name[256];
 	int x, y, w, h;
+	int fx, fy, fw, fh;
 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 	int minax, maxax, minay, maxay;
 	long flags;
@@ -285,8 +286,11 @@ arrange(void) {
 	Client *c;
 
 	for(c = clients; c; c = c-next)
-		if(isvisible(c))
+		if(isvisible(c)) {
 			unban(c);
+			if(!lt-isfloating  c-isfloating)
+resize(c, c-fx, c-fy, c-fw, c-fh, True);
+		}
 		else
 			ban(c);
 
@@ -676,7 +680,7 @@ floating(void) { /* default floating lay
 
 	for(c = clients; c; c = c-next)
 		if(isvisible(c))
-			resize(c, c-x, c-y, c-w, c-h, True);
+			resize(c, c-fx, c-fy, c-fw, c-fh, True);
 }
 
 void
@@ -996,8 +1000,8 @@ manage(Window w, XWindowAttributes *wa) 
 	/* geometry */
 	c-x = wa-x;
 	c-y = wa-y;
-	c-w = wa-width;
-	c-h = wa-height;
+	c-w = c-fw = wa-width;
+	c-h = c-fh = wa-height;
 	c-oldbw = wa-border_width;
 	if(c-w == sw  c-h == sh) {
 		c-x = sx;
@@ -1015,6 +1019,8 @@ manage(Window w, XWindowAttributes *wa) 
 			c-y = wy;
 		c-bw = BORDERPX;
 	}
+	c-fx = c-x;
+	c-fy = c-y;
 
 	wc.border_width = c-bw;
 	XConfigureWindow(dpy, w, CWBorderWidth, wc);
@@ -1068,8 +1074,12 @@ monocle(void) {
 	Client *c;
 
 	for(c = clients; c; c = c-next)
-		if((lt-isfloating || !c-isfloating)   isvisible(c))
-			resize(c, mox, moy, mow - 2 * c-bw, moh - 2 * c-bw, RESIZEHINTS);
+		if(isvisible(c)) {
+			if(lt-isfloating)
+resize(c, mox, moy, mow - 2 * c-bw, moh - 2 * c-bw, RESIZEHINTS);
+			else if(!c-isfloating)
+tileresize(c, mox, moy, mow - 2 * c-bw, moh - 2 * c-bw);
+		}
 }
 
 void
@@ -1110,8 +1120,11 @@ movemouse(Client *c) {
 ny = wy + wh - c-h - 2 * c-bw;
 			if(!c-isfloating  !lt-isfloating  (abs(nx - c-x)  SNAP || abs(ny - c-y)  SNAP))
 togglefloating(NULL);
-			if((lt-isfloating) || c-isfloating)
+			if((lt-arrange == floating) || (!lt-isfloating  c-isfloating)) {
 resize(c, nx, ny, c-w, c-h, False);
+c-fx = nx;
+c-fy = ny;
+			}
 			break;
 		}
 	}
@@ -1273,8 +1286,11 @@ resizemouse(Client *c) {
 nh = 1;
 			if(!c-isfloating  !lt-isfloating  (abs(nw - c-w)  SNAP || abs(nh - c-h)  SNAP))
 togglefloating(NULL);
-			if((lt-isfloating) || c-isfloating)
+			if((lt-arrange == floating) || (!lt-isfloating  c-isfloating)) {
 resize(c, c-x, c-y, nw, nh, True);
+c-fw = nw;
+c-fh = nh;
+			}
 			break;
 		}
 	}
@@ -1294,16 +1310,11 @@ restack(void) {
 	if(!lt-isfloating) {
 		wc.stack_mode = Below;
 		wc.sibling = barwin;
-		if(!sel-isfloating) {
-			XConfigureWindow(dpy, sel-win, CWSibling|CWStackMode, wc);
-			wc.sibling = sel-win;
-		}
-		for(c = nexttiled(clients); c; c = nexttiled(c-next)) {
-			if(c == sel)
-continue;
-			XConfigureWindow(dpy, c-win, CWSibling|CWStackMode, wc);
-			wc.sibling = c-win;
-		}
+		for(c = stack; c; c = c-snext)
+			if(!c-isfloating  isvisible(c)) {
+XConfigureWindow(dpy, c-win, CWSibling|CWStackMode, wc);
+wc.sibling = c-win;
+			}
 	}
 	XSync(dpy, False);
 	while(XCheckMaskEvent(dpy, EnterWindowMask, ev));
@@ -1657,6 +1668,8 @@ tileresize(Client *c, int x, int y, int 
 	if((RESIZEHINTS)  ((c-h  bh) || (c-h  h) || (c-w  bh) || (c-w  w)))
 		/* client doesn't accept size constraints */
 		resize(c, x, y, w, h, False);
+	c-fx = x;
+	c-fy = y;
 }
 
 void
@@ -1856,6 +1869,8 @@ view(const char *arg) {
 		memcpy(seltags, tmp, TAGSZ);
 		arrange();
 	}
+	else
+		viewprevtag(NULL);
 }
 
 void


Re: [dwm] Preventing xterm from closing by killclient()

2008-04-09 Thread Anselm R. Garbe
On Wed, Apr 09, 2008 at 04:03:44PM +0200, Martin Sander wrote:
 In the last time I repeatedly closed xterm windows on accident by my
 killclient binding (MODKEY|ShiftMask, XK_c) because I did not see that
 the xterm had focus and not that stupid other client that does not
 provide a convenient keyboard shortcut of its own to close.
 
 I always close xterms with Ctrl-D when I want them to close, so I am
 looking for a way to prevent xterm from closing with killclient().
 
 I have already looked for a solution in xterm, but there seems to be
 none.  IceWM provides a way to disable the close-button
 (killclient-equivalent in WIMP..) for certain clients, so I thought
 maybe it is easy to do that in dwm, too. I have looked at the source,
 but I don't know anything about X programming and have to admit I don't
 know if I would have to disable the XKillClient or the XSendEvent part
 to do it properly.
 
 Any hints?

Hmm, what about changing the binding to Ctrl-d in your setup
then?

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] dmenu, slock patches; slock DPMS crash

2008-04-09 Thread Anselm R. Garbe
Sorry for odd reasons the applied patches weren't present in the
dmenu hg tip, this is fixed now.

On Tue, Apr 08, 2008 at 10:57:20AM +0200, Anselm R. Garbe wrote:
 On Mon, Apr 07, 2008 at 10:51:15PM +0200, Peter Hartlich wrote:
  dmenu_run.patch:
  - replace $* with $@ so dmenu_run -p foo bar works
 
 I applied this patch with Jukka's remark.
 
  dmenu_path.patch:
  - no need for ${file##*/} string replacement
  - sort -u instead of sort | uniq
  - quote CACHE variable (HOME may contain an IFS character)
  - error checking with 
 
 Applied.
 
  slock.patch:
  - use numpad code from dmenu
 
 Applied.

-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] dmenu, slock patches; slock DPMS crash

2008-04-09 Thread Anselm R. Garbe
On Wed, Apr 09, 2008 at 11:12:23AM +0200, Anselm R. Garbe wrote:
 On Tue, Apr 08, 2008 at 02:37:10PM +0200, Peter Hartlich wrote:
   Also, with the new DPMS code from changeset 31, slock crashes here
   (X.org server 1.4.0.90, DPMS disabled in xorg.conf):
   
   | X Error of failed request:  BadMatch (invalid parameter attributes)
   |   Major opcode of failed request:  136 (DPMS)
   |   Minor opcode of failed request:  6 (DPMSForceLevel)
   |   Serial number of failed request:  27
   |   Current serial number in output stream:  28
   
   Right, should be fixed in hg tip now. Please confirm this due to
   a recheck.
  
  Still crashes at DPMSForceLevel. It seems that DPMSCapable returns True
  even with DPMS disabled...
 
 Well, then I need to add an error handler.

I pushed a changeset into hg tip of slock which attempts to fix
the DPMS issue without using a separate error handler, hence
please recheck, If the crash still occurs, there is no other
choice than wether not supporting DPMS or implementing an error
handler which ignores BadMatch errors due to DPMSForceLevel
calls.

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] Preventing xterm from closing by killclient()

2008-04-09 Thread Martin Sander
On Wed, Apr 09, 2008 at 11:25:59PM +0200, Anselm R. Garbe wrote:
 Hmm, what about changing the binding to Ctrl-d in your setup
 then?

Thanks for the suggestion, but I think I did not make myself entirely
clear. My problem is of different nature.

As an example, I have an xterm with an ipython [2] shell, which I use to
plot some data using matplotlib [2]. The window showing the plot has no
means of closing it but killclient() (the same with gnuplot, btw).

So when I want to close that window I use MODKEY|Shiftmask, XK_c.
My problem occurs when I don't realize that actually that window is not
focused, but the xterm running ipython is focused instead.
xterm closes, I lose everything I have typed in that window so far,
including the history, which is absolutely not what I want.

I know I could use BORDERPX  2 or set SELBORDERCOLOR to something very
high contrast, but I'd find that rather distracting/ugly.

I'd prefer just to never ever kill xterm, something like

if (clientname=='xterm') 
return;

in killclient(). I just need some hints how to do it.

Regards

Martin

[1] http://ipython.scipy.org/
[2] http://matplotlib.sourceforge.net/




Re: [dwm] Preventing xterm from closing by killclient()

2008-04-09 Thread Jeremy O'Brien
I recommend looking in applyrules() for some example code. You may be  
able to adapt it in killclient() :)


On Apr 9, 2008, at 18:56, Martin Sander [EMAIL PROTECTED] wrote:


On Wed, Apr 09, 2008 at 11:25:59PM +0200, Anselm R. Garbe wrote:

Hmm, what about changing the binding to Ctrl-d in your setup
then?


Thanks for the suggestion, but I think I did not make myself entirely
clear. My problem is of different nature.

As an example, I have an xterm with an ipython [2] shell, which I  
use to
plot some data using matplotlib [2]. The window showing the plot has  
no

means of closing it but killclient() (the same with gnuplot, btw).

So when I want to close that window I use MODKEY|Shiftmask, XK_c.
My problem occurs when I don't realize that actually that window is  
not

focused, but the xterm running ipython is focused instead.
xterm closes, I lose everything I have typed in that window so far,
including the history, which is absolutely not what I want.

I know I could use BORDERPX  2 or set SELBORDERCOLOR to something  
very

high contrast, but I'd find that rather distracting/ugly.

I'd prefer just to never ever kill xterm, something like

   if (clientname=='xterm')
   return;

in killclient(). I just need some hints how to do it.

Regards

Martin

[1] http://ipython.scipy.org/
[2] http://matplotlib.sourceforge.net/