Skip to content

Commit

Permalink
Merge pull request #7 from Daniel-I-Am/master
Browse files Browse the repository at this point in the history
Use I3SOCK environment variable for determining socket path
  • Loading branch information
veelenga authored Jun 21, 2023
2 parents d201701 + 78b9925 commit 59dcb3f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions lib/i3ipc/protocol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,21 @@ def unpack_header(data)
end

def get_socketpath
cmd = if system('i3 --version')
'i3'
elsif system('sway --version')
'sway'
if !ENV['I3SOCK'].nil?
ENV['I3SOCK']
else
raise 'Unable to find i3 compatible window manager'
cmd = if system('i3 --version')
'i3'
elsif system('sway --version')
'sway'
else
raise 'Unable to find i3 compatible window manager'
end

path = `#{cmd} --get-socketpath`.chomp!
raise 'Unable to get i3 compatible socketpath' unless path
path
end
path = `#{cmd} --get-socketpath`.chomp!
raise 'Unable to get i3 compatible socketpath' unless path
path
end

def check_connected
Expand Down
2 changes: 1 addition & 1 deletion lib/i3ipc/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module I3ipc
VERSION = "0.3.0"
VERSION = "0.4.0"
end

0 comments on commit 59dcb3f

Please sign in to comment.