librelist archives

« back to archive

Passing list of buffer titles to external application

Passing list of buffer titles to external application

From:
Owen Mays
Date:
2014-12-09 @ 00:32
Hi all,

Most of the time I like the fact that conkeror avoids wasted space by
hiding the buffer list except when it is requested (unlike firefox tabs).
The one problem is that if I have gmail open in the background and a chat
comes in, there is no visual indication that this has happened.

The buffer title of the gmail buffer is updated to blink "[Username]
says...," but of course I only see that if I run C-x b and check manually.

Ultimately I would like a notification to show up on the modeline of my
window manager (StumpWM). I could use a jabber client daemon, but that
would mean I was signed in to Gchat independently of having the webpage
open, which I don't want.

Is there a way to ask a conkeror process for a list of buffers? Or a way to
get conkeror to print out a list of open buffers to a text file
periodically? That way I could parse the list, look for chat notifications,
and update my StumpWM modeline accordingly.

Any suggestions are much appreciated! (Including ideas that would be less
clunky than what I've outlined).

-Owen

Re: [conkeror] Passing list of buffer titles to external application

From:
Scott Jaderholm
Date:
2014-12-09 @ 16:13
For Gmail users who didn't see Owen's original message, check your
Spam folder, it was placed in mine.

On Mon, Dec 8, 2014 at 4:32 PM, Owen Mays <r.owen.mays@gmail.com> wrote:
> Or a way to get conkeror to print out a list of open buffers to a text file
> periodically?

Sessions can be autosaved to a json file periodically. At present I
believe it just includes buffer url.
alethiophile made a patch to have it optionally include buffer titles
as well. I don't think the patch has been submitted to be included in
conkeror itself, but I'm not sure. The paste where I saw the patch has
expired. I used it to also include the buffer scroll position.

Unfortunately right now there's no easy way for people in their RC
files to write a little code and have some custom data stored per
buffer in a session file and then have that data processed when the
session is restored, from what I can tell.

Perhaps there could be two arrays, session_save_functions (or
something) and session_load_functions. You could easily add a function
to session_save_functions and the function would take a buffer and
return a map like {title: "...", scroll_position: {x: 0, y: 0}}. The
maps returned for all the session_save_functions would be merged with
the one we're already using and would be stored in the session. Then
you would also be responsible for adding a function to
session_load_functions that would say take a buffer and a map
representing the session data for a buffer and the function would say
set the buffer title or scroll position or whatever.

I'm not sure what a nice design for this would look like, I'm just
spit-balling here, but I hope that eventually we'll get something like
it.

Scott

Re: [conkeror] Passing list of buffer titles to external application

From:
Phil Hudson
Date:
2014-12-09 @ 10:06
Owen Mays <r.owen.mays@gmail.com> writes:

> Is there a way to ask a conkeror process for a list of buffers?

There's a function 'for_each_buffer' that applies a given function to
each buffer. That might help get you started. I'll be interested to see
what you come up with.

-- 
Phil Hudson                   http://hudson-it.ddns.net
@UWascalWabbit                 PGP/GnuPG ID: 0x887DCA63

Re: [conkeror] Passing list of buffer titles to external application

From:
Tom Willemse
Date:
2014-12-09 @ 13:41
Phil Hudson <phil.hudson@iname.com> writes:

> Owen Mays <r.owen.mays@gmail.com> writes:
>
>> Is there a way to ask a conkeror process for a list of buffers?
>
> There's a function 'for_each_buffer' that applies a given function to
> each buffer. That might help get you started. I'll be interested to see
> what you come up with.

Is there even any way in Conkeror to print anything to the standard
output port? I've been casually looking for this for a while and haven't
yet found anything in either Conkeror or the Xulrunner documentation. 

Re: [conkeror] Passing list of buffer titles to external application

From:
Phil Hudson
Date:
2014-12-09 @ 15:43
Tom Willemse <tom@ryuslash.org> writes:

> Is there even any way in Conkeror to print anything to the standard
> output port?

Run conkeror from the command line, or use MozRepl. I usually run
Conkeror from the command line with output redirected to log file.

Function 'dumpln("Some diagnostic info")' is the one to use to provide
diagnostic output from your own code.

-- 
Phil Hudson                   http://hudson-it.ddns.net
@UWascalWabbit                 PGP/GnuPG ID: 0x887DCA63