for sECuRE added by DerGuteMoritz on Thu Dec 27 16:05:12 2012

(define (start)
  (let ((ipc (socket af/unix sock/stream)))
    (socket-connect ipc (unix-address (i3-socket-path)))
    (socket-send-all ipc (i3-format-ipc-message "[\"workspace\"]" 2))
    
    (let loop ()
      (thread-wait-for-i/o! (socket-fileno ipc))
      (socket-receive ipc (string-length "i3-ipc"))
      (let* ((reply-length (with-input-from-string (socket-receive ipc 4) (cut read-u32)))
             (reply-type (with-input-from-string (socket-receive ipc 4) (cut read-u32)))
             (reply (read-json (socket-receive ipc reply-length))))
        (pp reply))
      (loop))))