[dwm] automatic float on maximize

2007-07-30 Thread Abel Darc
Good day everybody. This is my first post to this list, but I have
been using dwm for some time and am very pleased with it as my main
window manager. I've made many small changes here and there during my
[blissful :)] time with dwm, so I thought about sharing some. This
particular one was requested by a friend of mine, so I've chosen it to
be the first.

Name:
Automatic Float On Maximize

Description:
Automatically toggles floating mode (if required) when calling
togglemax(), and then toggles it once more on the second call.


I hope you find it useful.

- Abel
diff --git a/dwm.h b/dwm.h
index 999f027..3b10067 100644
--- a/dwm.h
+++ b/dwm.h
@@ -50,7 +50,7 @@ struct Client {
 	int minax, maxax, minay, maxay;
 	long flags; 
 	unsigned int border, oldborder;
-	Bool isbanned, isfixed, ismax, isfloating;
+	Bool isbanned, isfixed, ismax, isfloating, wasfloating;
 	Bool *tags;
 	Client *next;
 	Client *prev;
diff --git a/layout.c b/layout.c
index f8c92ee..2e335e1 100644
--- a/layout.c
+++ b/layout.c
@@ -224,17 +224,26 @@ void
 togglemax(const char *arg) {
 	XEvent ev;
 
-	if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed)
+	if(!sel || sel->isfixed)
 		return;
 	if((sel->ismax = !sel->ismax)) {
+		if (lt->arrange != floating && !sel->isfloating) {
+			togglefloating(NULL);
+			sel->wasfloating = False;
+		}
+		else
+			sel->wasfloating = True;
 		sel->rx = sel->x;
 		sel->ry = sel->y;
 		sel->rw = sel->w;
 		sel->rh = sel->h;
 		resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
 	}
-	else
+	else {
 		resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
+		if (!sel->wasfloating)
+			togglefloating(NULL);
+	}
 	drawstatus();
 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 }


Re: [dwm] start maximized patch

2007-07-30 Thread Kai Grossjohann
On Mon, Jul 30, 2007 at 08:01:11PM +0200, pancake wrote:

> ion solves this by showing all the client's title on a single line

I had abandoned all hope and managed to forget, but you put salt into
the wound.

Kai




Re: [dwm] dwm-4.4 is on its way

2007-07-30 Thread Jeroen Schot
On Sat, Jul 28, 2007 at 05:23:24PM +0200, Anselm R. Garbe wrote:
> Hi there,
> 
> I ask you to check the current hg tip (changeset 927+) to test
> dwm. Especially those using Mathematica having trouble with the
> so-called greyish blobs bug.

Hi Anselm,

Current hg tip (929) still shows these Mathematica grey blobs.

Regards,
-- 
Jeroen Schot

[EMAIL PROTECTED] (mail & jabber)
http://schot.a-eskwadraat.nl



Re: [dwm] dwm-4.4 is on its way

2007-07-30 Thread Jukka Salmi
Anselm R. Garbe --> dwm (2007-07-30 21:08:44 +0200):
> I pushed a "fix" (rev 929), please recheck.

Seems to work fine, thanks!


Regards, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~



Re: [dwm] dwm-4.4 is on its way

2007-07-30 Thread Anselm R. Garbe
On Sun, Jul 29, 2007 at 07:51:31PM +0200, Anselm R. Garbe wrote:
> On Sun, Jul 29, 2007 at 12:58:00PM +0200, Jukka Salmi wrote:
> > Anselm R. Garbe --> dwm (2007-07-28 17:23:24 +0200):
> > > I ask you to check the current hg tip (changeset 927+) to test
> > > dwm. Especially those using Mathematica having trouble with the
> > > so-called greyish blobs bug. I changed the mechanism how dwm
> > > bans resp. unbans windows. Since dwm 0.1 it banned/unbanned
> > > windows through XMoveWindow()-ing them off- and onscreen. Now
> > > dwm uses X[Un]mapWindow() for this purpose.
> > 
> > When starting Firefox in tiling layout, its window is now positioned
> > as if there were no status bar. This happens most of the time, but no
> > always (!?). See [1]here. Starting another client on the same tag seems
> > to fix the broke positioning.
> > 
> > 
> > Regards, Jukka
> > 
> > [1] http://salmi.ch/~jukka/dwm/ff.png
> 
> It seems being related that firefox does not really accept being
> resized if it is not mapped ;) So the decision is, wether to
> live with flicker or not, I will see if I can develop a sane
> solution for the problem (before this change XMoveWindow() made
> sure that the y-coordinate is correct in any case, however the
> old behavior hided the fact, that ff internally lived with a
> different geometry information).  ff is a nightmare ;)

I pushed a "fix" (rev 929), please recheck.

Regards,
-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361



Re: [dwm] dwm-4.4 is on its way

2007-07-30 Thread Jeremy O'Brien
On Mon, Jul 30, 2007 at 10:52:19AM +0200, Antoni Grzymała wrote:
> On Mon, 30 Jul 2007 06:50:55 +0200, Jeremy O'Brien <[EMAIL PROTECTED]>  
> wrote:
> 
> >Hello there. A little off-topic from this thread, but I noticed in that
> >screenshot that you have a "messages:6" line in your status bar. How in
> >the heck did you get that to show there? I can't find any programs
> >outside of gkrellm's mail monitor that supports maildir-style mailboxes.
> >Thank you so much...
> 
> Here's some bash code I use in my dwm status-bar script to show the number  
> of unread messages in my maildirs, just noticed it's got some hardcoded  
> regexp strings you need to change along with the ${DIRS} variable (in  
> other words, needs some cleaning up):
> 
> 
> # Maildir UNREAD messages
> 
> DIRS="/var/spool/mail/antoni/new/ /home/antoni/mail/*/new/"
> 
> for dir in ${DIRS}; do
> licznik=0
> for k in ${dir}/*; do
> [[ -f ${k} ]] && ((licznik++))
> done
> 
> if [[ ${licznik} -ne 0 ]]; then
> dir=${dir/\/var\/spool\/mail\/antoni\/new\//Spool}
> dir=${dir/\/home\/antoni\/mail\//}
> dir=${dir/\/new\//}
> MAIL="${dir}: ${licznik} · ${MAIL}"
> fi
> done
> 
> 
> 
> All of my scripts are available at theka.tk/dwm if you're interested (may  
> not be current).
> 
> Best,
> 
> [a]
> 
> 
Thank you. That worked like a charm.

-- 
__neutral__insomniac__


pgpqnoMuz7YoB.pgp
Description: PGP signature


Re: [dwm] dwm-4.4 is on its way

2007-07-30 Thread Christian Dietrich
* Jeremy O'Brien <[EMAIL PROTECTED]> [Jul 30 2007 06:54] wrote:

> Hello there. A little off-topic from this thread, but I noticed in that
> screenshot that you have a "messages:6" line in your status bar. How in
> the heck did you get that to show there? I can't find any programs
> outside of gkrellm's mail monitor that supports maildir-style mailboxes.
> Thank you so much...

Hi, 
is use this for counting my new mails in Maildir:

find ~/Maildir -name cur -or -name new | xargs -d "\n" -I "%s" ls "%s" |
egrep "^[^/:]*(:[12],[^/S]*$)?$" | wc -l

greetz
  didi


pgp1jG6u5iMwv.pgp
Description: PGP signature


Re: [dwm] start maximized patch

2007-07-30 Thread pancake
ion solves this by showing all the client's title on a single line

but this will make dwm more complex and ugly :)

the question is if you want to store this info in your head or in dwm

On Mon, Jul 30, 2007 at 01:44:12PM +0200, Kai Grossjohann wrote:
> On Thu, Jul 26, 2007 at 08:49:36PM -0400, Jeremy O'Brien wrote:
> 
> > Do you use [the monocle layout] personally? Just curious. I couldn't
> > find a logical place I'd ever need to use such a layout. For me, it
> > became hard to manage all the windows I might have open on one view
> > while only being able to switch between them one at a time. Just
> > looking for insight into this. :)
> 
> I use it often.  I have several programs that I always want to be in
> fullscreen mode: Firefox, OpenOffice, Adobe Reader.  I have a tag for
> them and then I can easily switch between them.
> 
> If a view in monocle layout contains too many clients, then it becomes
> difficult to maintain state in the head which clients exists and where
> we are in the order.  But if it is just 3 or 4 clients, then one doesn't
> need to keep track of things in the head -- it is enough to just cycle
> all clients until the one you want pops up.
> 
> Kai
> 
> 



Re: [dwm] start maximized patch

2007-07-30 Thread Kai Grossjohann
On Thu, Jul 26, 2007 at 08:49:36PM -0400, Jeremy O'Brien wrote:

> Do you use [the monocle layout] personally? Just curious. I couldn't
> find a logical place I'd ever need to use such a layout. For me, it
> became hard to manage all the windows I might have open on one view
> while only being able to switch between them one at a time. Just
> looking for insight into this. :)

I use it often.  I have several programs that I always want to be in
fullscreen mode: Firefox, OpenOffice, Adobe Reader.  I have a tag for
them and then I can easily switch between them.

If a view in monocle layout contains too many clients, then it becomes
difficult to maintain state in the head which clients exists and where
we are in the order.  But if it is just 3 or 4 clients, then one doesn't
need to keep track of things in the head -- it is enough to just cycle
all clients until the one you want pops up.

Kai




Re: [dwm] dwm-4.4 is on its way

2007-07-30 Thread Antoni Grzymała
On Mon, 30 Jul 2007 10:52:19 +0200, Antoni Grzymała <[EMAIL PROTECTED]>  
wrote:


hardcoded regexp strings you need to change along with the ${DIRS}  
variable (in other words, needs some cleaning up):



 dir=${dir/\/var\/spool\/mail\/antoni\/new\//Spool}
 dir=${dir/\/home\/antoni\/mail\//}
 dir=${dir/\/new\//}


Err... Of course not *regexp* strings, just plain substitution, sorry.

[a]

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



Re: [dwm] dwm-4.4 is on its way

2007-07-30 Thread Antoni Grzymała
On Mon, 30 Jul 2007 06:50:55 +0200, Jeremy O'Brien <[EMAIL PROTECTED]>  
wrote:



Hello there. A little off-topic from this thread, but I noticed in that
screenshot that you have a "messages:6" line in your status bar. How in
the heck did you get that to show there? I can't find any programs
outside of gkrellm's mail monitor that supports maildir-style mailboxes.
Thank you so much...


Here's some bash code I use in my dwm status-bar script to show the number  
of unread messages in my maildirs, just noticed it's got some hardcoded  
regexp strings you need to change along with the ${DIRS} variable (in  
other words, needs some cleaning up):



# Maildir UNREAD messages

DIRS="/var/spool/mail/antoni/new/ /home/antoni/mail/*/new/"

for dir in ${DIRS}; do
licznik=0
for k in ${dir}/*; do
[[ -f ${k} ]] && ((licznik++))
done

if [[ ${licznik} -ne 0 ]]; then
dir=${dir/\/var\/spool\/mail\/antoni\/new\//Spool}
dir=${dir/\/home\/antoni\/mail\//}
dir=${dir/\/new\//}
MAIL="${dir}: ${licznik} · ${MAIL}"
fi
done



All of my scripts are available at theka.tk/dwm if you're interested (may  
not be current).


Best,

[a]

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



Re: [dwm] dwm-4.4 is on its way

2007-07-30 Thread Jukka Salmi
Jeremy O'Brien --> dwm (2007-07-30 00:50:55 -0400):
> Hello there. A little off-topic from this thread, but I noticed in that
> screenshot that you have a "messages:6" line in your status bar. How in
> the heck did you get that to show there? I can't find any programs
> outside of gkrellm's mail monitor that supports maildir-style mailboxes.

Me neither, but luckily I don't use maildir mailboxes ;-)

The `messages: n' results from running `fetchmail -c' on some IMAP
mailboxes and processing its output with awk(1).


Regards, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~