Re: [dwm] pertag for dwm-5.0.1

2008-06-29 Thread Jan Christoph Ebersbach
On Sun 29-06-2008 17:45 +0200, Fredrik Ternerot wrote:

> I found out that dwm-5.0-pertag.diff (from suckless.org) did not work
> for dwm-5.0.1 at all, so I wrote my own modifications to get layout
> and mfact stored per tag. I attach an diff if anyone is interested.
>
> From a user perspective, it works as a expected when only one tag
> is viewed. If more tags are added to the view, the layout and mfact
> will not change, i.e., the values for the tag first shown will be
> used. The "tag first shown" (or maintag as it is called in code) is
> also remembered when switching to previous tagset (MODKEY-tab).

Yep, you could use the updated version at
http://herbst.homeunix.org/~jceb/dwm/5.0.1 - Have a look at my email
from yesterday: <[EMAIL PROTECTED]>

Cheers.
-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


Re: [dwm] In context of dwm 5.0

2008-06-28 Thread Jan Christoph Ebersbach
On Sat 28-06-2008 12:25 -0700, Scytrin dai Kinthra wrote:

> Since the loss of DEFGEOM, which I enjoyed in terms of the ease
> of setting up the basic parameters of display logic, attaining my
> favoured setup has become a little obscured.
>
> What would be the simplest way to define the status bar be only
> half the screen width? My intent would be to use dzen for misc info
> display, piping persistant information to dwm. I tend to jump to
> different machines with different stups and having a particular setup
> per host has become standard for me. Some have multiple displays, some
> have one, some are wifi only, some are wired only, some are mixed,
> etc...
>
> I had poked around in drawbar() this morning, seeing about possibly
> removing the stdin/status section of the bar or restricting the width
> of the bar and could only deduce that (int)ww determined the width
> bound of the bar, and the setting of dc.x = 0; determined the origin.
> Am I correct in this appraisal?

Hi Scytrin,

Just today I wrote a small patch to fix the status bar to a specific
width - it's attached to this email.

I also liked DEFGEOM since I'm using a two screen setup. It was a nice
first try to make multi screen setups enjoyable - I'm looking forward to
the next attempt.

Greetings.
-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10
diff -r 8d58433a1bc7 config.def.h
--- a/config.def.h	Sat Jun 28 14:24:04 2008 +0200
+++ b/config.def.h	Sat Jun 28 15:57:21 2008 +0200
@@ -10,6 +10,7 @@
 static const char selfgcolor[]  = "#ff";
 static uint borderpx= 1;/* border pixel of windows */
 static uint snap= 32;   /* snap pixel */
+static uint barwidth= 1400;
 static Bool showbar = True; /* False means no bar */
 static Bool topbar  = True; /* False means bottom bar */
 
diff -r 8d58433a1bc7 dwm.c
--- a/dwm.c	Sat Jun 28 14:24:04 2008 +0200
+++ b/dwm.c	Sat Jun 28 15:57:21 2008 +0200
@@ -513,10 +513,10 @@
 	else
 		x = dc.x;
 	dc.w = TEXTW(stext);
-	dc.x = ww - dc.w;
+	dc.x = barwidth - dc.w;
 	if(dc.x < x) {
 		dc.x = x;
-		dc.w = ww - x;
+		dc.w = barwidth - x;
 	}
 	drawtext(stext, dc.norm, False);
 	if((dc.w = dc.x - x) > bh) {
@@ -528,7 +528,7 @@
 		else
 			drawtext(NULL, dc.norm, False);
 	}
-	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, ww, bh, 0, 0);
+	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, barwidth, bh, 0, 0);
 	XSync(dpy, False);
 }
 
@@ -1364,7 +1364,7 @@
 	wa.background_pixmap = ParentRelative;
 	wa.event_mask = ButtonPressMask|ExposureMask;
 
-	barwin = XCreateWindow(dpy, root, wx, by, ww, bh, 0, DefaultDepth(dpy, screen),
+	barwin = XCreateWindow(dpy, root, wx, by, barwidth, bh, 0, DefaultDepth(dpy, screen),
 			CopyFromParent, DefaultVisual(dpy, screen),
 			CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
 	XDefineCursor(dpy, barwin, cursor[CurNormal]);
@@ -1549,8 +1549,8 @@
 updatebar(void) {
 	if(dc.drawable != 0)
 		XFreePixmap(dpy, dc.drawable);
-	dc.drawable = XCreatePixmap(dpy, root, ww, bh, DefaultDepth(dpy, screen));
-	XMoveResizeWindow(dpy, barwin, wx, by, ww, bh);
+	dc.drawable = XCreatePixmap(dpy, root, barwidth, bh, DefaultDepth(dpy, screen));
+	XMoveResizeWindow(dpy, barwin, wx, by, barwidth, bh);
 }
 
 void


signature.asc
Description: Digital signature


Re: [dwm] dwm-5.0.1

2008-06-28 Thread Jan Christoph Ebersbach
On Mon 23-06-2008 17:24 +0200, Anselm R. Garbe wrote:

> Btw I nearly never use Mod1-f so I'd like to hear more feedback from
> others first before making a definitive decision here.

Since Mod1 is heavily used by a lot of programs I switched to Mod4 which
is free anyway.

-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


[dwm] Patches for dwm-5.0.1

2008-06-27 Thread Jan Christoph Ebersbach
Hi folks,

I've updated the following patches for version 5.0.1:

float-border-color2
maximize_vert_horz
moveresize
pertag
raiselower
save_floats
tagall
tileh

They can be obtained here: http://herbst.homeunix.org/~jceb/dwm/5.0.1/current/

I'll update the wiki soon.

Greetings.
-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


Re: [dwm] way towards 5.0

2008-05-23 Thread Jan Christoph Ebersbach
On Sun 18-05-2008 12:42 +0200, Anselm R. Garbe wrote:

> On Sun, May 18, 2008 at 12:07:37PM +0200, Jan Christoph Ebersbach
> wrote:
>
> > I'm really wondering about the roadmap of dwm. - Since version 2.8
> > the development is officially finished, isn't it? From my point of
> > view most of the changes are related to moving locs.
>
> If you compare hg tip to 2.8 you won't notice drastic differences
> from a user POV, however the code has evolved a lot since that time
> (included bug fixes).

Jep, that's for sure - sorry for the harsh words.

> > The description of dwm says: It manages windows in tiled and
> > floating layouts.
> >
> > So why don't we concentrate on these things? Main dwm comes with
> > just two/one tiled modes although the current way to include patches
> > would allow us add all the bstack, fibonacci ... modes in separate
> > files and let the user decide which one he actually needs.
>
> Exactly, that's what we doing.

But why are these layouts not part of the main distribution? As we've
seen there are not always people maintaining these patches and it's also
a risky thing to apply patches as they are not always working with the
current release.

I vote for adding all available layout patches to the main distribution.

> > The floating layout is totally useless when it comes to mouseless
> > usage and even with the mouse there is no window manager that
> > provides such weak functionality to manage floating windows.
>
> I disagree. I think the floating mode is as usable as in traditional
> WMs -- which functionality are you missing?

Pancake guessed right, I was talking about maximizing, moving and
resizing windows. It would also be nice to have an arrange and/or an
overview like the one MacOS provides.

Cheers.
-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


Re: [dwm] way towards 5.0

2008-05-22 Thread Jan Christoph Ebersbach
On Mon 19-05-2008 18:30 +0200, Rockwolf wrote:

> I too think the floating layout is necessary. But if you don't like
> it, you can always turn it of in the config.  I really like this
> config.h stuff, you can throw out anything you don't like ^^ and only
> if no-one likes it, it might be worth completely removing it, but like
> I said, floating layout seems necessary to me (for pop-ups or badly
> programmed graphical apps as fir as I use those)

No doubt about the usefulness of the floating layout. I was just
criticising the few functionality for floating windows (maximization in
all directions, resizing, moving). In fact I decided to get rid of the
tiled layout as default for any window.

The following rule makes every window floating by default and I'm free
to set the few windows in tiled mode that really have to be there. To me
it's far to nerve wracking to have broken apps opening their windows in
tiled mode and later on trying to figure out the necessary rules
parameters to make them floating by default.

Rule rules[] = {
/* classinstancetitle   tags refisfloating */
{ NULL, NULL,   NULL,   NULL,   True },
};

-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


Re: [dwm] way towards 5.0

2008-05-22 Thread Jan Christoph Ebersbach
On Mon 19-05-2008 20:34 +0200, Anselm R. Garbe wrote:

> Maybe I will include something like this in the future.  Out of
> curiosity, which keybindings are you using to achieve keyboard-driven
> movements and resizals, since Mod1-{h,j,k,l} are taken already.

Good question. For a long time I remapped the focus next/previous window
back to Mod1-{n,p}. This was most convenient but because dwm is making
use of the vi-keys more and more I decided to move them to
Mod1-{w,a,s,d}. It just sucks for the first two days ;)

-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


Re: [dwm] way towards 5.0

2008-05-18 Thread Jan Christoph Ebersbach
On Sat 17-05-2008 16:05 +0200, Anselm R. Garbe wrote:

> Let me know how welcome do you feel about those changes. Bug reports
> are also welcome.

I'm really wondering about the roadmap of dwm. - Since version 2.8 the
development is officially finished, isn't it? From my point of view most
of the changes are related to moving locs.

The description of dwm says: It manages windows in tiled and floating
layouts.

So why don't we concentrate on these things? Main dwm comes with just
two/one tiled modes although the current way to include patches would
allow us add all the bstack, fibonacci ... modes in separate files and
let the user decide which one he actually needs.

The floating layout is totally useless when it comes to mouseless usage
and even with the mouse there is no window manager that provides such
weak functionality to manage floating windows.

I'd like to see changes in these areas before we think about another
features that are added and removed within a few days (vote for an
experimental branch).

My two cents.
-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


[dwm] bug: self resizing windows

2008-05-17 Thread Jan Christoph Ebersbach
Hi,

When I use the self resizing functionality of a floating window it's not
recognized by dwm. On the next switch to the tag with the floating window the
old size is restored instead of the changed size.

$ vlc video.mpg
switch to prevtag and back
=> the vlc windows is visible but no the video

Greetings.
-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


Re: [dwm] togglemax substiute in 4.9?

2008-04-08 Thread Jan Christoph Ebersbach
On Mon 07-04-2008 13:55 +0200, Joerg van den Hoff wrote:

> question: any chance of making `dwm' remember any `floating'
> positioning information on a per-window basis which would enable
> restoration of positions when coming back to floating layout?

Hi, I'd also like to see such a functionality for the monocle layout ..
but the current layout architecture is not prepared for this. In my
configuration I deactivated the monocle layout and reactivated the
togglemax function that is part of the maximize patch anyway.

Cheers.
-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


Re: [dwm] [patches] Updated pertag, float-border-color, raiselower, tagall, maximize_vert_horz, gridmode, save_floats and moversize

2008-04-08 Thread Jan Christoph Ebersbach
On Mon 07-04-2008 14:41 +0200, Matthias-Christian Ott wrote:

> Jan Christoph Ebersbach <[EMAIL PROTECTED]> wrote:
>
> > Hi folks,
> >
> > I've updated the following patches to the early 5.0 version: [...]
> > save_floats
>
> Did you see the improved version of save_floats I posted some days ago
> on the mailing list?

Thank you for the hint, I'll take a look at it.

-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


[dwm] [patches] Updated pertag, float-border-color, raiselower, tagall, maximize_vert_horz, gridmode, save_floats and moversize

2008-04-06 Thread Jan Christoph Ebersbach
Hi folks,

I've updated the following patches to the early 5.0 version:

pertag
float-border-color
raiselower
tagall
maximize_vert_horz
gridmode
save_floats
moversize

They can be obtained at http://www.e-jc.de/dwm/5.0/.

On Sun 06-04-2008 17:54 +0100, Veselin Kantsev wrote:

> I'm not sure if its a problem with my config, but when I change the
> window layout mode for a certain view, it changes it for the rest of
> the views as well.

The pertag-patch is probably the one you are looking for.

-- 
Jan Christoph Ebersbach
But by the grace of God I am what I am. 1. Cor 15,10


signature.asc
Description: Digital signature


[dwm] [patch] pertag and moveresize

2007-12-02 Thread Jan Christoph Ebersbach
Hi guys,

Just to let you know, I'll not be able to update my patches before
Christmas because of my thesis.

So, I wish you a blessed Christmas season. Cu next year. I'm looking
for to see dwm 5.0 being unleashed :)
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] wiki front

2007-11-12 Thread Jan Christoph Ebersbach
On Sun 11-11-2007 13:19 +0100, Anselm R. Garbe wrote:

> diri has been designed with my observation, that traditional wiki
> implementations suffer from a simple way to browse all pages. Mostly
> this thing is up to all authors of individual pages (they have to add
> links to other pages) - or to the author of a navigation page. In
> diri I replaced this whole process with dynamically creating the
> menu index depending on the path which is browsed. Hence an author
> must only think about a tree-grouping where his page fits best, e.g.
> dwm/pages/funky_new_patch

This functionality is provided by the map-plugin. Together with the
template plugin in looks promising. You just have to figure out how
apply it to every page, automatically.

[[template id=note text="""[[map pages="* and dwm/* and !*/Discussion"]]"""]]

Bye.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] [patch] pertag

2007-11-12 Thread Jan Christoph Ebersbach
On Sun 11-11-2007 17:36 -0500, Jeremy O'Brien wrote:

> Hmm... I'm not sure if I'm doing something wrong here, but I updated
> to the latest hg tip, ran a clean dwm and everything worked fine. Upon
> applying the pertag patch, however, switching layouts causes dwm to
> segfault. Maybe I missed something in my config.h? Are you able to
> reproduce this? Thanks again.

Ups, sorry. One part of the pertag_nmasters patch went into the normal
pertag patch. Please try again.

All patches are also available at http://www.e-jc.de/dwm/4.7.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13
diff -r 767e76426fda dwm.c
--- a/dwm.c	Sat Nov 10 20:21:22 2007 +0100
+++ b/dwm.c	Mon Nov 12 11:17:18 2007 +0100
@@ -125,6 +125,7 @@ void configure(Client *c);
 void configure(Client *c);
 void configurenotify(XEvent *e);
 void configurerequest(XEvent *e);
+void deinitpertag(void);
 void destroynotify(XEvent *e);
 void detach(Client *c);
 void detachstack(Client *c);
@@ -194,11 +195,11 @@ void zoom(const char *arg);
 
 /* variables */
 char stext[256];
-double mwfact;
 int screen, sx, sy, sw, sh, wax, way, waw, wah;
 int (*xerrorxlib)(Display *, XErrorEvent *);
-unsigned int bh, bpos;
+unsigned int bh;
 unsigned int blw = 0;
+unsigned int csel = 0;
 unsigned int numlockmask = 0;
 void (*handler[LASTEvent]) (XEvent *) = {
 	[ButtonPress] = buttonpress,
@@ -226,9 +227,12 @@ Cursor cursor[CurLast];
 Cursor cursor[CurLast];
 Display *dpy;
 DC dc = {0};
-Layout *layout = NULL;
 Window barwin, root;
 Regs *regs = NULL;
+
+unsigned int *bpos;
+unsigned int *ltidxs;
+double *mwfacts;
 
 /* configuration, allows nested code to access above variables */
 #include "config.h"
@@ -276,7 +280,7 @@ arrange(void) {
 			unban(c);
 		else
 			ban(c);
-	layout->arrange();
+	layouts[ltidxs[csel]].arrange();
 	focus(NULL);
 	restack();
 }
@@ -337,20 +341,20 @@ buttonpress(XEvent *e) {
 		if(CLEANMASK(ev->state) != MODKEY)
 			return;
 		if(ev->button == Button1) {
-			if((layout->arrange == floating) || c->isfloating)
+			if((layouts[ltidxs[csel]].arrange == floating) || c->isfloating)
 restack();
 			else
 togglefloating(NULL);
 			movemouse(c);
 		}
 		else if(ev->button == Button2) {
-			if((floating != layout->arrange) && c->isfloating)
+			if((floating != layouts[ltidxs[csel]].arrange) && c->isfloating)
 togglefloating(NULL);
 			else
 zoom(NULL);
 		}
 		else if(ev->button == Button3 && !c->isfixed) {
-			if((floating == layout->arrange) || c->isfloating)
+			if((floating == layouts[ltidxs[csel]].arrange) || c->isfloating)
 restack();
 			else
 togglefloating(NULL);
@@ -395,6 +399,7 @@ cleanup(void) {
 	XFreeCursor(dpy, cursor[CurMove]);
 	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
 	XSync(dpy, False);
+	deinitpertag();
 }
 
 void
@@ -466,7 +471,7 @@ configurerequest(XEvent *e) {
 		c->ismax = False;
 		if(ev->value_mask & CWBorderWidth)
 			c->border = ev->border_width;
-		if(c->isfixed || c->isfloating || (floating == layout->arrange)) {
+		if(c->isfixed || c->isfloating || (floating == layouts[ltidxs[csel]].arrange)) {
 			if(ev->value_mask & CWX)
 c->x = ev->x;
 			if(ev->value_mask & CWY)
@@ -499,6 +504,14 @@ configurerequest(XEvent *e) {
 		XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
 	}
 	XSync(dpy, False);
+}
+
+void
+deinitpertag(void)
+{
+	free(bpos);
+	free(ltidxs);
+	free(mwfacts);
 }
 
 void
@@ -547,7 +560,7 @@ drawbar(void) {
 		dc.x += dc.w;
 	}
 	dc.w = blw;
-	drawtext(layout->symbol, dc.norm);
+	drawtext(layouts[ltidxs[csel]].symbol, dc.norm);
 	x = dc.x + dc.w;
 	dc.w = textw(stext);
 	dc.x = sw - dc.w;
@@ -1264,9 +1277,9 @@ restack(void) {
 	drawbar();
 	if(!sel)
 		return;
-	if(sel->isfloating || (layout->arrange == floating))
+	if(sel->isfloating || (layouts[ltidxs[csel]].arrange == floating))
 		XRaiseWindow(dpy, sel->win);
-	if(layout->arrange != floating) {
+	if(layouts[ltidxs[csel]].arrange != floating) {
 		wc.stack_mode = Below;
 		wc.sibling = barwin;
 		if(!sel->isfloating) {
@@ -1384,8 +1397,8 @@ setlayout(const char *arg) {
 	unsigned int i;
 
 	if(!arg) {
-		if(++layout == &layouts[LENGTH(layouts)])
-			layout = &layouts[0];
+		if(&layouts[++ltidxs[csel]] == &layouts[LENGTH(layouts)])
+			ltidxs[csel] = 0;;
 	}
 	else {
 		for(i = 0; i < LENGTH(layouts); i++)
@@ -1393,7 +1406,7 @@ setlayout(const char *arg) {
 break;
 		if(i == LENGTH(layouts))
 			return;
-		layout = &layouts[i];
+		ltidxs[csel] = i;
 	}
 	if(sel)
 		arrange();
@@ -1409,16 +1422,16 @@ setmwfact(const char *arg) {
 		return;
 	/* arg handling, manipulate mwfact */
 	if(arg == NULL)
-		mwfact = MWFACT;
+		mwfacts[csel] = MWFACT;
 	else if(sscanf(arg, "%lf", &delta) == 1) {
 		if(arg[0] == 

Re: [dwm] [patch] pertag

2007-11-11 Thread Jan Christoph Ebersbach
On Tue 06-11-2007 15:27 -0500, Jeremy O'Brien wrote:

> I just found a bug. Your patch gets confused if you try any
> viewprevtag() magic. For example, turn the bar off on tag 1, and
> viewprevtag(). The bar stays magically turned off. Probably not the
> intended behavior. :) Thank you otherwise for your patch!

I fixed the bug and updated float-border, moveresize, nmaster and tagall
to 4.7.

Good night.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13
diff -r ac233c362502 dwm.c
--- a/dwm.c	Sat Sep 22 21:55:19 2007 +0200
+++ b/dwm.c	Sun Sep 23 01:42:54 2007 +0200
@@ -169,6 +169,7 @@ void setup(void);
 void setup(void);
 void spawn(const char *arg);
 void tag(const char *arg);
+void tagall(const char *arg);
 unsigned int textnw(const char *text, unsigned int len);
 unsigned int textw(const char *text);
 void tile(void);
@@ -1549,6 +1550,30 @@ tag(const char *arg) {
 	arrange();
 }
 
+void
+tagall(const char *arg) {
+	if (!clients)
+		return;
+	int floating_only = arg && arg[0] == 'F' ? 1 : 0;
+	int tag = arg ? atoi(arg + floating_only) : 0;
+	int j;
+	Client* c;
+	if(tag >= 0 && tag < LENGTH(tags))
+		for(c = clients; c; c = c->next)
+		{
+			if(!floating_only || c->isfloating)
+for(j = 0; j < LENGTH(tags); j++)
+{
+	if(c->tags[j] && seltags[j])
+	{
+		c->tags[j] = !c->tags[j];
+		c->tags[tag-1] = True;
+	}
+}
+		}
+	arrange();
+}
+
 unsigned int
 textnw(const char *text, unsigned int len) {
 	XRectangle r;
diff -r 767e76426fda dwm.c
--- a/dwm.c	Sat Nov 10 20:21:22 2007 +0100
+++ b/dwm.c	Sun Nov 11 22:38:11 2007 +0100
@@ -125,6 +125,7 @@ void configure(Client *c);
 void configure(Client *c);
 void configurenotify(XEvent *e);
 void configurerequest(XEvent *e);
+void deinitpertag(void);
 void destroynotify(XEvent *e);
 void detach(Client *c);
 void detachstack(Client *c);
@@ -194,11 +195,11 @@ void zoom(const char *arg);
 
 /* variables */
 char stext[256];
-double mwfact;
 int screen, sx, sy, sw, sh, wax, way, waw, wah;
 int (*xerrorxlib)(Display *, XErrorEvent *);
-unsigned int bh, bpos;
+unsigned int bh;
 unsigned int blw = 0;
+unsigned int csel = 0;
 unsigned int numlockmask = 0;
 void (*handler[LASTEvent]) (XEvent *) = {
 	[ButtonPress] = buttonpress,
@@ -229,6 +230,11 @@ Layout *layout = NULL;
 Layout *layout = NULL;
 Window barwin, root;
 Regs *regs = NULL;
+
+unsigned int *bpos;
+unsigned int *ltidxs;
+unsigned int *nmasters;
+double *mwfacts;
 
 /* configuration, allows nested code to access above variables */
 #include "config.h"
@@ -276,7 +282,7 @@ arrange(void) {
 			unban(c);
 		else
 			ban(c);
-	layout->arrange();
+	layouts[ltidxs[csel]].arrange();
 	focus(NULL);
 	restack();
 }
@@ -337,20 +343,20 @@ buttonpress(XEvent *e) {
 		if(CLEANMASK(ev->state) != MODKEY)
 			return;
 		if(ev->button == Button1) {
-			if((layout->arrange == floating) || c->isfloating)
+			if((layouts[ltidxs[csel]].arrange == floating) || c->isfloating)
 restack();
 			else
 togglefloating(NULL);
 			movemouse(c);
 		}
 		else if(ev->button == Button2) {
-			if((floating != layout->arrange) && c->isfloating)
+			if((floating != layouts[ltidxs[csel]].arrange) && c->isfloating)
 togglefloating(NULL);
 			else
 zoom(NULL);
 		}
 		else if(ev->button == Button3 && !c->isfixed) {
-			if((floating == layout->arrange) || c->isfloating)
+			if((floating == layouts[ltidxs[csel]].arrange) || c->isfloating)
 restack();
 			else
 togglefloating(NULL);
@@ -395,6 +401,7 @@ cleanup(void) {
 	XFreeCursor(dpy, cursor[CurMove]);
 	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
 	XSync(dpy, False);
+	deinitpertag();
 }
 
 void
@@ -466,7 +473,7 @@ configurerequest(XEvent *e) {
 		c->ismax = False;
 		if(ev->value_mask & CWBorderWidth)
 			c->border = ev->border_width;
-		if(c->isfixed || c->isfloating || (floating == layout->arrange)) {
+		if(c->isfixed || c->isfloating || (floating == layouts[ltidxs[csel]].arrange)) {
 			if(ev->value_mask & CWX)
 c->x = ev->x;
 			if(ev->value_mask & CWY)
@@ -499,6 +506,15 @@ configurerequest(XEvent *e) {
 		XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
 	}
 	XSync(dpy, False);
+}
+
+void
+deinitpertag(void)
+{
+	free(bpos);
+	free(ltidxs);
+	free(mwfacts);
+	free(nmasters);
 }
 
 void
@@ -547,7 +563,7 @@ drawbar(void) {
 		dc.x += dc.w;
 	}
 	dc.w = blw;
-	drawtext(layout->symbol, dc.norm);
+	drawtext(layouts[ltidxs[csel]].symbol, dc.norm);
 	x = dc.x + dc.w;
 	dc.w = textw(stext);
 	dc.x = sw - dc.w;
@@ -1264,9 +1280,9 @@ restack(void) {
 	drawbar();
 	if(!sel)
 		return;
-	if(sel->isfloating || (layout->arrange == floating))
+	if(sel->isfloating || (layouts[ltidxs[csel]].arrange == floating))
 		XRaiseWindow(dpy, sel->wi

Re: [dwm] [patch] pertag

2007-10-27 Thread Jan Christoph Ebersbach
On Sat 27-10-2007 11:01 +0200, Jan Christoph Ebersbach wrote:

> I've decided to abandon the taglayouts patch in favour of a more
> general pertag patch.
>
> Currently, the patch keeps layout, mwfact, barpos and nmaster (if
> installed) per tag.

I switched the patch back from static to dynamic declaration because of
layout patches that use bpos, nmaster ...
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13
diff -r 0eea3c24456e dwm.c
--- a/dwm.c	Sat Oct 27 11:46:31 2007 +0200
+++ b/dwm.c	Sat Oct 27 11:48:49 2007 +0200
@@ -124,6 +124,7 @@ void configure(Client *c);
 void configure(Client *c);
 void configurenotify(XEvent *e);
 void configurerequest(XEvent *e);
+void deinitpertag(void);
 void destroynotify(XEvent *e);
 void detach(Client *c);
 void detachstack(Client *c);
@@ -194,13 +195,11 @@ void zoom(const char *arg);
 
 /* variables */
 char stext[256];
-double mwfact;
-unsigned int nmaster;
 int screen, sx, sy, sw, sh, wax, way, waw, wah;
 int (*xerrorxlib)(Display *, XErrorEvent *);
-unsigned int bh, bpos;
+unsigned int bh;
 unsigned int blw = 0;
-unsigned int ltidx = 0; /* default */
+unsigned int csel = 0;
 unsigned int nlayouts = 0;
 unsigned int nrules = 0;
 unsigned int numlockmask = 0;
@@ -231,6 +230,11 @@ Window barwin, root;
 Window barwin, root;
 Regs *regs = NULL;
 
+unsigned int *bpos;
+unsigned int *ltidxs;
+unsigned int *nmasters;
+double *mwfacts;
+
 /* configuration, allows nested code to access above variables */
 #include "config.h"
 
@@ -279,7 +283,7 @@ arrange(void) {
 			unban(c);
 		else
 			ban(c);
-	layouts[ltidx].arrange();
+	layouts[ltidxs[csel]].arrange();
 	focus(NULL);
 	restack();
 }
@@ -398,6 +402,7 @@ cleanup(void) {
 	XFreeCursor(dpy, cursor[CurMove]);
 	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
 	XSync(dpy, False);
+	deinitpertag();
 }
 
 void
@@ -506,6 +511,15 @@ configurerequest(XEvent *e) {
 }
 
 void
+deinitpertag(void)
+{
+	free(bpos);
+	free(ltidxs);
+	free(mwfacts);
+	free(nmasters);
+}
+
+void
 destroynotify(XEvent *e) {
 	Client *c;
 	XDestroyWindowEvent *ev = &e->xdestroywindow;
@@ -551,7 +565,7 @@ drawbar(void) {
 		dc.x += dc.w;
 	}
 	dc.w = blw;
-	drawtext(layouts[ltidx].symbol, dc.norm);
+	drawtext(layouts[ltidxs[csel]].symbol, dc.norm);
 	x = dc.x + dc.w;
 	dc.w = textw(stext);
 	dc.x = sw - dc.w;
@@ -897,7 +911,7 @@ Bool
 Bool
 isarrange(void (*func)())
 {
-	return func == layouts[ltidx].arrange;
+	return func == layouts[ltidxs[csel]].arrange;
 }
 
 Bool
@@ -1380,8 +1394,8 @@ setlayout(const char *arg) {
 	unsigned int i;
 
 	if(!arg) {
-		if(++ltidx == nlayouts)
-			ltidx = 0;;
+		if(++ltidxs[csel] == nlayouts)
+			ltidxs[csel] = 0;;
 	}
 	else {
 		for(i = 0; i < nlayouts; i++)
@@ -1389,7 +1403,7 @@ setlayout(const char *arg) {
 break;
 		if(i == nlayouts)
 			return;
-		ltidx = i;
+		ltidxs[csel] = i;
 	}
 	if(sel)
 		arrange();
@@ -1405,16 +1419,16 @@ setmwfact(const char *arg) {
 		return;
 	/* arg handling, manipulate mwfact */
 	if(arg == NULL)
-		mwfact = MWFACT;
+		mwfacts[csel] = MWFACT;
 	else if(1 == sscanf(arg, "%lf", &delta)) {
 		if(arg[0] == '+' || arg[0] == '-')
-			mwfact += delta;
+			mwfacts[csel] += delta;
 		else
-			mwfact = delta;
-		if(mwfact < 0.1)
-			mwfact = 0.1;
-		else if(mwfact > 0.9)
-			mwfact = 0.9;
+			mwfacts[csel] = delta;
+		if(mwfacts[csel] < 0.1)
+			mwfacts[csel] = 0.1;
+		else if(mwfacts[csel] > 0.9)
+			mwfacts[csel] = 0.9;
 	}
 	arrange();
 }
@@ -1426,12 +1440,12 @@ setnmaster(const char *arg) {
 	if(!isarrange(tile))
 		return;
 	if(!arg)
-		nmaster = NMASTER;
+		nmasters[csel] = NMASTER;
 	else {
 		i = atoi(arg);
-		if((nmaster + i) < 1 || wah / (nmaster + i) <= 2 * BORDERPX)
+		if((nmasters[csel] + i) < 1 || wah / (nmasters[csel] + i) <= 2 * BORDERPX)
 			return;
-		nmaster += i;
+		nmasters[csel] += i;
 	}
 	if(sel)
 		arrange();
@@ -1501,8 +1515,15 @@ setup(void) {
 	dc.h = bh = dc.font.height + 2;
 
 	/* init layouts */
-	mwfact = MWFACT;
-	nmaster = NMASTER;
+	ltidxs = (unsigned int*)emallocz(sizeof(unsigned int) * NTAGS);
+	mwfacts = (double*)emallocz(sizeof(double) * NTAGS);
+	nmasters = (unsigned int*)emallocz(sizeof(unsigned int) * NTAGS);
+	for(i = 0; i < NTAGS; i++)
+	{
+		ltidxs[i] = 0;
+		mwfacts[i] = MWFACT;
+		nmasters[i] = NMASTER;
+	}
 	nlayouts = sizeof layouts / sizeof layouts[0];
 	for(blw = i = 0; i < nlayouts; i++) {
 		j = textw(layouts[i].symbol);
@@ -1511,7 +1532,9 @@ setup(void) {
 	}
 
 	/* init bar */
-	bpos = BARPOS;
+	bpos = (unsigned int*)emallocz(sizeof(unsigned int) * NTAGS);
+	for(i = 0; i < NTAGS; i++)
+		bpos[i] = BARPOS;
 	wa.override_redirect = 1;
 	wa.background_pixmap = ParentRelative;
 	wa.event_mask = ButtonPressMask | ExposureMask;
@@ -1593,10 +1616,10 @@ tile(void) {
 		n++;
 
 	/* window geoms */
-	mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster;
-

[dwm] [patch] pertag

2007-10-27 Thread Jan Christoph Ebersbach
On Fri 26-10-2007 17:09 +0100, Chris Webb wrote:

> Incidentally, something else needed for consistency when implementing
> taglayouts-type behaviour is to index all the layout parameters like
> mwfact, nmaster (if you have it) and nstack/ncols/nrows (if you have
> any of them). I don't think this patch currently does this?

Hi,

I've decided to abandon the taglayouts patch in favour of a more general
pertag patch.

Currently, the patch keeps layout, mwfact, barpos and nmaster (if
installed) per tag.

To make the pertag behaviour more consistent I think about synchronizing
the values if multiple tags are selected.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13
diff -r 78d663b698f0 dwm.c
--- a/dwm.c	Thu Oct 25 20:24:59 2007 +0200
+++ b/dwm.c	Sat Oct 27 10:37:04 2007 +0200
@@ -193,12 +193,11 @@ void zoom(const char *arg);
 
 /* variables */
 char stext[256];
-double mwfact;
 int screen, sx, sy, sw, sh, wax, way, waw, wah;
 int (*xerrorxlib)(Display *, XErrorEvent *);
-unsigned int bh, bpos;
+unsigned int bh;
 unsigned int blw = 0;
-unsigned int ltidx = 0; /* default */
+unsigned int csel = 0;
 unsigned int nlayouts = 0;
 unsigned int nrules = 0;
 unsigned int numlockmask = 0;
@@ -235,6 +234,9 @@ Regs *regs = NULL;
 #define NTAGS (sizeof tags / sizeof tags[0])
 Bool seltags[NTAGS] = {[0] = True};
 Bool prevtags[NTAGS] = {[0] = True};
+unsigned int bpos[NTAGS];
+unsigned int ltidxs[NTAGS];
+double mwfacts[NTAGS];
 
 /* function implementations */
 void
@@ -277,7 +279,7 @@ arrange(void) {
 			unban(c);
 		else
 			ban(c);
-	layouts[ltidx].arrange();
+	layouts[ltidxs[csel]].arrange();
 	focus(NULL);
 	restack();
 }
@@ -549,7 +551,7 @@ drawbar(void) {
 		dc.x += dc.w;
 	}
 	dc.w = blw;
-	drawtext(layouts[ltidx].symbol, dc.norm);
+	drawtext(layouts[ltidxs[csel]].symbol, dc.norm);
 	x = dc.x + dc.w;
 	dc.w = textw(stext);
 	dc.x = sw - dc.w;
@@ -895,7 +897,7 @@ Bool
 Bool
 isarrange(void (*func)())
 {
-	return func == layouts[ltidx].arrange;
+	return func == layouts[ltidxs[csel]].arrange;
 }
 
 Bool
@@ -1378,8 +1380,8 @@ setlayout(const char *arg) {
 	unsigned int i;
 
 	if(!arg) {
-		if(++ltidx == nlayouts)
-			ltidx = 0;;
+		if(++ltidxs[csel] == nlayouts)
+			ltidxs[csel] = 0;;
 	}
 	else {
 		for(i = 0; i < nlayouts; i++)
@@ -1387,7 +1389,7 @@ setlayout(const char *arg) {
 break;
 		if(i == nlayouts)
 			return;
-		ltidx = i;
+		ltidxs[csel] = i;
 	}
 	if(sel)
 		arrange();
@@ -1403,16 +1405,16 @@ setmwfact(const char *arg) {
 		return;
 	/* arg handling, manipulate mwfact */
 	if(arg == NULL)
-		mwfact = MWFACT;
+		mwfacts[csel] = MWFACT;
 	else if(1 == sscanf(arg, "%lf", &delta)) {
 		if(arg[0] == '+' || arg[0] == '-')
-			mwfact += delta;
+			mwfacts[csel] += delta;
 		else
-			mwfact = delta;
-		if(mwfact < 0.1)
-			mwfact = 0.1;
-		else if(mwfact > 0.9)
-			mwfact = 0.9;
+			mwfacts[csel] = delta;
+		if(mwfacts[csel] < 0.1)
+			mwfacts[csel] = 0.1;
+		else if(mwfacts[csel] > 0.9)
+			mwfacts[csel] = 0.9;
 	}
 	arrange();
 }
@@ -1479,7 +1481,11 @@ setup(void) {
 	dc.h = bh = dc.font.height + 2;
 
 	/* init layouts */
-	mwfact = MWFACT;
+	for(i = 0; i < NTAGS; i++)
+	{
+		ltidxs[i] = 0;
+		mwfacts[i] = MWFACT;
+	}
 	nlayouts = sizeof layouts / sizeof layouts[0];
 	for(blw = i = 0; i < nlayouts; i++) {
 		j = textw(layouts[i].symbol);
@@ -1488,7 +1494,8 @@ setup(void) {
 	}
 
 	/* init bar */
-	bpos = BARPOS;
+	for(i = 0; i < NTAGS; i++)
+		bpos[i] = BARPOS;
 	wa.override_redirect = 1;
 	wa.background_pixmap = ParentRelative;
 	wa.event_mask = ButtonPressMask | ExposureMask;
@@ -1570,7 +1577,7 @@ tile(void) {
 		n++;
 
 	/* window geoms */
-	mw = (n == 1) ? waw : mwfact * waw;
+	mw = (n == 1) ? waw : mwfacts[csel] * waw;
 	th = (n > 1) ? wah / (n - 1) : 0;
 	if(n > 1 && th < bh)
 		th = wah;
@@ -1606,10 +1613,10 @@ tile(void) {
 
 void
 togglebar(const char *arg) {
-	if(bpos == BarOff)
-		bpos = (BARPOS == BarOff) ? BarTop : BARPOS;
+	if(bpos[csel] == BarOff)
+		bpos[csel] = (BARPOS == BarOff) ? BarTop : BARPOS;
 	else
-		bpos = BarOff;
+		bpos[csel] = BarOff;
 	updatebarpos();
 	arrange();
 }
@@ -1673,8 +1680,12 @@ toggleview(const char *arg) {
 	i = idxoftag(arg);
 	seltags[i] = !seltags[i];
 	for(j = 0; j < NTAGS && !seltags[j]; j++);
-	if(j == NTAGS)
+	if(j == NTAGS) {
 		seltags[i] = True; /* at least one tag must be viewed */
+		j = i;
+	}
+	if(csel == i)
+		csel = j;
 	arrange();
 }
 
@@ -1726,7 +1737,7 @@ updatebarpos(void) {
 	way = sy;
 	wah = sh;
 	waw = sw;
-	switch(bpos) {
+	switch(bpos[csel]) {
 	default:
 		wah -= bh;
 		way += bh;
@@ -1836,12 +1847,16 @@ xerrorstart(Display *dsply, XErrorEvent 
 
 void
 view(const char *arg) {
-	unsigned int i;
+	unsigned int i, prevcsel;
 
 	memcpy(prevtags, seltags, sizeof seltags);
 	for(i = 0; i < NTAGS; i++)
 		seltags[i] = arg == NULL;
 	seltags[idxoftag(arg)] = Tr

Re: [dwm] Taglayouts poll

2007-10-26 Thread Jan Christoph Ebersbach
On Fri 26-10-2007 16:56 +0200, pancake wrote:

> I never had the need to use this patch. But for my eyes this patch needs
> more work. it's using dynamic memory allocation for something that it is
> already static and defined in config.h.
>
> -unsigned int* ltidxs;
> +unsigned int ltidxs[NTAGS];

Thank you, I've updated my version.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] Taglayouts poll

2007-10-26 Thread Jan Christoph Ebersbach
On Fri 26-10-2007 17:09 +0100, Chris Webb wrote:

> Incidentally, something else needed for consistency when implementing
> taglayouts-type behaviour is to index all the layout parameters like
> mwfact, nmaster (if you have it) and nstack/ncols/nrows (if you have
> any of them). I don't think this patch currently does this?

You are right, the patch doesn't do this at the moment and it's one
thing that I really miss.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


[dwm] [patch] Updated nmaster, tag all and taglayouts to dwm 4.6

2007-10-25 Thread Jan Christoph Ebersbach
Hi,

I've updated the the following patches to dwm 4.6:
- nmaster
- tag all
- taglayouts

Together with all the other patches I use you can find them at
http://e-jc.de/dwm/4.6/official_release/

Cheers.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


[dwm] Updated patches section in wiki

2007-10-23 Thread Jan Christoph Ebersbach
Hi,

I've updated the download sections of the following patches:
- fibonacci
- float border color (new)
- gridmode
- moveresize/maximize
- save floats
- tag all (new)
- taglayouts (new)

Please have a look and let me know if there is something wrong.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] RESIZEHINTS broken?

2007-10-23 Thread Jan Christoph Ebersbach
On Tue 23-10-2007 17:33 +0200, Sander van Dijk wrote:

> On 10/23/07, pancake <[EMAIL PROTECTED]> wrote:
>
> > When did you find this feature useful?
>
> Don't know about Arg, but I think it has been useful ever since there
> were apps (xterm for instance) that misbehave without it, i.e. always.
> Having it optional (in tiled mode) would be ok, dropping it would be a
> step in the wrong direction.

Yes, that would be really annoying to not have it anymore. I.e. gvim
displays only half of it's command line without RESIZEHINTS.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] Triple Screen xorg.conf ?

2007-10-15 Thread Jan Christoph Ebersbach
On Mon 15-10-2007 11:11, Engin Tola wrote:

> A A <[EMAIL PROTECTED]> writes:
>
> > Anyone out there have a triple screen xorg.conf (individual screens)
> > running DWM that you would be willing to share with me?  I can't
> > seem to get DWM to treat each screen as a single desktop for some
> > reason.
> >
> > Thanks!
>
> I got a 2 display configuration without using awesome if you're
> interested. (It basically launches 2 dwm in different displays and you
> cannot move windows around but I also got a small code I use to move
> between displays for keyboard-based switching so moving is not awkward
> )
>
> I guess you can modify this to three displays...

Sounds good but where can I find it?
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] View-previous-tags patch ported to dwm-4.5.

2007-10-08 Thread Jan Christoph Ebersbach
On Mon 08-10-2007 13:25, Antoni Grzymala wrote:

> I really think it would be very useful to have that functionality in
> mainline dwm. It's extremely productive. Arg, what do you think?

Vote: thumbs up.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] Taglayouts patch is where...?

2007-10-06 Thread Jan Christoph Ebersbach
On Fri 05-10-2007 22:08, Jeremy O'Brien wrote:

> I can't for the life of me find the taglayouts patch for dwm-4.5. I
> had it on my previous computer but it is not currently in my
> possession.  Does anyone have a link to it? Thank you very much...

Not exactly to the original author but to my page:
http://www.e-jc.de/dwm/4.5/dwm-4.5-tip_ac233c362502-taglayouts.diff

You can get the patch for other versions, too: http://www.e-jc.de/dwm
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] On the fly tiling for floating layout

2007-10-04 Thread Jan Christoph Ebersbach
On Thu 04-10-2007 17:56, Alpt wrote:

>   By pressing (right)Crtl+(left)Alt+Tab all the windows of the
>   current Y are ordered with the tiling algorithm of dwm. Re-pressing
>   (right)Crtl+(left)Alt+Tab, the windows will be restored to their
>   pre-tile configuration.  This feature is useful to get a quick
>   glimpse of the current Y.
>
>
> What do you think? Would a patch for dwm be appreciated?

I like the idea. Normally, I have just a few floating windows on each tag
but gimp is a good opportunity to use such functionality.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] [PATCH] An experiment with X resources

2007-09-25 Thread Jan Christoph Ebersbach
On Tue 25-09-2007 14:34, Anselm R. Garbe wrote:

> I implemented tag/floating state preservation as prototype shortly
> before dwm 4.4 appeared. However it made the code too complex for my
> taste for a rarely used functionality. I prefer using hibernation
> technologies instead of restarting dwm. And once your setup settled
> there is no need to restart dwm anyways.

Yes, you are right, I also use hibernate .. but I'd like to keep up with
the dwm development and therefore I have to restart it ~twice a month ;)
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] [PATCH] An experiment with X resources

2007-09-25 Thread Jan Christoph Ebersbach
On Tue 25-09-2007 11:41, WyrmSkull wrote:

> What about having some default bash scripts keybinding?  MODKEY |
> ShiftMask, XK_(F1 to F10), spawn, "exec bash_script_(01 to 10).sh"
> 0 byte files don't take too much space, 0 LOC, and can be edited
> runtime.
>
> You can add "edit_keybind_(F1 to F10)" dmenu entries and a "change
> theme" one.
>
> I think that DWM is ready to face those problems. You just need the
> right external tools.

I use dwm the same way. An external script gives enough flexibility to
quickly adjust the executed commands.

Every other setting can just be changed by restarting dwm. The bad thing
about it is that all windows lose their tag, maximized state and
floating/tiled mode :-/ Instead of using Xresources, dwm could solve
this issue by saving the state in the window's Xproperty.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


Re: [dwm] spacing bewteen windows

2007-09-23 Thread Jan Christoph Ebersbach
On Sun 23-09-2007 09:58, Ricardo Martins wrote:

> Change
>
>   #define RESIZEHINTS True
>
> to
>
>   #define RESIZEHINTS False
>
> then recompile.

Thanks, that looks better :)
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


[dwm] spacing bewteen windows

2007-09-23 Thread Jan Christoph Ebersbach
Hi,

With the newest hg tip I have a spacing between windows in tiled mode.
Actually, it only applies to certain windows like urxvt and gvim but not
to konqueror.

http://www.e-jc.de/dwm/ok.png
http://www.e-jc.de/dwm/spacing.png
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13


signature.asc
Description: Digital signature


[dwm] reload, save_floats, tagall, raiselower, prevtags and float-border-color2 for dwm 4.5

2007-09-22 Thread Jan Christoph Ebersbach
Hi,

I've updated the named patches for dwm 4.5.

The patches are also online available:
http://www.e-jc.de/dwm

Have fun.
-- 
Jan Christoph Ebersbach
Fear God and keep his commandments, for this is the whole duty of man.
Eccl 12,13
diff -r ac233c362502 config.h
--- a/config.h	Sat Sep 22 21:55:19 2007 +0200
+++ b/config.h	Sun Sep 23 01:41:37 2007 +0200
@@ -10,6 +10,8 @@
 #define SELBORDERCOLOR		"#f00"
 #define SELBGCOLOR		"#00f"
 #define SELFGCOLOR		"#fff"
+#define FLOATNORMBORDERCOLOR	NORMBORDERCOLOR
+#define FLOATSELBORDERCOLOR	SELBORDERCOLOR
 
 /* tagging */
 const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
diff -r ac233c362502 dwm.c
--- a/dwm.c	Sat Sep 22 21:55:19 2007 +0200
+++ b/dwm.c	Sun Sep 23 01:41:37 2007 +0200
@@ -50,7 +50,7 @@
 /* enums */
 enum { BarTop, BarBot, BarOff };			/* bar position */
 enum { CurNormal, CurResize, CurMove, CurLast };	/* cursor */
-enum { ColBorder, ColFG, ColBG, ColLast };		/* color */
+enum { ColBorder, ColFG, ColBG, ColBorderFloat, ColLast };		/* color */
 enum { NetSupported, NetWMName, NetLast };		/* EWMH atoms */
 enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */
 
@@ -688,7 +688,10 @@ focus(Client *c) {
 		for(c = stack; c && !isvisible(c); c = c->snext);
 	if(sel && sel != c) {
 		grabbuttons(sel, False);
-		XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
+		if(sel->isfloating)
+			XSetWindowBorder(dpy, sel->win, dc.norm[ColBorderFloat]);
+		else
+			XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
 	}
 	if(c) {
 		detachstack(c);
@@ -700,7 +703,10 @@ focus(Client *c) {
 	if(!selscreen)
 		return;
 	if(c) {
-		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
+		if(c->isfloating)
+			XSetWindowBorder(dpy, c->win, dc.sel[ColBorderFloat]);
+		else
+			XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
 		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
 	}
 	else
@@ -1474,9 +1480,11 @@ setup(void) {
 	dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
 	dc.norm[ColBG] = getcolor(NORMBGCOLOR);
 	dc.norm[ColFG] = getcolor(NORMFGCOLOR);
+	dc.norm[ColBorderFloat] = getcolor(FLOATNORMBORDERCOLOR);
 	dc.sel[ColBorder] = getcolor(SELBORDERCOLOR);
 	dc.sel[ColBG] = getcolor(SELBGCOLOR);
 	dc.sel[ColFG] = getcolor(SELFGCOLOR);
+	dc.sel[ColBorderFloat] = getcolor(FLOATSELBORDERCOLOR);
 	initfont(FONT);
 	dc.h = bh = dc.font.height + 2;
 
diff -r ce55dc65c72a dwm.c
--- a/dwm.c	Sat Sep 22 23:20:23 2007 +0200
+++ b/dwm.c	Sat Sep 22 23:26:59 2007 +0200
@@ -60,6 +60,7 @@ struct Client {
 	char name[256];
 	int x, y, w, h;
 	int rx, ry, rw, rh; /* revert geometry */
+	int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 	int minax, maxax, minay, maxay;
 	long flags; 
@@ -728,7 +729,13 @@ 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);
+		{
+			if(!c->isfloating)
+/*restore last known float dimensions*/
+resize(c, c->sfx, c->sfy, c->sfw, c->sfh, True);
+			else
+resize(c, c->x, c->y, c->w, c->h, True);
+		}
 }
 
 void
@@ -1082,6 +1089,10 @@ manage(Window w, XWindowAttributes *wa) 
 	XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
 	configure(c); /* propagates border_width, if size doesn't change */
 	updatesizehints(c);
+	c->sfx = c->x;
+	c->sfy = c->y;
+	c->sfw = c->w;
+	c->sfh = c->h;
 	XSelectInput(dpy, w,
 		StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
 	grabbuttons(c, False);
@@ -1722,7 +1733,15 @@ togglefloating(const char *arg) {
 		return;
 	sel->isfloating = !sel->isfloating;
 	if(sel->isfloating)
-		resize(sel, sel->x, sel->y, sel->w, sel->h, True);
+		/*restore last known float dimensions*/
+		resize(sel, sel->sfx, sel->sfy, sel->sfw, sel->sfh, True);
+	else {
+		/*save last known float dimensions*/
+		sel->sfx = sel->x;
+		sel->sfy = sel->y;
+		sel->sfw = sel->w;
+		sel->sfh = sel->h;
+	}
 	arrange();
 }
 
diff -r ac233c362502 dwm.c
--- a/dwm.c	Sat Sep 22 21:55:19 2007 +0200
+++ b/dwm.c	Sun Sep 23 01:42:54 2007 +0200
@@ -169,6 +169,7 @@ void setup(void);
 void setup(void);
 void spawn(const char *arg);
 void tag(const char *arg);
+void tagall(const char *arg);
 unsigned int textnw(const char *text, unsigned int len);
 unsigned int textw(const char *text);
 void tile(void);
@@ -1549,6 +1550,30 @@ tag(const char *arg) {
 	arrange();
 }
 
+void
+tagall(const char *arg) {
+	if (!clients)
+		return;
+	int floating_only = arg && arg[0] == 'F' ? 1 : 0;
+	int i = arg ? atoi(arg + floating_only) : 0;
+	int j;
+	Client* c;
+	if(i >= 0 && i < ntags)
+		for(c = clients; c && c->

Re: [dwm] Keyboard control in floating mode

2007-08-24 Thread Jan Christoph Ebersbach
On Fri 24-08-2007 20:56, Alessandro Dotti Contra wrote:

> On Fri, Aug 24, 2007 at 08:44:03PM +0200, pancake wrote:  |There's
> a patch called moveresize that allows you to do this: here's if you
> |can't find't anywhere. but i think it's in the kiwi.

I've attached the current version of moveresize and another patch to
do vertical/horziontal maximization of a window.
-- 
Jan Christoph Ebersbach
Have you ever read God's love letter to you? http://www.gottkennen.com/
diff -r 45ab12331044 config.default.h
--- a/config.default.h	Wed Aug 22 21:35:22 2007 +0200
+++ b/config.default.h	Wed Aug 22 21:50:15 2007 +0200
@@ -103,6 +103,10 @@ Key keys[] = { \
 	{ MODKEY|ShiftMask,		XK_l,		moveresize,		"0x 0y 25w 0h" }, \
 	{ MODKEY|ShiftMask,		XK_j,		moveresize,		"0x 0y 0w 25h" }, \
 	{ MODKEY|ShiftMask,		XK_k,		moveresize,		"0x 0y 0w -25h" }, \
+	{ MODKEY|ControlMask|ShiftMask,			XK_h,		togglehorizontalmax,	NULL }, \
+	{ MODKEY|ControlMask|ShiftMask,			XK_l,		togglehorizontalmax,	NULL }, \
+	{ MODKEY|ControlMask|ShiftMask,			XK_j,		toggleverticalmax,	NULL }, \
+	{ MODKEY|ControlMask|ShiftMask,			XK_k,		toggleverticalmax,	NULL }, \
 	{ MODKEY|ShiftMask,		XK_F1,		tagall,		"F1" }, \
 	{ MODKEY|ShiftMask,		XK_F2,		tagall,		"F2" }, \
 	{ MODKEY|ShiftMask,		XK_F3,		tagall,		"F3" }, \
diff -r 45ab12331044 dwm.h
--- a/dwm.h	Wed Aug 22 21:35:22 2007 +0200
+++ b/dwm.h	Wed Aug 22 21:50:16 2007 +0200
@@ -141,6 +141,8 @@ void togglebar(const char *arg);	/* show
 void togglebar(const char *arg);	/* shows/hides the bar */
 void togglefloating(const char *arg);	/* toggles sel between floating/tiled state */
 void togglemax(const char *arg);	/* toggles maximization of floating client */
+void togglehorizontalmax(const char *arg);		/* toggles horizontal maximization of floating client */
+void toggleverticalmax(const char *arg);		/* toggles vertical maximization of floating client */
 void toggletag(const char *arg);	/* toggles sel tags with arg's index */
 void toggleview(const char *arg);	/* toggles the tag with arg's index (in)visible */
 void updatebarpos(void);		/* updates the bar position */
diff -r 45ab12331044 screen.c
--- a/screen.c	Wed Aug 22 21:35:22 2007 +0200
+++ b/screen.c	Wed Aug 22 21:50:16 2007 +0200
@@ -293,7 +293,7 @@ togglefloating(const char *arg) {
 }
 
 void
-togglemax(const char *arg) {
+maximize(int x, int y, int w, int h) {
 	XEvent ev;
 
 	if(!sel || (!isfloating() && !sel->isfloating) || sel->isfixed)
@@ -303,12 +303,29 @@ togglemax(const char *arg) {
 		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);
+		resize(sel, x, y, w, h, True);
 	}
 	else
 		resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
 	drawstatus();
 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+}
+
+void
+togglemax(const char *arg) {
+	maximize(wax, way, waw - 2 * BORDERPX, wah - 2 * BORDERPX);
+}
+
+void
+toggleverticalmax(const char *arg) {
+	if (sel)
+		maximize(sel->x, way, sel->w, wah - 2 * BORDERPX);
+}
+
+void
+togglehorizontalmax(const char *arg) {
+	if (sel)
+		maximize(wax, sel->y, waw - 2 * BORDERPX, sel->h);
 }
 
 void
diff -r bfa2c4d3298f client.c
--- a/client.c	Fri Aug 24 11:09:28 2007 +0200
+++ b/client.c	Fri Aug 24 11:17:58 2007 +0200
@@ -1,5 +1,6 @@
 /* See LICENSE file for copyright and license details. */
 #include "dwm.h"
+#include 
 #include 
 #include 
 
@@ -383,3 +384,36 @@ updatetitle(Client *c) {
 	if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
 		gettextprop(c->win, wmatom[WMName], c->name, sizeof c->name);
 }
+
+void
+moveresize(const char *arg) {
+	int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh;
+	char xAbs, yAbs, wAbs, hAbs;
+	int mx, my, dx, dy, nmx, nmy;
+	unsigned int dui;
+	Window dummy;
+
+	if (!isfloating())
+		if (!sel || !sel->isfloating || !arg)
+			return;
+	if(sscanf(arg, "%d%c %d%c %d%c %d%c", &x, &xAbs, &y, &yAbs, &w, &wAbs, &h, &hAbs) != 8)
+		return;
+	nx = xAbs == 'X' ? x : sel->x + x;
+	ny = yAbs == 'Y' ? y : sel->y + y;
+	nw = wAbs == 'W' ? w : sel->w + w;
+	nh = hAbs == 'H' ? h : sel->h + h;
+
+	ox = sel->x;
+	oy = sel->y;
+	ow = sel->w;
+	oh = sel->h;
+
+	Bool xqp = XQueryPointer(dpy, root, &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
+	resize(sel, nx, ny, nw, nh, True);
+	if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
+	{
+		nmx = mx-ox+sel->w-ow-1 < 0 ? 0 : mx-ox+sel->w-ow-1;
+		nmy = my-oy+sel->h-oh-1 < 0 ? 0 : my-oy+sel->h-oh-1;
+		XWarpPointer(dpy, None, sel->win, 0, 0, 0, 0, nmx, nmy);
+	}
+}
diff -r bfa2c4d3298f config.default.h
--- a/confi

Re: [dwm] dwm-4.4

2007-08-24 Thread Jan Christoph Ebersbach
On Thu 23-08-2007 12:45, Jeremy O'Brien wrote:

> Hopefully the wonderful patches out for dwm-4.3 will be ported up to
> this new version :)

I've updated the patches taglayouts, moveresize, save_floats,
maximize_vert_horz and raise/lower window.

You can download them here:
https://herbst.homeunix.org/projects/repos/hg/dwm_patches/
-- 
Jan Christoph Ebersbach
Have you ever read God's love letter to you? http://www.gottkennen.com/


signature.asc
Description: Digital signature


Re: [dwm] Problem with vlc in fullscreen (was: Re: xine regression)

2007-08-22 Thread Jan Christoph Ebersbach
On Tue 21-08-2007 13:33, Julien Danjou wrote:

> At 1187603221 time_t, Xavier wrote:
>
> > It works fine with dwm 4.3 . I don't use xine everyday, so I'm
> > not sure when exactly it broke in hg tip, but I think it happened
> > recently.
>
> A little off-topic, but anyone having problem with vlc in fullscreen?
> Act very weird.

The vlc fullscreen window is forced into tiled mode but everything else
works fine.
-- 
Jan Christoph Ebersbach
Have you ever read God's love letter to you? http://www.gottkennen.com/


signature.asc
Description: Digital signature


Re: [dwm] [PATCH] Separate border colors for floating windows

2007-06-26 Thread Jan Christoph Ebersbach
On Tue 26-06-2007 14:51, Stanislav Maslovski wrote:

> Here are the colors as defined in my config.h
> 
> #define NORMBORDERCOLOR "#bebebe"
> #define NORMBGCOLOR "#bebebe"
> #define NORMFGCOLOR "#00"
> #define SELBORDERCOLOR  "#ff"
> #define SELBGCOLOR  "#005588"
> #define SELFGCOLOR  "#ff"
> #define FLOATNORMBORDERCOLOR"#005588"
> #define FLOATSELBORDERCOLOR "#ff"

Hi Stanislav,

thanks for the patch. I really like to distinguish the window state by
color. I've just redefined FLOATSELBORDERCOLOR.

#define FLOATNORMBORDERCOLORNORMBORDERCOLOR
#define FLOATSELBORDERCOLOR "#ff"

Bye.
-- 
Jan Christoph Ebersbach
Have you ever read God's love letter to you? http://www.gottkennen.com/


signature.asc
Description: Digital signature


[dwm] A couple of patches

2007-05-11 Thread Jan Christoph Ebersbach
Hi,

I've updated a couple of old patches to the current tip and created some
small convenience patches.

updated to current tip:
moveresize
save_floats

new:
tagall - move all floating windows together to a certain tag
maxmize_vert_horz - maximizes floating windows vertically and
horizontally

You can download them here:
https://herbst.homeunix.org/projects/repos/hg/dwm_patches/
-- 
Jan Christoph Ebersbach
Have you ever read God's love letter to you? http://www.gottkennen.com/


signature.asc
Description: Digital signature


Re: [dwm] about editing tags names

2007-03-02 Thread Jan Christoph Ebersbach
On Thu 01-03-2007 21:26, Albert Cardona wrote:

> All I edited was the tags array in the config.h, from the original in 3.7 to:
> 
> const char *tags[] = { "c", "ij", "blend", "net", NULL };
> 
> and I get:
> 
> dwm build options:
> CFLAGS = -Os -I. -I/usr/include -I/usr/X11R6/include -DVERSION="3.7"
> LDFLAGS = -L/usr/lib -lc -L/usr/X11R6/lib -lX11
> CC = cc
> CC client.c
> In file included from dwm.h:33,
> from client.c:4:
> config.h:19: error: ‘NULL’ undeclared here (not in a function)
> make: *** [client.o] Error 1
> 
> I'd appreciate to know if I've done something stupid.

Hi, the context should look like this:

/* behavior */
#define TAGS \
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };

If I remove the define statement, I get the same error as you.

Bye.

Jan Christoph
-- 
For everything there is a season, and a time for every purpose under
heaven. Ecclesiastes 3,1


pgpHnofsPplHk.pgp
Description: PGP signature


Re: [dwm] update moveresize for dwm 3.7

2007-02-27 Thread Jan Christoph Ebersbach
On Mon 26-02-2007 18:27, pancake wrote:

> > On Mon 26-02-2007 15:30, pancake wrote:
> >
> > > this is my config:
> >
> > Hm, does this config work for you?
> >
> > Every other value after the integer, except 'r', is interpreted as
> > an absolute instead of a relative moveresize.

Hi,

I added an implicit mouse move to the moveresize patch; the syntax for
absolute and relative resizes has also been changed.

Here is an example:

{ MODKEY|Mod1Mask, XK_h , moveresize , "-25x 0y 0w 0h" }  , \
{ MODKEY|Mod1Mask, XK_l , moveresize , "25x 0y 0w 0h" }   , \
{ MODKEY|Mod1Mask, XK_j , moveresize , "0x 25y 0w 0h" }   , \
{ MODKEY|Mod1Mask, XK_k , moveresize , "0x -25y 0w 0h" }  , \
{ MODKEY|ControlMask , XK_h , moveresize , "0X 0y 0w 0h" }, \
{ MODKEY|ControlMask , XK_l , moveresize , "9000X 0y 0w 0h" } , \
{ MODKEY|ControlMask , XK_j , moveresize , "0x 9000Y 0w 0h" } , \
{ MODKEY|ControlMask , XK_k , moveresize , "0x 15Y 0w 0h" }   , \
{ MODKEY|ShiftMask   , XK_h , moveresize , "0x 0y -25w 0h" }  , \
{ MODKEY|ShiftMask   , XK_l , moveresize , "0x 0y 25w 0h" }   , \
{ MODKEY|ShiftMask   , XK_j , moveresize , "0x 0y 0w 25h" }   , \
{ MODKEY|ShiftMask   , XK_k , moveresize , "0x 0y 0w -25h" }  , \

Jan Christoph
-- 
For everything there is a season, and a time for every purpose under
heaven. Ecclesiastes 3,1
diff -r 944739ec944a client.c
--- a/client.c	Mon Feb 26 16:24:51 2007 +0100
+++ b/client.c	Tue Feb 27 14:05:25 2007 +0100
@@ -393,3 +393,34 @@ unmanage(Client *c) {
 	XUngrabServer(dpy);
 	lt->arrange();
 }
+
+void
+moveresize(const char *arg) {
+int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh;
+char xAbs, yAbs, wAbs, hAbs;
+int mx, my, dx, dy, dui, nmx, nmy;
+Window dummy;
+
+if(!sel || !sel->isfloating || sel->isfixed || !arg)
+return;
+if(sscanf(arg, "%d%c %d%c %d%c %d%c %d%c", &x, &xAbs, &y, &yAbs, &w, &wAbs, &h, &hAbs) != 8)
+return;
+nx = xAbs == 'X' ? x : sel->x + x;
+ny = yAbs == 'Y' ? y : sel->y + y;
+nw = wAbs == 'W' ? w : sel->w + w;
+nh = hAbs == 'H' ? h : sel->h + h;
+
+ox = sel->x;
+oy = sel->y;
+ow = sel->w;
+oh = sel->h;
+
+Bool xqp = XQueryPointer(dpy, root, &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
+resize(sel, nx, ny, nw, nh, True);
+if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
+{
+nmx = mx-ox+sel->w-ow-1 < 0 ? 0 : mx-ox+sel->w-ow-1;
+nmy = my-oy+sel->h-oh-1 < 0 ? 0 : my-oy+sel->h-oh-1;
+XWarpPointer(dpy, None, sel->win, 0, 0, 0, 0, nmx, nmy);
+}
+}
diff -r 944739ec944a dwm.h
--- a/dwm.h	Mon Feb 26 16:24:51 2007 +0100
+++ b/dwm.h	Tue Feb 27 14:05:25 2007 +0100
@@ -107,6 +107,7 @@ void updatesizehints(Client *c);		/* upd
 void updatesizehints(Client *c);		/* update the size hint variables of c */
 void updatetitle(Client *c);		/* update the name of c */
 void unmanage(Client *c);		/* destroy c */
+void moveresize(const char *arg);		/* move or resize client */
 
 /* draw.c */
 void drawstatus(void);			/* draw the bar */


pgpH4XSIZYpEg.pgp
Description: PGP signature


Re: [dwm] update moveresize for dwm 3.7

2007-02-26 Thread Jan Christoph Ebersbach
On Mon 26-02-2007 15:30, pancake wrote:

> this is my config:
> 
> { MODKEY|ControlMask,   XK_h,   moveresize, "-64x 0y 0w 
> 0h" }, \
> { MODKEY|ControlMask,   XK_l,   moveresize, "64x 0y 0w 
> 0h" }, \
> { MODKEY|ControlMask,   XK_j,   moveresize, "0x 64y 0w 
> 0h" }, \
> { MODKEY|ControlMask,   XK_k,   moveresize, "0x -64y 0w 
> 0h" }, \
> { MODKEY|ShiftMask|ControlMask, XK_h,   moveresize, "0x 0y -32w 
> 0h" }, \
> { MODKEY|ShiftMask|ControlMask, XK_l,   moveresize, "0x 0y 32w 
> 0h" }, \
> { MODKEY|ShiftMask|ControlMask, XK_j,   moveresize, "0x 0y 0w 
> 32h" }, \
> { MODKEY|ShiftMask|ControlMask, XK_k,   moveresize, "0x 0y 0w 
> -32h" }, \

Hm, does this config work for you?

Every other value after the integer, except 'r', is interpreted as an
absolute instead of a relative moveresize.

On the other hand it looks quite nice - I'll integrate this in the next
update.

Jan Christoph
-- 
For everything there is a season, and a time for every purpose under
heaven. Ecclesiastes 3,1


pgp79ib43EzEB.pgp
Description: PGP signature


Re: [dwm] update moveresize for dwm 3.7

2007-02-26 Thread Jan Christoph Ebersbach
On Mon 26-02-2007 16:05, pancake wrote:

> Is possible to move the cursor following the floating window? this way
> the focus will never be lost.

Yep, this would be an improvement and I already thought about adding
this feature.

> BTW it is possible to move/resize a window to a certain position with
> this patch? or it's only absolute?

Both is possible and I actually need both. - I have a shortcut to move
the selected window to the edges of the screen.

> > On Mon, Feb 26, 2007 at 03:30:40PM +0100, pancake wrote:
> >
> > Well I dislike the approach to make mix moveresize for absolute and
> > relative resizals... I don't see much use in absolute resizals,
> > because there is togglemax().
>
> absolute resizals could be useful, you can "store" certain
> position/sizes of windows and move then to these positions when you
> need them. As tiling, but floating and for certain values (like a
> vertical bar for the gaim roster at the left of the screen, or so..)

Vertical or horizontal maximize is something I really appreciate -
moveresize could be improved in this direction, too.

Jan Christoph
-- 
For everything there is a season, and a time for every purpose under
heaven. Ecclesiastes 3,1


pgpC8oEHyEDTw.pgp
Description: PGP signature


[dwm] update moveresize for dwm 3.7

2007-02-26 Thread Jan Christoph Ebersbach
Hi, here is an update of moveresize according to Anselm's comments.

Mahlzeit.

Jan Christoph
-- 
For everything there is a season, and a time for every purpose under
heaven. Ecclesiastes 3,1
diff -r baee494346e5 client.c
--- a/client.c	Sat Feb 24 15:40:50 2007 +0100
+++ b/client.c	Mon Feb 26 13:57:03 2007 +0100
@@ -384,3 +384,19 @@ unmanage(Client *c) {
 	XUngrabServer(dpy);
 	lt->arrange();
 }
+
+void
+moveresize(const char *arg) {
+int x, y, w, h, nx, ny, nw, nh;
+char xabs, yabs, wabs, habs;
+
+if(!sel || !sel->isfloating || sel->isfixed || !arg)
+return;
+if(sscanf(arg, "%d%c %d%c %d%c %d%c %d%c", &x, &xabs, &y, &yabs, &w, &wabs, &h, &habs) != 8)
+return;
+nx = xabs == 'r' ? sel->x + x : x;
+ny = yabs == 'r' ? sel->y + y : y;
+nw = wabs == 'r' ? sel->w + w : w;
+nh = habs == 'r' ? sel->h + h : h;
+resize(sel, nx, ny, nw, nh, True);
+}


pgpQgrL6yYdo3.pgp
Description: PGP signature


Re: [dwm] floating windows

2007-02-26 Thread Jan Christoph Ebersbach
On Sun 25-02-2007 12:03, Anselm R. Garbe wrote:

> Actually I don't understand why do you re-use Client here, why not int
> x, y, w, h?

Thanks for the comments - I used Client because it seemed to be more
clear than defining a bunch of "loose" variables.

Jan Christoph
-- 
For everything there is a season, and a time for every purpose under
heaven. Ecclesiastes 3,1


pgpzixmU8HCul.pgp
Description: PGP signature


Re: [dwm] floating windows

2007-02-24 Thread Jan Christoph Ebersbach
On Fri 09-02-2007 23:30, Jan Christoph Ebersbach wrote:

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

I updated moveresize to dwm 3.7 and adapted the argmuent to const char.

Jan Christoph

{ MODKEY|Mod1Mask , XK_h , moveresize, "x-25" }  , \
{ MODKEY|Mod1Mask , XK_l , moveresize, "x+25" }  , \
{ MODKEY|Mod1Mask , XK_j , moveresize, "y+25" }  , \
{ MODKEY|Mod1Mask , XK_k , moveresize, "y-25" }  , \
{ MODKEY|ControlMask  , XK_h , moveresize, "x0"} , \
{ MODKEY|ControlMask  , XK_l , moveresize, "x9000" } , \
{ MODKEY|ControlMask  , XK_j , moveresize, "y9000" } , \
{ MODKEY|ControlMask  , XK_k , moveresize, "y15" }   , \
{ MODKEY|ShiftMask, XK_h , moveresize, "w-25" }  , \
{ MODKEY|ShiftMask, XK_l , moveresize, "w+25" }  , \
{ MODKEY|ShiftMask, XK_j , moveresize, "h+25" }  , \
{ MODKEY|ShiftMask, XK_k , moveresize, "h-25" }  , \
-- 
For everything there is a season, and a time for every purpose under
heaven. Ecclesiastes 3,1
diff -r 4070d154349d client.c
--- a/client.c	Sat Feb 24 15:41:05 2007 +0100
+++ b/client.c	Sat Feb 24 17:37:25 2007 +0100
@@ -384,3 +384,33 @@ unmanage(Client *c) {
 	XUngrabServer(dpy);
 	lt->arrange();
 }
+
+void
+moveresize(const char *arg) {
+if (!sel || !sel->isfloating || strlen(arg) == 0) { return; }
+
+int *rs_val = NULL;
+
+Client tmp_client;
+tmp_client.x = sel->x;
+tmp_client.y = sel->y;
+tmp_client.w = sel->w;
+tmp_client.h = sel->h;
+
+switch (arg[0])
+{
+case 'x': rs_val = &(tmp_client.x); break;
+case 'y': rs_val = &(tmp_client.y); break;
+case 'w': rs_val = &(tmp_client.w); break;
+case 'h': rs_val = &(tmp_client.h); break;
+default: return;
+}
+
+if (arg[1] == '-' || arg[1] == '+')
+/* relative resize instead of absolute */
+(*rs_val) += atoi(arg+1);
+else
+(*rs_val) = atoi(arg+1);
+
+resize(sel, tmp_client.x, tmp_client.y, tmp_client.w, tmp_client.h, False);
+}
diff -r 4070d154349d dwm.h
--- a/dwm.h	Sat Feb 24 15:41:05 2007 +0100
+++ b/dwm.h	Sat Feb 24 17:28:35 2007 +0100
@@ -107,6 +107,7 @@ void updatesizehints(Client *c);		/* upd
 void updatesizehints(Client *c);		/* update the size hint variables of c */
 void updatetitle(Client *c);		/* update the name of c */
 void unmanage(Client *c);		/* destroy c */
+void moveresize(const char *arg);		/* move or resize client */
 
 /* draw.c */
 void drawstatus(void);			/* draw the bar */


pgpSrjjkUXjxs.pgp
Description: PGP signature


Re: [dwm] dzen-0.3

2007-02-19 Thread Jan Christoph Ebersbach
On Mon 19-02-2007 10:40, Robert Manea wrote:

> The bugfixed version can be found here:
> http://gotmor.googlepages.com/dzen-0.4.tar.gz

Hi Robert,

thanks for this nice proggi. It would be nice to have a command line
option to specify the orientation of the message.

Bye.

Jan Christoph
-- 
For everything there is a season, and a time for every purpose under
heaven. Ecclesiastes 3,1


pgplaDDDunaqX.pgp
Description: PGP signature


[dwm] floating windows

2007-02-09 Thread Jan Christoph Ebersbach
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 += val

Re: [dwm] caps and clipboard

2007-01-31 Thread Jan Christoph Ebersbach
On Wed 31-01-2007 18:27, Kai Hendry wrote:

> What's the best way to disable the caps lock with editing /etc/X11?
>
> I noticed I did this:
>
> http://svn.natalian.org/home/.Xmodmap
>
> But it doesn't seem to work on my Debian unstable system.

I use

$ cat /etc/X11/Xmodmap 
remove lock = Caps_Lock
add shift = Caps_Lock

and

$ cat /etc/X11/Xsession.d/40custom_load-xmodmap 
SYSMODMAP="/etc/X11/Xmodmap"
USRMODMAP="$HOME/.Xmodmap"

if [ -x /usr/bin/X11/xmodmap ]; then
   if [ -f "$SYSMODMAP" ]; then
   xmodmap "$SYSMODMAP"
   fi
fi

if [ -x /usr/bin/X11/xmodmap ]; then
   if [ -f "$USRMODMAP" ]; then
   xmodmap "$USRMODMAP"
   fi
fi

It works fine for me (Debian unstable).

Jan Christoph
-- 
Homepage : http://www.e-jc.de/
PGP-KeyID: 0x2D600996
For everything there is a season, and a time for every purpose under
heaven. Ecclesiastes 3,1


pgpOEG0PGVZUg.pgp
Description: PGP signature