(define (i3-command msg) (let ((ipc (socket af/unix sock/stream))) (socket-connect ipc (unix-address (i3-socket-path))) (socket-send-all ipc (i3-format-ipc-message msg 0)) (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)))) (read-json (socket-receive ipc reply-length))))) ;; (socket-close ipc)))