chickadee » i3 » connect

connectprocedure

Connects to i3 running on the display specified by the environment variable DISPLAY.

(define (connect)
  (let ((cmd-fd (socket af/unix sock/stream))
        (event-fd (socket af/unix sock/stream)))
    (socket-connect cmd-fd (unix-address (i3-socket-path)))
    (socket-connect event-fd (unix-address (i3-socket-path)))
    (let ((conn (make-i3-conn cmd-fd event-fd (make-mutex) #f '())))
      (i3-conn-event-thread-set!
        conn
        (thread-start! (lambda () (read-events conn))))
      conn)))