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!
> 

Reply via email to