guile gnome-terminal macros take 2



Greetings.

I have added even more functionality to the guile gnome-terminal
module, thanks to all the hints and tips I got here.

	ftp://ftp.andrews.edu/pub/aldy/guile-term.tgz

The hooks on mouse clicks even work!  So now you can do:

     (define (generic-handler term tag)
       (system (string-append "xterm -T " tag " -e lynx " tag "&")))
     
     (define handlers-alist
       `(("http://[a-zA-Z0-9\.-/~%=]*" . ,generic-handler)
	 ("ftp://[^ ]*" . ,generic-handler)))
     
     (define (mouse-click-cb term button row col mods)
       (display (list 'button button))
       (display (list 'col col 'row row))
       (display (list 'mods mods))
       (newline)
       (if (and (= button 1)
		(equal? '(shift) mods))	;; shift-left button handles url's
	   (for-each (lambda (x)
		       (let* ((pattern (car x))
			      (handler (cdr x))
			      (tag (terminal-regexp term col row pattern)))
			 (if tag
			     (handler term tag))))
		     handlers-alist)))
     
     (terminal-add-hook-on-click mouse-click-cb)

This code allows you to shift-click with the left button and go to a
url on your screen.

I really don't know what else is desired since this is all *I* need
(context mouse clicks and macros off of the menu that do stuff).
Suggestions welcome...

oh btw, you still need to patch gnome-terminal.c (details below) cuz i
still haven't tried maciej's guile patch.

G'night.
Aldy

-------------from the README----------------------------

This is a gtk module that allows you to customize your gnome-terminal
with Guile.

Your gnome-terminal.c's main() function should call scm_boot_guile() like so:

	int
	main (int argc, char *argv [], char **environ)
	{
		scm_boot_guile (argc, argv, main_terminal_program, environ);
		return 1;
	}

Remember to recompile gnome-terminal with additional options of:

	-lguile -lqthreads -ldl -lreadline -lm

After compiling the module (libguileterm.so), put libguileterm.so's
directory in the current LD_LIBRARY_PATH and execute it like so:

	gnome-terminal --gtk-module=guileterm

The module looks for
	$GNOME_DATADIR/gnome-terminal/scripts/init.scm
	$GNOME_DATADIR/gnome-terminal/scripts/system.gnome-terminal.scm

Both of these .scm files are in the distribution's "scripts" directory
and should be copied manually.  Sorry...

Your personal settings should go in:

	~/.gnome/gnome-terminal.scm

The default example ``system.gnome-terminal.scm'' adds a few menu
items and maps shift-button-1 to a "url-goto" which should call:

	xterm -e lynx [url]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]