Re: [dev] run a program and display on a specific tab

2011-06-06 Thread Erik Hahn
On Mon, Jun 06, 2011 at 11:20:29AM +0100, Piotr Zalewa wrote:
 Hi,
 
 I want to create a script which will load my default setup (quite a
 few programs).
 
 How to run a program so it will be displayed on a desired tab?
 (view, workspace - I always had a problem with that lingo)

In wmii, you can either use wihack or create some tag rules in wmiirc.



Re: [dev] run a program and display on a specific tab

2011-06-06 Thread Piotr Zalewa

On 06/06/11 11:40, ilf wrote:

On 06-06 11:20, Piotr Zalewa wrote:

I want to create a script which will load my default setup (quite a
few programs).


I use .xinitrc for this.


I don't want to do it every time


How to run a program so it will be displayed on a desired tab? (view,
workspace - I always had a problem with that lingo)


I assign programs to tags in config.h.


It's more complicated as xterms are on many tags



Re: [dev] run a program and display on a specific tab

2011-06-06 Thread Alex Bradbury
2011/6/6 Piotr Zalewa zal...@gmail.com:
 Hi,

 I want to create a script which will load my default setup (quite a few
 programs).

 How to run a program so it will be displayed on a desired tab? (view,
 workspace - I always had a problem with that lingo)

I have used xdotool for this. I've been lazy and just put arbitrary
sleeps between launching programs though, when really I should be
waiting until a window with the appropriate name or class appears.

Alex



Re: [dev] run a program and display on a specific tab

2011-06-06 Thread Piotr Zalewa

On 06/06/11 15:41, Connor Lane Smith wrote:

Hey,

2011/6/6 Piotr Zalewazal...@gmail.com:

How to run a program so it will be displayed on a desired tab? (view,
workspace - I always had a problem with that lingo)


So are we talking about wmii or dwm or what?


wmii

zalun



Re: [dev] run a program and display on a specific tab

2011-06-06 Thread Kurt H Maier
On Mon, Jun 6, 2011 at 11:52 AM, Piotr Zalewa zal...@gmail.com wrote:
 wmii


The problem has become insoluble.  Even locating all possible
solutions is NP-hard.


-- 
# Kurt H Maier



Re: [dev] run a program and display on a specific tab

2011-06-06 Thread Benoit T
hello,

if you were referring to dwm rather than wmii...

On Mon, Jun 06, 2011 at 02:49:57PM +0100, Piotr Zalewa wrote:
 I want to create a script which will load my default setup (quite a
 few programs).
 
 I use .xinitrc for this.

... or .xsession

 I don't want to do it every time

then create a script that launches your programs and launch that script
from an xterm, dmenu or a shortcut in your dwm.h

 How to run a program so it will be displayed on a desired tab? (view,
 workspace - I always had a problem with that lingo)
 
 I assign programs to tags in config.h.
 
 It's more complicated as xterms are on many tags

it is still the right way to do what you ask for with dwm and anyway
it's the only way at least with a stock dwm.

as others suggested, you can match on several properties in rules[] in
config.h and they are not difficult to set from the command line for
your xterms.

one annoyance with the whole dwm concept is that you have to restart dwm
to try new rules, since you need to recompile.

with attached respawn.patch patch, you won't need to exit your X
session, rather dwm will respawn over itself - but with the new version
of itself as found on disk. of course if the new version crashes your X
session will terminate and if it does not work somehow, you may have to
forcibly terminate it, but if your changes are sane, you will be fine,
and anyway, hey, you have to try out the new build at some point (one
alternative being to try the new build in a nested X server such as
xephyr+xoo).

if you are interested in the respawn patch, then you will find that when
dwm starts in lieu of any other WM, including itself, all clients for
which there is no rule move to the 1st tag.

attached remember_tags.patch will solve that problem by recording tags
in an xprop for each X client, which is remembered through dwm restarts.

note: these are patches from a mercurial queue over my dwm repo, not
revisions against the dwm repo itself. apply them as unversioned diffs
or import them into your own mercurial queue and then hg qpush them.

most likely you found out that you don't want to install to /usr/bin/dwm
nor /usr/local/bin/dwm everytime you edit your config.h so you probably
have your own makefile variant that will install to ~/bin or something.
if you don't, well, i have a patch for that but it's a bit convoluted
due to supporting install over the same home directory for multiple
machines with different architectures, so i am not providing _that_ part
of my patch queue at this time.

cheers

-- 
Benoit Triquet benoit.triquet at gmail.com
 .''`.
: :' :  We are debian.org. Lower your prices, surrender your code.
`. `'   We will add your hardware and software distinctiveness to
  `-our own. Resistance is futile.
diff -r c19e2f20ca69 config.def.h
--- a/config.def.h	Thu Oct 29 15:39:12 2009 +0100
+++ b/config.def.h	Thu Oct 29 15:43:42 2009 +0100
@@ -80,7 +80,8 @@
 	TAGKEYS(XK_7,  6)
 	TAGKEYS(XK_8,  7)
 	TAGKEYS(XK_9,  8)
-	{ MODKEY|ShiftMask, XK_q,  quit,   {0} },
+	{ MODKEY|ShiftMask|ControlMask, XK_q,  quit,   {.i = 0 } },
+	{ MODKEY|ShiftMask, XK_q,  quit,   {.i = 1 } },
 };
 
 /* button definitions */
diff -r c19e2f20ca69 dwm.c
--- a/dwm.c	Thu Oct 29 15:39:12 2009 +0100
+++ b/dwm.c	Thu Oct 29 15:43:42 2009 +0100
@@ -270,6 +270,7 @@
 static Monitor *mons = NULL, *selmon = NULL;
 static Window root;
+static char **args;
 
 /* configuration, allows nested code to access above variables */
 #include config.h
 
@@ -1292,6 +1293,8 @@
 
 void
 quit(const Arg *arg) {
+	if(arg-i)	/* restart dwm, if fails just fall through and exit */
+		execv(args[0], args);
 	running = False;
 }
 
@@ -2008,6 +2011,7 @@
 		fputs(warning: no locale support\n, stderr);
 	if(!(dpy = XOpenDisplay(NULL)))
 		die(dwm: cannot open display\n);
+	args = argv;
 	checkotherwm();
 	setup();
 	scan();
# HG changeset patch
# Parent 3b5f9910413a84c53905b237e5fbf0728bb1081c

diff -r 3b5f9910413a dwm.c
--- a/dwm.c	Wed Oct 27 15:43:16 2010 +0200
+++ b/dwm.c	Wed Oct 27 15:46:10 2010 +0200
@@ -275,6 +275,7 @@
 static Monitor *mons = NULL, *selmon = NULL;
 static Window root;
 static char **args;
+static Atom dwmatom_tags;
 
 /* configuration, allows nested code to access above variables */
 #include config.h
@@ -1104,8 +1105,15 @@
 		c-tags = t-tags;
 	}
 	else {
+		Atom atom; int format; unsigned long n, extra; unsigned int *ptags;
 		c-mon = selmon;
-		applyrules(c);
+		if(XGetWindowProperty(dpy, w, dwmatom_tags, 0L, 1L, False, XA_CARDINAL,
+		  atom, format, n, extra, (unsigned char **)ptags)==Success  n==1  *ptags!=0)
+			c-tags = *ptags; /* override rule tags with memorized tags */
+		else {
+			applyrules(c);
+			XChangeProperty(dpy, w, dwmatom_tags, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)c-tags, 1);
+		}
 	}
 	/* geometry */
 	c-x 

Re: [dev] run a program and display on a specific tab

2011-06-06 Thread Ruben Gonzalez Arnau

On 06/06/11 12:20, Piotr Zalewa wrote:

Hi,

I want to create a script which will load my default setup (quite a few
programs).

How to run a program so it will be displayed on a desired tab? (view,
workspace - I always had a problem with that lingo)

thanks,
zalun



Assuming you are using sh version of wmii. (= 3.9.2)

${HOME}/.wmii/wmiirc_local

wmiir write /tagrules !
/regex app/  - tag
/XTerm/ - sel
/Firefox/  - 9
/Xmms/ - music
etc
!

sel is current tag
you can use letters www or numbers 1 for your custom apps tags.

Hope it helps.

--
r...@sdf.lonestar.org



Re: [dev] run a program and display on a specific tab

2011-06-06 Thread hiro
 The problem has become insoluble.  Even locating all possible
 solutions is NP-hard.

I don't get it.