;; opens a UNIX socket and sends messages formatted as per ;; http://i3wm.org/docs/ipc.html#_sending_messages_to_i3 (define (i3-command msg) (let ((ipc (socket af/unix sock/stream))) (socket-connect ipc (unix-address (i3-socket-path))) ;; TODO: shorten the following? (socket-send-all ipc (with-output-to-string (lambda () (begin (display "i3-ipc") (write-u8vector (blob->u8vector/shared (u32vector->blob/shared (u32vector (string-length msg))))) (write-u8vector (blob->u8vector/shared (u32vector->blob/shared (u32vector 0)))) (display msg))))) (socket-close ipc)))