i3-ipc 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,11 @@ Old school (for the cli script only):
16
16
  chmod 755 i3-ipc &&
17
17
  mv i3-ipc /usr/local/bin/i3-ipc
18
18
 
19
+ If you're on [Arch Linux][arch], you can use the AUR package:
20
+
21
+ curl http://aur.archlinux.org/packages/i3-ipc/i3-ipc/PKGBUILD &&
22
+ makepkg -i
23
+
19
24
  Use
20
25
  ---
21
26
 
@@ -24,12 +29,12 @@ Use
24
29
  i3-ipc -t 1 -j
25
30
  i3-ipc "exec xterm"
26
31
 
27
- Read the [man-page]() for more information.
32
+ Read the [man-page][man] for more information.
28
33
 
29
34
  Subscribing
30
35
  -----------
31
36
 
32
- As of commit [3db4890]() i3 added events.
37
+ As of commit [3db4890][] i3 added events.
33
38
  For now there's only one event: `workspace`.
34
39
 
35
40
  According to the documentation:
@@ -53,7 +58,7 @@ This could be one of
53
58
  * MESSAGE_REPLY_COMMAND
54
59
  * MESSAGE_REPLY_COMMAND
55
60
  * EVENT_WORKSPACE #_
56
- * `data` is the received data, already parsed.
61
+ * `data` is the received data, already parsed.
57
62
 
58
63
  For example you can use the following code to get the actual focused screen:
59
64
 
@@ -72,7 +77,7 @@ For example you can use the following code to get the actual focused screen:
72
77
  end
73
78
  end
74
79
 
75
- A full example of how this can be used for the workspace bar can be found in the `examples` directory.
80
+ A full example of how this can be used for the workspace bar can be found in the [examples][] directory.
76
81
 
77
82
  You can use `EM.stop` to stop the connection.
78
83
 
@@ -89,10 +94,10 @@ Contributing
89
94
 
90
95
  Once you've made your great commits:
91
96
 
92
- 1. [Fork]() the project.
97
+ 1. [Fork][] the project.
93
98
  2. Create a topic branch - `git checkout -b my_branch`
94
99
  3. Push to your branch - `git push origin my_branch`
95
- 4. Create an [Issue]() with a link to your branch
100
+ 4. Create an [Issue][] with a link to your branch
96
101
  5. That's it!
97
102
 
98
103
  Copyright
@@ -101,8 +106,10 @@ Copyright
101
106
  Copyright (c) 2010 Jan-Erik Rediger. See LICENSE for details.
102
107
 
103
108
  [i3]: http://i3.zekjur.net/
104
- [manpage]: http://badboy.github.com/i3-ipc/
109
+ [arch]: http://www.archlinux.org/
110
+ [man]: http://badboy.github.com/i3-ipc/
105
111
  [3db4890]: http://code.stapelberg.de/git/i3/commit/?h=next&id=3db4890683e87
106
112
  [em]: http://github.com/eventmachine/eventmachine
113
+ [examples]: http://github.com/badboy/i3-ipc/tree/master/examples/
107
114
  [fork]: http://help.github.com/forking/
108
115
  [issue]: http://github.com/badboy/i3-ipc/issues
data/Rakefile CHANGED
@@ -89,3 +89,10 @@ desc "fire up IRB console"
89
89
  task :console do
90
90
  exec "irb -Ilib -ri3-ipc"
91
91
  end
92
+
93
+ require 'rake/testtask'
94
+ Rake::TestTask.new(:test) do |test|
95
+ test.libs << 'lib' << 'test'
96
+ test.pattern = 'test/**/test_*.rb'
97
+ test.verbose = true
98
+ end
@@ -53,7 +53,7 @@ module I3
53
53
  # gets the current workspaces.
54
54
  # the reply will be the list of workspaces
55
55
  # (see the reply section of i3 docu)
56
- def get_workspace
56
+ def get_workspaces
57
57
  write format(MESSAGE_TYPE_GET_WORKSPACES)
58
58
  handle_response MESSAGE_TYPE_GET_WORKSPACES
59
59
  end
@@ -70,13 +70,13 @@ module I3
70
70
  def handle_response(type)
71
71
  # reads 14 bytes
72
72
  # length of "i3-ipc" + 4 bytes length + 4 bytes type
73
- buffer = @socket.read 14
73
+ buffer = read 14
74
74
  raise WrongMagicCode unless buffer[0, (MAGIC_STRING.length)] == MAGIC_STRING
75
75
 
76
76
  len, recv_type = buffer[6..-1].unpack("LL")
77
77
  raise WrongType unless recv_type == type
78
78
 
79
- answer = @socket.read(len)
79
+ answer = read len
80
80
  ::JSON.parse(answer)
81
81
  end
82
82
 
@@ -122,6 +122,10 @@ module I3
122
122
  @last_write_length = @socket.write msg
123
123
  end
124
124
 
125
+ def read(len)
126
+ @socket.read(len)
127
+ end
128
+
125
129
  # connects to the given socket
126
130
  def connect
127
131
  @socket = UNIXSocket.new(@socket_path)
@@ -56,9 +56,9 @@ module I3
56
56
 
57
57
  payload = args.shift
58
58
 
59
- puts s.message(payload) unless quiet
59
+ puts s.command(payload) unless quiet
60
60
  elsif type == 1
61
- workspaces = s.get_workspace
61
+ workspaces = s.get_workspaces
62
62
  if output == :pretty_print
63
63
  require 'pp'
64
64
  pp workspaces
@@ -1,3 +1,3 @@
1
1
  module I3
2
- Version = '0.1.0'
2
+ Version = '0.1.1'
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan-Erik Rediger
@@ -31,6 +31,34 @@ dependencies:
31
31
  version: 0.12.10
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: shoulda
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 2
43
+ - 10
44
+ - 3
45
+ version: 2.10.3
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: mocha
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ - 9
58
+ - 8
59
+ version: 0.9.8
60
+ type: :runtime
61
+ version_requirements: *id003
34
62
  description: " uses the ipc socket of i3 to send commands or get information directly from the window manager. Useful for scripting the window manager.'\n"
35
63
  email: badboy@archlinux.us
36
64
  executables: