On Thu, May 22, 2008 at 08:32:13AM +0200, Marc Schoechlin wrote: > i'm currently thinking about implementing a feature which is listed > in the "TODO" file as: > ---- > 9 Monitor tabs for output / silence (very easy as of 2006-09-02). > ----
Great! > I'm employed to test the linux kernel on IBM's zSeries mainframe > computers - so i often perform long term actions with several > terminals (e.g. stresstests). So it's really worthwhile for me to > detect if one of my not active terminals produces output or stops to > produce output ;-) > > In my opinion this feature should work like this. > - activation over a macro > - the arguments of the macro should look like this > MonitorTab <type> <w_microseconds> <action> > - <type> can be be of the following values: > - "silence" : activate action if no output is produced in the last > <w_microseconds> > (criteria : time_of_last_output_event > current_time - > w_microseconds) > - "activity" : activate action if output is produced last <w_microseconds> > (criteria : time_of_last_output_event < current_time - > w_microseconds) > - "auto" : automatically detect if we should monitor for "silence" or > "activity" > monitor silence -> criteria of "activity" is currently true > monitor activity -> criteria of "silence" is currently true > - <w_microseconds> is a integer > - <activity> can be be of the following values: > 'highlight_tab' : execute function rxvt_tabbar_highlight_tab > '<any other string>' : execute a command > (do a fork/exec to prevent mrxvt from blocking) Few thoughts: 1. Seconds might be more practical than microseconds. You can make it a float, if you really want better precision. 2. Instead of "auto", perhaps you can call it "both", and have it mean the following: When the tab goes from silent to active, it executes the action. Also when the tab goes from active to silent it executes the action. 3. I would also add 'bell' to actions 4. Rather than adding actions, I think the most useful thing would be to modify the "titleFormat" option of that tab. That way the user can get a word / symbol of their choice prepended to the tab title. We could add a "%S" option to the list of % interpolations done by mrxvt, where %S expands to two configurable strings depending on the tab status (active / silent). We need some (perhaps user configurable) rule on deciding how long to display the "%S" status for. 4. It (might) would be useful to also make this a (profile) option that can be configured in ~/.mrxvtrc. > So we, need the following components: > > - a per-tab datastructure which holds the occurrence time of the last output > - the tab output routines must be enhanced by modifying the previous data > structures > - a macro which interpretes the configuration and starts monitoring the tab > - detection code which have to be integrated into a cyclic routine > (e.g. a tabbar redraw routine) > > I'm pretty new to mrxvt - so it's currently a bit difficult to decide > how to add this feature in a efficient way (performance, amount of > code). > > Do your have some suggestions where and how to start ? Do you have and > hints about the implementation for me ? Well it shouldn't be too hard. All data read from a tab is read with rxvt_read_child_cmdfd(). You can also trace the value of PVTS( r, page)->nbytes_last_read to see where data is read in. Adding a timeout, and a monitor flag to the tab data structure is quite cheap (5 bytes). Monitoring for activity is easy. If we read something in rxvt_read_child_cmdfd(), then perform your action. Monitoring for silence requires adding timeouts. I cleaned up the timeout code on 2006-09-02, which is probably why I had the comment in the TODO. Just look at what the pointer blank code does, and copy it... :) GI PS: It might be useful to post on the dev list. That way if you run out of free time, someone else might be interested / willing to implement this. Plus user suggestions are always good to have. -- Daddy, what does "Formatting Drive C:" mean?
pgpq8G5RpNPMv.pgp
Description: PGP signature
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ Materm-devel mailing list Materm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/materm-devel mrxvt home page: http://materm.sourceforge.net