Skip to content
This repository has been archived by the owner on Jun 14, 2019. It is now read-only.

Latest commit

 

History

History
36 lines (26 loc) · 1.27 KB

README.md

File metadata and controls

36 lines (26 loc) · 1.27 KB

i3ipc-d

i3ipc-d provides a high-level D API to the window manager i3's interprocess communication interface.

See here for an example showing all available API methods and here for all examples. A connection in i3ipc-d has always exactly one of the following characteristics:

  • threaded (events are automatically dispatched by a dedicated thread),
  • fibered (events need to be explicitly dispatched by calling connection.dispatch), or
  • eventless (events are not supported at all).

The following shows how to setup a threaded connection:

module threaded;

import core.time : seconds;
import core.thread : Thread, dur;

import std.stdio : writeln;

import i3ipc;

void main(string[] args)
{
	auto connection = i3ipc.connect!Thread;

	connection.subscribe!"Workspace"((change, current, old) => writeln(change, " ", current, " ", old));

	writeln("Connection open for approximately 3 seconds, please generate some i3 workspace events!");
	/+ A thread-backed connection automatically dispatches events,
	 + this just delays program termination.
	 +/
	Thread.sleep(3.seconds);
}