Re: [dwm] patch to store layouts per tagset

2008-07-08 Thread Henrik Holst
 Date: Mon, 07 Jul 2008 14:12:23 +0200
 From: Christoph Schied [EMAIL PROTECTED]
 Subject: [dwm] patch to store layouts per tagset
 To: dwm@suckless.org
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 
 Hi!
 
 
 http://caustic.ath.cx/~caustic/tagsave.patch
 http://caustic.ath.cx/~caustic/config.h
 
 screenshot:
 http://caustic.ath.cx/~caustic/2008-07-05-163410_1024x768_scrot.png
 
 this patch against current hg will add the following features:
 
Snip!
 - sending signal USR_1 to dwm lets dwm reexec its binary, so you can 
 update dwm without restarting X

This seems like something really useful!
Does this work together with stdin pipes? Does the PID change?

-- 
Henrik Holst, Sweden  | TYPING IS NO SUBSTITUTE FOR THINKING
holst CHR(64) matmech.com | - A Manual for BASIC,
  |   Darthmouth College, 1 October 1964



[dwm] Adapted the pertag patch for 5.0.1

2008-07-08 Thread Mayhem 666
Greetings to all

This is my first attempt to improve-modify existing open source, so please
forgive any
imperfections or errors. I believe the patch i send applied to 5.0.1 to be
free of any bugs.
It is a simple adaptation of the pertag patch which was at the site to the
new version of dwm.
A friend asked me to write it so i worked with the existing patch.
Hopefully the project maintainer can update the web site with this fixed
version.

Thanks in advance.
diff -up dwm-5.0.1/dwm.c dwm-5.0.1.pertag/dwm.c
--- dwm.c	2008-06-19 11:11:38.0 +0300
+++ dwm.c	2008-07-08 23:17:30.0 +0300
@@ -237,6 +237,8 @@ static Display *dpy;
 static DC dc = {0};
 static Layout *lt = NULL;
 static Window root, barwin;
+static Layout **ptlt;
+static double *mfacts;
 /* configuration, allows nested code to access above variables */
 #include config.h
 
@@ -272,7 +274,10 @@ applyrules(Client *c) {
 void
 arrange(void) {
 	Client *c;
+	int i;
 
+	for(i = 0; i  LENGTH(tags)  !(tagset[seltags]  1  i); i++);
+	lt = ptlt[i];		/* The first visible tag defines the layout */
 	for(c = clients; c; c = c-next)
 		if(c-tags  tagset[seltags]) { /* is visible */
 			if(ismax  !c-isfixed) {
@@ -1300,6 +1305,7 @@ setclientstate(Client *c, long state) {
 void
 setmfact(const Arg *arg) {
 	float f;
+	int i;
 
 	if(!arg || !lt-arrange)
 		return;
@@ -1307,6 +1313,9 @@ setmfact(const Arg *arg) {
 	if(f  0.1 || f  0.9)
 		return;
 	mfact = f;
+	for(i = 0; i  LENGTH(tags); i++)
+		if(tagset[seltags]  1  i)
+			mfacts[i] = mfact;		/* Adjust all visible tags mfact */
 	arrange();
 }
 
@@ -1328,6 +1337,16 @@ setup(void) {
 	lt = layouts;
 	updategeom();
 
+	/* init mfacts array and ptlt array */
+	if(!(mfacts = calloc(LENGTH(tags), sizeof(double
+		eprint(Fatal: could not calloc() %d bytes\n, LENGTH(tags) * sizeof(double) );
+	for(i = 0; i  LENGTH(tags); i++)
+	  	mfacts[i] = mfact;
+	if(!(ptlt = calloc(LENGTH(tags), sizeof(Layout*
+		eprint(Fatal: could not calloc() %d bytes\n, LENGTH(tags) * sizeof(Layout *) );
+	for(i = 0; i  LENGTH(tags); i++)
+		ptlt[i] = lt;
+
 	/* init atoms */
 	wmatom[WMProtocols] = XInternAtom(dpy, WM_PROTOCOLS, False);
 	wmatom[WMDelete] = XInternAtom(dpy, WM_DELETE_WINDOW, False);
@@ -1436,7 +1455,8 @@ tile(void) {
 
 	/* master */
 	c = nexttiled(clients);
-	mw = mfact * ww;
+	for(i = 0; iLENGTH(tags)  !(tagset[seltags]  1  i); i++);	/* Select mfact from first visible tag */
+	mw = mfacts[i] * ww;
 	resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c-bw, wh - 2 * c-bw, resizehints);
 
 	if(--n == 0)
@@ -1480,8 +1500,13 @@ void
 togglelayout(const Arg *arg) {
 	if(arg  arg-v)
 		lt = (Layout *)arg-v;
-	else if(++lt == layouts[LENGTH(layouts)])
-		lt = layouts[0];
+	else {
+		int i;
+		for(i = 0; iLENGTH(tags); i++)
+			if( tagset[seltags]  1  i )
+if( ++ptlt[i] == layouts[LENGTH(layouts)] )
+	ptlt[i] = layouts;
+	} 
 	if(sel)
 		arrange();
 	else


Re: [dwm] patch to store layouts per tagset

2008-07-08 Thread Christoph Schied

Henrik Holst wrote:


This seems like something really useful!
Does this work together with stdin pipes? Does the PID change?




the stdin pipe and the PID will remain.



[dwm] Hide Inactive Mouse Pointer?

2008-07-08 Thread Kevin Monceaux

DWM Fans,

Has anyone ever attempted, or would it even be possible, to create a patch 
that hides the mouse pointer after a period of inactivity.  I've seen some 
programs do it.  For example, if I run xine in fullscreen mode the mouse 
pointer vanishes shortly after xine starts.  If the mouse, or in my case 
trackball, is moved, the pointer reappears.  And if it's not moved for a 
short period of time, it vanishes again.  I'd love to have similar 
functionality with DWM itself.  I frequently move the mouse pointer to the 
lower right hand side of the screen where it's barely visible.





Kevin
http://www.RawFedDogs.net
http://www.WacoAgilityGroup.org
Bruceville, TX

Si hoc legere scis nimium eruditionis habes.
Longum iter est per praecepta, breve et efficax per exempla!!!




Re: [dwm] Hide Inactive Mouse Pointer?

2008-07-08 Thread James Turner
On Tue, Jul 08, 2008 at 07:58:17PM -0500, Kevin Monceaux wrote:
 DWM Fans,

 Has anyone ever attempted, or would it even be possible, to create a patch 
 that hides the mouse pointer after a period of inactivity.  I've seen some 
 programs do it.  For example, if I run xine in fullscreen mode the mouse 
 pointer vanishes shortly after xine starts.  If the mouse, or in my case 
 trackball, is moved, the pointer reappears.  And if it's not moved for a 
 short period of time, it vanishes again.  I'd love to have similar 
 functionality with DWM itself.  I frequently move the mouse pointer to the 
 lower right hand side of the screen where it's barely visible.




 Kevin
 http://www.RawFedDogs.net
 http://www.WacoAgilityGroup.org
 Bruceville, TX

 Si hoc legere scis nimium eruditionis habes.
 Longum iter est per praecepta, breve et efficax per exempla!!!

You might want to check out unclutter [0].

[0] http://www.ibiblio.org/pub/X11/contrib/utilities/unclutter-8.tar.gz

-- 
James Turner
BSD Group Consulting
http://www.bsdgroup.org



Re: [dwm] Hide Inactive Mouse Pointer?

2008-07-08 Thread Kevin Monceaux

James,

On Tue, 8 Jul 2008, James Turner wrote:


You might want to check out unclutter [0].

[0] http://www.ibiblio.org/pub/X11/contrib/utilities/unclutter-8.tar.gz


Many thanks  That seems to be exactly what I was looking for.  As an 
added bonus I found a port for unclutter available in my FreeBSD ports 
tree.  It took just a few moments to install and works like a charm!!




Kevin
http://www.RawFedDogs.net
http://www.WacoAgilityGroup.org
Bruceville, TX

Si hoc legere scis nimium eruditionis habes.
Longum iter est per praecepta, breve et efficax per exempla!!!




Re: [dwm] patch to store layouts per tagset

2008-07-08 Thread Donald Chai
- shows all windownames in the statusbar (this is nice for the  
maximized layout, as you wouldnt see there are multiple windows on  
that tag otherweise). that stuff is a little bit messy, id like to  
see suggestions how to make that better. it uses a defined maximum  
length for the title, and if the length of all windownames gets too  
long, the title will not be drawn.



IMHO, it looks like most of the messiness is due to the 1px  
separators: the code is much cleaner without them. The version below  
omits them, and divides the available space if the length of all  
windownames gets too long.


If you really like the 1px separators, maybe you should draw a big  
box before anything else, and add

dc.x++
wherever you want one?

void
drawbar(void) {
int i, x;
Client *c;

dc.x = 0;
for(i = 0; i  LENGTH(tags); i++) {
dc.w = TEXTW(tags[i]);
if(tagset[seltags]  1  i)
drawtext(tags[i], dc.norm, True);
else if(isurgent(i))
drawtext(tags[i], dc.sel, False);
else
continue;
dc.x += dc.w;
}
if(blw  0) {
dc.w = blw;
drawtext(lt[sellt]-symbol, dc.norm, issaved());
x = dc.x + dc.w;
}
else
x = dc.x;
dc.w = TEXTW(stext);
dc.x = ww - dc.w;
if(dc.x  x) {
dc.x = x;
dc.w = ww - x;
}
drawtext(stext, dc.norm, False);

if((dc.w = dc.x - x)  bh) {
int nvis = 0;
int cw   = 0;
int w;

dc.w = dc.x - x;
dc.x = x;
drawtext(NULL, dc.norm, False);
w = dc.w;

/* get the number of visible clients */
for(c = clients; c; c = c-next) {
if(ISVISIBLE(c)) {
nvis++;
cw += TEXTW(c-name);
}
}
for(c = clients; c; c = c-next) {
if(!ISVISIBLE(c))
continue;
dc.w = (cw  w) ? (w / nvis) : TEXTW(c-name);
drawtext(c-name, dc.norm, sel == c);
dc.x += dc.w;
}
}
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, ww, bh, 0, 0);
XSync(dpy, False);
}




Re: [dwm] Hide Inactive Mouse Pointer?

2008-07-08 Thread James Turner
On Tue, Jul 08, 2008 at 08:35:13PM -0500, Kevin Monceaux wrote:
 James,

 On Tue, 8 Jul 2008, James Turner wrote:

 You might want to check out unclutter [0].

 [0] http://www.ibiblio.org/pub/X11/contrib/utilities/unclutter-8.tar.gz

 Many thanks  That seems to be exactly what I was looking for.  As an 
 added bonus I found a port for unclutter available in my FreeBSD ports 
 tree.  It took just a few moments to install and works like a charm!!

Glad you find it useful, I too have been using it ever since I discovered
it in the OpenBSD ports tree :)

-- 
James Turner
BSD Group Consulting
http://www.bsdgroup.org



Re: [dwm] patch to store layouts per tagset

2008-07-08 Thread Alexander Polakov
* Christoph Schied [EMAIL PROTECTED] [080707 16:21]:
 - shows all windownames in the statusbar (this is nice for the maximized  
 layout, as you wouldnt see there are multiple windows on that tag  
 otherweise). that stuff is a little bit messy, id like to see  
 suggestions how to make that better. it uses a defined maximum length  
 for the title, and if the length of all windownames gets too long, the  
 title will not be drawn.

You can take a look at my old code [1] for this. It divides statusbar
into 'taskbar' and 'status' area, so status can be hidden. Taskbar
scales well for many windows. Here's a screenie [2].

[1] http://rootshell.be/~polachok/trash/dwm-ion-new-1004.tar.gz
[2] http://rootshell.be/~polachok/trash/dwmtabbed.png
-- 
Alexander Polakov | http://rootshell.be/~polachok/