guile-user
[Top][All Lists]
Advanced

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

Re: X11 bindings and shell bindings


From: Paul Emsley
Subject: Re: X11 bindings and shell bindings
Date: Thu, 18 Sep 2008 18:16:09 +0100
User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707)

Ishan Arora wrote:
Hi,

Is there a procedure to get mouse position.
I guess there may be a way via X11, but it is not clear to me. What you might want to be doing is knowing the coordinates of a click in a canvas, which is not the same thing (and easier).


And is there a procedure to synchronously run a shell code and return the output as a String. Thanks.
;; code from thi <ttn at mingle.glug.org>
;;
;; run command and put the output into a string and return
;; it. (c.f. @code{run-command/strings})
(define (shell-command-to-string cmd)
 (with-output-to-string
   (lambda ()
     (let ((in-port (open-input-pipe cmd)))
   (let loop ((line (read-line in-port 'concat)))
     (or (eof-object? line)
         (begin
       (display line)
       (loop (read-line in-port 'concat)))))))))


Paul.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]