On Thu, Jan 10, 2008 at 09:45:52PM +0100, Christian Garbs wrote:
> On Wed, Jan 09, 2008 at 10:27:14PM +0100, Marc Andre Tanner wrote:
> 
> > Configure the action array to launch your apps. The problem is that after 
> > a keystroke only the content of the selected window is shown. 
> > I will have to take a closer look.
> 
> Hey, it looks nearly exactly the same as the patch I had prepared (I
> also wanted to create some clients on startup).  You've also run into
> exactly the same problem as me :-)
> 
> I wanted to give it a try with the new redraw command (my second
> reason to that feature request).

I think i have figured it out, could you please test the attached patch.

Thanks,
Marc

-- 
 Marc Andre Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0
diff --git a/config.h b/config.h
index 5835eb3..97a89e5 100644
--- a/config.h
+++ b/config.h
@@ -122,3 +122,8 @@ Button buttons[] = {
 	{ BUTTON1_TRIPLE_CLICKED, { mouse_zoom,       { NULL } } },
 	{ BUTTON2_CLICKED,        { mouse_minimize,   { NULL } } },
 };
+
+/* gets executed when dvtm is started */
+Action actions[] = {
+ 	{ create, { SHELL } },
+};
diff --git a/dvtm.c b/dvtm.c
index 9cc4630..fc6c857 100644
--- a/dvtm.c
+++ b/dvtm.c
@@ -97,6 +97,7 @@ enum { BarTop, BarBot, BarOff };
 /* commands for use by keybindings */
 void quit(const char *args[]);
 void create(const char *args[]);
+void startup(const char *args[]);
 void escapekey(const char *args[]);
 void killclient(const char *args[]);
 void focusn(const char *args[]);
@@ -135,7 +136,7 @@ int statusfd = -1;
 char stext[512];
 int barpos = BARPOS;
 unsigned int ltidx = 0;
-bool need_screen_resize = false;
+bool need_screen_resize = true;
 int width, height;
 bool running = true;
 
@@ -720,8 +721,9 @@ sigterm_handler(int sig){
 
 void
 resize_screen(){
-	debug("resize_screen(), w: %d h: %d\n", width, height);
+	debug("resize_screen()\n");
 	if(need_screen_resize){
+		debug("resize_screen(), w: %d h: %d\n", width, height);
 	#if defined(__OpenBSD__) || defined(__NetBSD__)
 		resizeterm(height, width);
 	#else
@@ -738,6 +740,13 @@ resize_screen(){
 }
 
 void
+startup(const char *args[]){
+	int i;
+	for(i = 0; i < countof(actions); i++)
+		actions[i].cmd(actions[i].args);
+}
+
+void
 setup(){
 	int i;
 	mmask_t mask;
@@ -824,6 +833,7 @@ int
 main(int argc, char *argv[]) {
 	parse_args(argc, argv);
 	setup();
+	startup(NULL);
 	while(running){
 		Client *c;
 		int r, nfds = 0;

Reply via email to