Hi all,
Vitalii Elenhaupt pointed me to this i3 IPC library for ruby:
https://github.com/veelenga/i3ipc-ruby
which is a fork of the i3-ipc library mentioned on the i3 website.
I would like to recommend that veelenga/i3ipc-ruby be added to the i3
website, and badboy/i3-ipc be removed or at least marked as
unmaintained. veelenga/i3ipc-ruby is more featureful than badboy's
one, including the ability to subscribe to events.
Kareem
On 2015-06-02 1514, Tony Crisci wrote:
This is a known bug with i3. Any command that does not include a
`restart` should work correctly. Try to use `reload` whenever you
can. If `reload` does not do something you think it should do that
`restart` does, make an issue on github.
https://github.com/i3/i3/issues/1581
On 06/02/2015 05:20 PM, Kareem Khazem wrote:
Hi all, wondering if somebody could tell me what's wrong with my
script that's trying to talk with i3's IPC.
Whenever I try to read a reply from the socket, I apparently just
get an empty string.
I've already read the warning about using a library and not
implementing my own, thanks, but the Ruby library is unmaintained
and doesn't include recent IPC features.
I'm doing this:
___________________ 8>< snip ><8
_____________________________________ #!/usr/bin/env ruby require
'socket' socket = Socket.unix(`i3 --get-socketpath`.strip)
payload = "restart" type = 0 length = payload.length
bytes = socket.write("i3-ipc#{[length,
type].pack("LL")}#{payload}")
response = socket.read.unpack("L")
______________________________________________________________________
`bytes' gets the number of bytes written, as expected, and i3 does
indeed restart, so the message was successful. But `response'
seems to be nil. If I just ask for socket.read, I just get the
empty string.
Can anyone help? thanks!