krasenyp

krasenyp

I3_client - i3 IPC client, written in Erlang

This is an i3 IPC client implementation, written in Erlang, with zero dependencies. All the messages and events exposed by i3 and Sway are currently supported.

It’s a very early release but it’s fully featured. My next two priorities are improving the test coverage and extending the documentation with examples. Nevertheless, I’ll be happy to hear from early users.

Notable features

  • Variant negotiation - rudimentary capability checks but the fundamentals are ther
  • Automatic reconnection - opt-in but nice to have
  • Multiplexing - a single connection can handle request-response and out-of-band events.

Example

The following example shows how to start a client connection, subscribe to events and run commands. All using the same connection, all idiomatic OTP behaviour.

iex> {:ok, pid} = :i3_client.start_link([])
iex> {:ok, ref} = :i3_client.subscribe(pid, ["window"])
iex> {:ok, _} = :i3_client.run_command(pid, "focus right")
iex> flush()
{:i3_event, ^pid, ^ref, "window", "..."} # Pseudocode but you get the idea

Hex: i3_client | Hex
Source:

Most Liked

krasenyp

krasenyp

I’m happy to announce that v0.2.0 was just released.

This version brings one user-facing change - first tick events, the ones received right after a subscription to tick events is made, are treated as unicast events. They used to be broadcast events, like any other type of event, but it was an incorrect behaviour. I knowingly left it that way in the initial version because it was tolerable but now it’s time for correct and predictable handling of this special kind of event.

MaxRu

MaxRu

Very cool stuff!

I’m currently also working on a client like this but for wayland protocols because i am building a WM in elixir.

Whats your use case for an i3 client in erlang?

krasenyp

krasenyp

Nothing special on my side, I’m just using the swaybar protocol. I use i3_client to keep track of various pieces of state. For example, I’m subscribed to input events and update the bar accordingly whenever I change the keyboard layout.

Where Next?

Popular in Announcing Top

dominicletz
Hi, I thought I had posted my library before but seems I hadn’t. The project is still in early stages but it’s growing and so I think it...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42842 311
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API. Docs are at OpenaiEx User Guide — ope...
152 10095 134
New
Crowdhailer
Experimenting with this code. OK.try do user <- fetch_user(1) cart <- fetch_cart(1) order = checkout(cart, user) save_or...
New
Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. Features Unstyled Phoenix components. Storybook that can be added to...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
scohen
Lexical Lexical is a next-generation language server for the Elixir programming language. Features Context aware code completion As-you...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53578 245
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement