Re: How to put windows into groups by application type.

tomm smith <[email protected]>
Newsgroups gmane.comp.window-managers.ratpoison.devel
Message-ID <[email protected]>
yeah I was getting the same issues with multiple runs(continuous runs rather).

I attempted to fiddle with "e->height <= 10 && e->width <= 10" it
might be a valid solution, but it seems liferea and a few others ran
the hook < then 1 times. While I was fiddling and surfing source files
to obtain info, I had a thought of calling the hook from when the
window name is inserted into the window list. I ran on this epiphany
and tried adding the hook call to insert_into_list() in window.c well
sure enough all the tests I have done thus far have returned exactly
one execution of the hook per new window.

I have attached the diff of the changes, I want to test it more but I
feel pretty confident with this solution.

(P.S. If the diffs I am submitting are not quite how you like patches
or I am generating them wrong please do tell me, I am pretty new to
patch writing for C so sketchy on my methods.)

On 3/15/10, Eric A <[email protected]> wrote:
> On Sun, Mar 14, 2010 at 5:09 AM, tomm smith <[email protected]> wrote:
>> I believe I have created a patch for this desired hook. Only had to
>> change a few lines, basically define the hook and add a hook call to
>> new_window(). I am a newborn in the C world so if any of this is
>> hackery that does not comply with GNU coding standards I do apologize.
>> I have attached the patch to this email. I tested out the code very
>> shortly I plan to test it more, but initial test showed everything was
>> working smoothly.
>>
>
> Thanks, I think this is what I'm looking for! I tried it out, but ran
> into a problem. It seems that for most programs,
> new_window(XCreateWindowEvent *e) is called multiple times. For
> example, starting midori issues 2 events and firefox 3 events. In
> fact, the only program that I've tested that calls it just once is
> urxvt.
>
> I tried filtering out the multiple events by looking at the window
> properties. It seems that all the additional events have window
> height/widths (e->height and e->width) of 1, 2, or 10. So by filtering
> all windows with height/widths of <=10, I was able to produce only one
> event per "real window".
>
> I'm not sure whether this would work 100% of the time though. Do you
> have any better ideas?
>
> Thanks,
> Eric
>

_______________________________________________
Ratpoison-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/ratpoison-devel
rat-crtHook.diff (text/x-diff, 2.1 KB)
Only in .: config.h
Only in .: config.h.in
Only in .: createwin_hook.diff
Only in .: .deps
diff -crB ratorig/src/events.c ./events.c
*** ratorig/src/events.c	2010-03-13 21:43:43.000000000 -0500
--- ./events.c	2010-03-15 15:41:05.000000000 -0400
***************
*** 103,108 ****
--- 103,109 ----
        win = add_to_window_list (s, e->window);
        update_window_information (win);
      }
+ 	
  }
  
  static void
Only in .: .events.c.swo
diff -crB ratorig/src/globals.c ./globals.c
*** ratorig/src/globals.c	2010-03-13 21:43:43.000000000 -0500
--- ./globals.c	2010-03-13 21:46:29.000000000 -0500
***************
*** 231,236 ****
--- 231,237 ----
  LIST_HEAD (rp_quit_hook);
  LIST_HEAD (rp_restart_hook);
  LIST_HEAD (rp_delete_window_hook);
+ LIST_HEAD (rp_new_window_hook);
  
  struct rp_hook_db_entry rp_hook_db[]=
    {{"key",              &rp_key_hook},
***************
*** 241,246 ****
--- 242,248 ----
     {"deletewindow",     &rp_delete_window_hook},
     {"quit",             &rp_quit_hook},
     {"restart",          &rp_restart_hook},
+ 	 {"createwin",				&rp_new_window_hook},
     {NULL, NULL}};
  
  void
diff -crB ratorig/src/globals.h ./globals.h
*** ratorig/src/globals.h	2010-03-13 21:43:43.000000000 -0500
--- ./globals.h	2010-03-13 21:46:42.000000000 -0500
***************
*** 181,186 ****
--- 181,187 ----
  extern struct list_head rp_delete_window_hook;
  extern struct list_head rp_quit_hook;
  extern struct list_head rp_restart_hook;
+ extern struct list_head rp_new_window_hook;
  
  extern struct rp_hook_db_entry rp_hook_db[];
  
Only in .: Makefile
Only in .: Makefile.in
Only in .: rat-crtHook.diff
Only in .: ratorig
Only in .: stamp-h1
Only in .: .vimcuts.txt.swp
diff -crB ratorig/src/window.c ./window.c
*** ratorig/src/window.c	2010-03-13 21:43:43.000000000 -0500
--- ./window.c	2010-03-15 15:42:10.000000000 -0400
***************
*** 376,381 ****
--- 376,384 ----
            return;
          }
      }
+ 	/* insert into list so must have created a new window
+ 	 * call our new window hook */
+ 	hook_run (&rp_new_window_hook);
  
    list_add_tail(&win->node, list);
  }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.