i3-ipc 0.1.4 → 0.2.0
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.
- data/README.markdown +4 -4
- data/Rakefile +27 -29
- data/lib/i3-ipc.rb +95 -67
- data/lib/i3-ipc/runner.rb +27 -22
- data/lib/i3-ipc/standalone.rb +1 -1
- data/lib/i3-ipc/subscription.rb +4 -3
- data/lib/i3-ipc/version.rb +1 -1
- data/man/i3-ipc.1 +20 -26
- data/man/i3-ipc.1.html +85 -76
- metadata +101 -75
data/README.markdown
CHANGED
@@ -58,10 +58,10 @@ There are 3 arguments passed to the block:
|
|
58
58
|
To send data to the socket, you need to use `em.send_data`.
|
59
59
|
* `type` is the received message type.
|
60
60
|
This could be one of
|
61
|
-
* MESSAGE\
|
62
|
-
* MESSAGE\
|
63
|
-
* MESSAGE\
|
64
|
-
* MESSAGE\
|
61
|
+
* MESSAGE\_TYPE\_COMMAND
|
62
|
+
* MESSAGE\_TYPE\_GET\_WORKSPACES
|
63
|
+
* MESSAGE\_TYPE\_SUBSCRIBE
|
64
|
+
* MESSAGE\_TYPE\_GET\_OUTPUTS
|
65
65
|
* EVENT\_WORKSPACE
|
66
66
|
* `data` is the received data, already parsed.
|
67
67
|
|
data/Rakefile
CHANGED
@@ -1,23 +1,24 @@
|
|
1
|
-
begin
|
2
|
-
require 'mg'
|
3
|
-
MG.new("i3-ipc.gemspec")
|
4
|
-
|
5
|
-
desc "Build a gem."
|
6
|
-
task :gem => :package
|
7
|
-
|
8
|
-
desc "Push a new version to Gemcutter and publish docs."
|
9
|
-
task :publish => [:test, :gemcutter] do
|
10
|
-
|
11
|
-
|
12
|
-
sh "git tag v#{I3::Version}"
|
13
|
-
sh "git push origin master --tags"
|
14
|
-
sh "git clean -fd"
|
15
|
-
exec "rake pages"
|
16
|
-
end
|
17
|
-
rescue LoadError
|
18
|
-
|
19
|
-
warn "
|
20
|
-
|
1
|
+
#begin
|
2
|
+
#require 'mg'
|
3
|
+
#MG.new("i3-ipc.gemspec")
|
4
|
+
|
5
|
+
#desc "Build a gem."
|
6
|
+
#task :gem => :package
|
7
|
+
|
8
|
+
#desc "Push a new version to Gemcutter and publish docs."
|
9
|
+
#task :publish => [:test, :gemcutter] do
|
10
|
+
#require_relative 'lib/i3-ipc/version'
|
11
|
+
|
12
|
+
#sh "git tag v#{I3::Version}"
|
13
|
+
#sh "git push origin master --tags"
|
14
|
+
#sh "git clean -fd"
|
15
|
+
#exec "rake pages"
|
16
|
+
#end
|
17
|
+
#rescue LoadError => e
|
18
|
+
#raise unless e.message =~ /-- mg$/
|
19
|
+
#warn "mg not available."
|
20
|
+
#warn "Install it with: gem i mg"
|
21
|
+
#end
|
21
22
|
|
22
23
|
desc "Build standalone script"
|
23
24
|
task :build => [ "build:standalone", "build:man" ]
|
@@ -27,6 +28,11 @@ task :man => "build:man" do
|
|
27
28
|
exec "man man/i3-ipc.1"
|
28
29
|
end
|
29
30
|
|
31
|
+
file "i3-ipc" => FileList.new("lib/i3-ipc.rb", "lib/i3-ipc/*.rb", "man/i3-ipc.1") do |task|
|
32
|
+
require_relative 'lib/i3-ipc/standalone'
|
33
|
+
I3::Standalone.save(task.name)
|
34
|
+
end
|
35
|
+
|
30
36
|
namespace :build do
|
31
37
|
desc "Build i3-ipc manual"
|
32
38
|
task :man do
|
@@ -34,15 +40,7 @@ namespace :build do
|
|
34
40
|
end
|
35
41
|
|
36
42
|
desc "Build standalone script"
|
37
|
-
task :standalone =>
|
38
|
-
require 'i3-ipc/standalone'
|
39
|
-
I3::Standalone.save('i3-ipc')
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
task :load_i3_ipc do
|
44
|
-
$LOAD_PATH.unshift 'lib'
|
45
|
-
require 'i3-ipc'
|
43
|
+
task :standalone => "i3-ipc"
|
46
44
|
end
|
47
45
|
|
48
46
|
Rake::TaskManager.class_eval do
|
data/lib/i3-ipc.rb
CHANGED
@@ -1,83 +1,112 @@
|
|
1
1
|
require 'socket'
|
2
|
-
require '
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
require 'yajl/json_gem'
|
3
|
+
require_relative 'i3-ipc/runner'
|
4
|
+
require_relative 'i3-ipc/subscription'
|
5
|
+
require_relative 'i3-ipc/manpage'
|
6
|
+
require_relative 'i3-ipc/version'
|
7
7
|
|
8
8
|
module I3
|
9
9
|
class IPC
|
10
10
|
MAGIC_STRING = "i3-ipc"
|
11
|
-
SOCKET_PATH = File.expand_path("~/.i3/ipc.sock")
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
COMMANDS = [
|
13
|
+
# Send a command to i3.
|
14
|
+
#
|
15
|
+
# The payload is a command for i3
|
16
|
+
# (like the commands you can bind to keys in the configuration file)
|
17
|
+
# and will be executed directly after receiving it.
|
18
|
+
#
|
19
|
+
# Returns { "success" => true } for now.
|
20
|
+
# i3 does send this reply without checks.
|
21
|
+
[0, :command, :required],
|
22
|
+
|
23
|
+
# Gets the current workspaces.
|
24
|
+
# The reply will be the list of workspaces
|
25
|
+
# (see the reply section of i3 docu)
|
26
|
+
[1, :get_workspaces, :none],
|
27
|
+
|
28
|
+
# Gets the current outputs.
|
29
|
+
# The reply will be a JSON-encoded list of outputs
|
30
|
+
# (see the reply section of i3 docu).
|
31
|
+
[3, :get_outputs, :none],
|
32
|
+
|
33
|
+
# Gets the layout tree.
|
34
|
+
# i3 uses a tree as data structure which includes every container.
|
35
|
+
# The reply will be the JSON-encoded tree
|
36
|
+
# (see the reply section of i3 docu)
|
37
|
+
[4, :get_tree, :none],
|
38
|
+
|
39
|
+
# Gets a list of marks (identifiers for containers to easily jump
|
40
|
+
# to them later).
|
41
|
+
# The reply will be a JSON-encoded list of window marks.
|
42
|
+
# (see the reply section of i3 docu)
|
43
|
+
[5, :get_marks, :none],
|
44
|
+
|
45
|
+
# Gets the configuration (as JSON map) of the workspace bar with
|
46
|
+
# the given ID.
|
47
|
+
# If no ID is provided, an array with all configured bar IDs is returned instead.
|
48
|
+
[6, :get_bar_config, :optional],
|
49
|
+
]
|
50
|
+
# Needed because subscribe is handled in submodule.
|
15
51
|
MESSAGE_TYPE_SUBSCRIBE = 2
|
16
|
-
MESSAGE_TYPE_GET_OUTPUTS = 3
|
17
|
-
|
18
|
-
MESSAGE_REPLY_COMMAND = 0
|
19
|
-
MESSAGE_REPLY_GET_WORKSPACES = 1
|
20
|
-
MESSAGE_REPLY_SUBSCRIBE = 2
|
21
|
-
MESSAGE_REPLY_GET_OUTPUTS = 3
|
22
52
|
|
23
53
|
EVENT_MASK = (1 << 31)
|
24
54
|
EVENT_WORKSPACE = (EVENT_MASK | 0)
|
25
55
|
|
56
|
+
def self.message_type_subscribe
|
57
|
+
MESSAGE_TYPE_SUBSCRIBE
|
58
|
+
end
|
59
|
+
|
60
|
+
meta = class<<self; self; end
|
61
|
+
COMMANDS.each do |(id, cmd, arg)|
|
62
|
+
meta.instance_eval {
|
63
|
+
define_method "message_type_#{cmd.downcase}" do
|
64
|
+
id
|
65
|
+
end
|
66
|
+
}
|
67
|
+
if arg == :none
|
68
|
+
define_method cmd do
|
69
|
+
write format(id)
|
70
|
+
handle_response id
|
71
|
+
end
|
72
|
+
elsif arg == :optional || arg == :required
|
73
|
+
define_method cmd do |arg|
|
74
|
+
write format(id, arg)
|
75
|
+
handle_response id
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
26
80
|
class WrongMagicCode < RuntimeError; end # :nodoc:
|
27
81
|
class WrongType < RuntimeError; end # :nodoc:
|
28
82
|
|
83
|
+
# Get socket path via i3 itself.
|
84
|
+
def self.socket_path
|
85
|
+
@@socket_path ||= `i3 --get-socketpath`.chomp
|
86
|
+
end
|
87
|
+
|
29
88
|
# connects to the given i3 ipc interface
|
30
89
|
# @param socket_path String the path to i3's socket
|
31
90
|
# @param force_connect Boolean connects to the socket if true
|
32
|
-
def initialize(
|
33
|
-
|
91
|
+
def initialize(socket=nil, force_connect=false)
|
92
|
+
@@socket_path = socket if socket
|
34
93
|
connect if connect
|
35
94
|
end
|
36
95
|
|
37
96
|
# shortcut
|
38
|
-
def self.subscribe(list, socket_path=
|
39
|
-
Subscription.subscribe(list, socket_path, &blk)
|
97
|
+
def self.subscribe(list, socket_path=nil, &blk)
|
98
|
+
Subscription.subscribe(list, socket_path || self.socket_path, &blk)
|
40
99
|
end
|
41
100
|
|
42
|
-
#
|
101
|
+
# Reads the reply from the socket
|
102
|
+
# and parses the returned json into a ruby object.
|
43
103
|
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
# and will be executed directly after receiving it.
|
104
|
+
# Throws WrongMagicCode when magic word is wrong.
|
105
|
+
# Throws WrongType if returned type does not match expected.
|
47
106
|
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
|
51
|
-
write format(MESSAGE_TYPE_COMMAND, payload)
|
52
|
-
handle_response MESSAGE_TYPE_COMMAND
|
53
|
-
end
|
54
|
-
|
55
|
-
# gets the current workspaces.
|
56
|
-
# the reply will be the list of workspaces
|
57
|
-
# (see the reply section of i3 docu)
|
58
|
-
def get_workspaces
|
59
|
-
write format(MESSAGE_TYPE_GET_WORKSPACES)
|
60
|
-
handle_response MESSAGE_TYPE_GET_WORKSPACES
|
61
|
-
end
|
62
|
-
|
63
|
-
# Gets the current outputs.
|
64
|
-
# The reply will be a JSON-encoded list
|
65
|
-
# of outputs
|
66
|
-
# (see the reply section of i3 docu).
|
67
|
-
def get_outputs
|
68
|
-
write format(MESSAGE_TYPE_GET_OUTPUTS)
|
69
|
-
handle_response MESSAGE_TYPE_GET_OUTPUTS
|
70
|
-
end
|
71
|
-
|
72
|
-
# reads the reply from the socket
|
73
|
-
# and parse the returned json into a ruby object
|
74
|
-
#
|
75
|
-
# throws WrongMagicCode when magic word is wrong
|
76
|
-
# throws WrongType if returned type does not match expected
|
77
|
-
#
|
78
|
-
# this is a bit duplicated code
|
79
|
-
# but I don't know a way to read the full send reply
|
80
|
-
# without knowing its length
|
107
|
+
# This is a bit duplicated code
|
108
|
+
# but I don't know a way to read the full send reply
|
109
|
+
# without knowing its length
|
81
110
|
def handle_response(type)
|
82
111
|
# reads 14 bytes
|
83
112
|
# length of "i3-ipc" + 4 bytes length + 4 bytes type
|
@@ -91,8 +120,8 @@ module I3
|
|
91
120
|
::JSON.parse(answer)
|
92
121
|
end
|
93
122
|
|
94
|
-
#
|
95
|
-
#
|
123
|
+
# Format the message.
|
124
|
+
# A typical message looks like
|
96
125
|
# "i3-ipc" <message length> <message type> <payload>
|
97
126
|
def self.format(type, payload=nil)
|
98
127
|
size = payload ? payload.to_s.bytes.count : 0
|
@@ -105,9 +134,9 @@ module I3
|
|
105
134
|
self.class.format(type, payload)
|
106
135
|
end
|
107
136
|
|
108
|
-
#
|
109
|
-
#
|
110
|
-
# but parses full reply as received by EventMachine
|
137
|
+
# Parse a full ipc response.
|
138
|
+
# Similar to handle_response,
|
139
|
+
# but parses full reply as received by EventMachine.
|
111
140
|
#
|
112
141
|
# returns an Array containing the
|
113
142
|
# reply type and the parsed data
|
@@ -126,8 +155,8 @@ module I3
|
|
126
155
|
self.class.parse_response(response)
|
127
156
|
end
|
128
157
|
|
129
|
-
#
|
130
|
-
#
|
158
|
+
# Writes message to the socket.
|
159
|
+
# If socket is not connected, it connects first.
|
131
160
|
def write(msg)
|
132
161
|
connect if @socket.nil? || closed?
|
133
162
|
@last_write_length = @socket.write msg
|
@@ -137,20 +166,19 @@ module I3
|
|
137
166
|
@socket.read(len)
|
138
167
|
end
|
139
168
|
|
140
|
-
#
|
169
|
+
# Connects to the given socket.
|
141
170
|
def connect
|
142
|
-
@socket = UNIXSocket.new(
|
171
|
+
@socket = UNIXSocket.new(self.class.socket_path)
|
143
172
|
end
|
144
173
|
|
145
|
-
#
|
174
|
+
# Closes the socket connection.
|
146
175
|
def close
|
147
176
|
@socket.close
|
148
177
|
end
|
149
178
|
|
150
|
-
#
|
179
|
+
# Alias for @socket.closed? for easy access
|
151
180
|
def closed?
|
152
181
|
@socket.closed?
|
153
182
|
end
|
154
183
|
end
|
155
184
|
end
|
156
|
-
|
data/lib/i3-ipc/runner.rb
CHANGED
@@ -6,7 +6,8 @@ module I3
|
|
6
6
|
extend self
|
7
7
|
OUTPUT = $stdout
|
8
8
|
|
9
|
-
def format_output(object, output)
|
9
|
+
def format_output(object, output, quiet)
|
10
|
+
return if quiet
|
10
11
|
if output == :pretty_print
|
11
12
|
PP.pp(object, OUTPUT)
|
12
13
|
elsif output == :json
|
@@ -21,16 +22,16 @@ module I3
|
|
21
22
|
trap('SIGINT') { EM.stop; puts }
|
22
23
|
I3::IPC.subscribe([:workspace], path) do |em, type, data|
|
23
24
|
case type
|
24
|
-
when I3::IPC
|
25
|
-
format_output data, output
|
25
|
+
when I3::IPC.message_type_get_workspaces
|
26
|
+
format_output data, output, false
|
26
27
|
when I3::IPC::EVENT_WORKSPACE
|
27
|
-
em.send_data I3::IPC.format(I3::IPC
|
28
|
+
em.send_data I3::IPC.format(I3::IPC.message_type_get_workspaces)
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
33
|
def execute(*args)
|
33
|
-
socket_file =
|
34
|
+
socket_file = nil
|
34
35
|
type = 0
|
35
36
|
quiet = false
|
36
37
|
output = :default
|
@@ -38,12 +39,12 @@ module I3
|
|
38
39
|
opts = OptionParser.new do |opts|
|
39
40
|
opts.banner = "Usage: i3-ipc [options] [message]"
|
40
41
|
|
41
|
-
s_desc = 'Set socket file, defaults to
|
42
|
+
s_desc = 'Set socket file, defaults to `i3 --get-socketpath` output'
|
42
43
|
opts.on('-s SOCKET', '--socket SOCKET', s_desc) do |s|
|
43
44
|
socket_file = File.expand_path(s)
|
44
45
|
end
|
45
46
|
|
46
|
-
t_desc = 'Set type, 0 = command, 1 = workspace list, 2 = subscribe to workspace event, 3 = output list, default: 0'
|
47
|
+
t_desc = 'Set type, 0 = command, 1 = workspace list, 2 = subscribe to workspace event, 3 = output list, 4 = tree list, default: 0'
|
47
48
|
opts.on('-tTYPE', '--type TYPE', Integer, t_desc) do |t|
|
48
49
|
type = t
|
49
50
|
end
|
@@ -72,24 +73,28 @@ module I3
|
|
72
73
|
|
73
74
|
opts.parse!(args)
|
74
75
|
|
75
|
-
|
76
|
+
socket_file ||= I3::IPC.socket_path
|
76
77
|
|
77
|
-
|
78
|
-
when 0
|
79
|
-
if args.empty?
|
80
|
-
abort "error: message type needs a message"
|
81
|
-
end
|
82
|
-
|
83
|
-
payload = args.shift
|
84
|
-
OUTPUT.puts s.command(payload).inspect unless quiet
|
85
|
-
when I3::IPC::MESSAGE_TYPE_GET_WORKSPACES
|
86
|
-
format_output s.get_workspaces, output
|
87
|
-
when I3::IPC::MESSAGE_REPLY_SUBSCRIBE
|
78
|
+
if type == I3::IPC.message_type_subscribe
|
88
79
|
subscribe socket_file, output
|
89
|
-
when I3::IPC::MESSAGE_TYPE_GET_OUTPUTS
|
90
|
-
format_output s.get_outputs, output
|
91
80
|
else
|
92
|
-
|
81
|
+
i3 = I3::IPC.new(socket_file)
|
82
|
+
arg = I3::IPC::COMMANDS.find {|t| t.first == type}
|
83
|
+
if arg
|
84
|
+
if arg.last == :none
|
85
|
+
format_output i3.send(arg[1]), output, quiet
|
86
|
+
elsif arg.last == :required
|
87
|
+
payload = args.shift
|
88
|
+
if payload.nil?
|
89
|
+
abort "error: payload needed."
|
90
|
+
else
|
91
|
+
format_output i3.send(arg[1], payload), output, quiet
|
92
|
+
end
|
93
|
+
elsif arg.last == :optional
|
94
|
+
payload = args.shift
|
95
|
+
format_output i3.send(arg[1], payload), output, quiet
|
96
|
+
end
|
97
|
+
end
|
93
98
|
end
|
94
99
|
end
|
95
100
|
end
|
data/lib/i3-ipc/standalone.rb
CHANGED
data/lib/i3-ipc/subscription.rb
CHANGED
@@ -5,7 +5,7 @@ module I3
|
|
5
5
|
extend self
|
6
6
|
|
7
7
|
class SubscriptionConnection < EM::Connection
|
8
|
-
def self.connect(subscription_list, socket_path=
|
8
|
+
def self.connect(subscription_list, socket_path=nil, &blk)
|
9
9
|
new_klass = Class.new(self)
|
10
10
|
new_klass.send(:define_method, :initialize) do
|
11
11
|
@subscription_list = subscription_list
|
@@ -16,7 +16,7 @@ module I3
|
|
16
16
|
|
17
17
|
# send subscription to i3
|
18
18
|
def post_init
|
19
|
-
send_data I3::IPC.format(I3::IPC
|
19
|
+
send_data I3::IPC.format(I3::IPC.message_type_subscribe,
|
20
20
|
@subscription_list.to_json)
|
21
21
|
end
|
22
22
|
|
@@ -26,7 +26,8 @@ module I3
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def subscribe(subscription_list, socket_path=
|
29
|
+
def subscribe(subscription_list, socket_path=nil, &blk)
|
30
|
+
socket_path ||= I3::IPC.socket_path
|
30
31
|
EM.run do
|
31
32
|
SubscriptionConnection.connect(subscription_list,
|
32
33
|
socket_path, &blk)
|
data/lib/i3-ipc/version.rb
CHANGED
data/man/i3-ipc.1
CHANGED
@@ -1,67 +1,61 @@
|
|
1
|
-
.\" generated with Ronn/v0.
|
2
|
-
.\" http://github.com/rtomayko/ronn/
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "I3\-IPC" "1" "
|
4
|
+
.TH "I3\-IPC" "1" "August 2012" "badboy" "i3-ipc Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
|
-
\fBi3\-ipc\fR
|
7
|
+
\fBi3\-ipc\fR \- inter\-process communication with i3
|
8
8
|
.
|
9
9
|
.SH "SYNOPSIS"
|
10
10
|
\fBi3\-ipc\fR [\fB\-s\fR] [\fB\-t type\fR] [\fB\-p\fR] [\fB\-j\fR] [\fB\-q\fR] [\fBmessage\fR]
|
11
11
|
.
|
12
12
|
.SH "DESCRIPTION"
|
13
|
-
\fBi3\-ipc\fR can be used to communicate with i3, the improved tiling window manager, through the provided ipc socket
|
13
|
+
\fBi3\-ipc\fR can be used to communicate with i3, the improved tiling window manager, through the provided ipc socket\. Useful for scripting the window manager\.
|
14
14
|
.
|
15
15
|
.P
|
16
16
|
Currently implemented message types of i3 are the following:
|
17
17
|
.
|
18
18
|
.TP
|
19
19
|
\fB0 (COMMAND)\fR
|
20
|
-
|
21
|
-
(like the commands you can bind to keys in the configuration file)
|
22
|
-
The command will be executed directly after receiving it.
|
23
|
-
The reply will be always {"succes":true} for now.
|
20
|
+
The payload of the message is a command for i3 (like the commands you can bind to keys in the configuration file) The command will be executed directly after receiving it\. The reply will be always {"succes":true} for now\.
|
24
21
|
.
|
25
22
|
.TP
|
26
23
|
\fB1 (GET_WORKSPACES)\fR
|
27
|
-
|
28
|
-
The reply will be a JSON\-encoded list of workspaces.
|
24
|
+
Gets the current workspaces\. The reply will be a JSON\-encoded list of workspaces\.
|
29
25
|
.
|
30
26
|
.TP
|
31
27
|
\fB2 (SUBSCRIBE)\fR
|
32
|
-
|
28
|
+
Subscribes your connection to the \fBworkspace\fR event\.
|
33
29
|
.
|
34
30
|
.TP
|
35
31
|
\fB3 (GET_OUTPUTS)\fR
|
36
|
-
|
37
|
-
The reply will be a JSON\-encoded list of outputs.
|
32
|
+
Gets the current outputs\. The reply will be a JSON\-encoded list of outputs\.
|
38
33
|
.
|
39
34
|
.SH "OPTIONS"
|
40
|
-
\fBi3\-ipc\fR's default mode of operation is to send the command (type 0) specified on the command line
|
35
|
+
\fBi3\-ipc\fR\'s default mode of operation is to send the command (type 0) specified on the command line\.
|
41
36
|
.
|
42
37
|
.P
|
43
38
|
These options can be used to change this behavior:
|
44
39
|
.
|
45
40
|
.TP
|
46
41
|
\fB\-s\fR, \fB\-\-socket\fR
|
47
|
-
Set the socket file, defaults to
|
42
|
+
Set the socket file, defaults to ~/\.i3/ipc\.sock
|
48
43
|
.
|
49
44
|
.TP
|
50
45
|
\fB\-t\fR, \fB\-\-type\fR
|
51
|
-
Set the type
|
52
|
-
type 2 subscribes to the workspace stream, type 3 gets the current output list.
|
46
|
+
Set the type\. Passing a type of 0 is the default and will send the specified command, type 1 gets the current workspace list, type 2 subscribes to the workspace stream, type 3 gets the current output list\.
|
53
47
|
.
|
54
48
|
.TP
|
55
49
|
\fB\-p\fR, \fB\-\-pretty\-print\fR
|
56
|
-
This will pretty print the received reply
|
50
|
+
This will pretty print the received reply\. Useful for the workspace list\.
|
57
51
|
.
|
58
52
|
.TP
|
59
53
|
\fB\-j\fR, \fB\-\-json\fR
|
60
|
-
This will print the received reply as raw json\-encoded data
|
54
|
+
This will print the received reply as raw json\-encoded data\. Useful to pass to another script\.
|
61
55
|
.
|
62
56
|
.TP
|
63
57
|
\fB\-q\fR, \fB\-\-quiet\fR
|
64
|
-
Turn off the output
|
58
|
+
Turn off the output\. Useful for command mode\.
|
65
59
|
.
|
66
60
|
.TP
|
67
61
|
\fBmessage\fR
|
@@ -72,11 +66,11 @@ You may additionally ask for help:
|
|
72
66
|
.
|
73
67
|
.TP
|
74
68
|
\fB\-h\fR, \fB\-\-help\fR
|
75
|
-
Print help
|
69
|
+
Print help\.
|
76
70
|
.
|
77
71
|
.TP
|
78
72
|
\fB\-m\fR, \fB\-\-man\fR
|
79
|
-
Display this man page
|
73
|
+
Display this man page\.
|
80
74
|
.
|
81
75
|
.SH "EXAMPLES"
|
82
76
|
.
|
@@ -90,10 +84,10 @@ $ i3\-ipc "exec xterm"
|
|
90
84
|
.fi
|
91
85
|
.
|
92
86
|
.SH "BUGS"
|
93
|
-
\fIhttp://github
|
87
|
+
\fIhttp://github\.com/badboy/i3\-ipc/issues\fR
|
94
88
|
.
|
95
89
|
.SH "AUTHOR"
|
96
|
-
Jan\-Erik Rediger:: badboy@archlinux
|
90
|
+
Jan\-Erik Rediger:: badboy@archlinux\.us
|
97
91
|
.
|
98
92
|
.SH "SEE ALSO"
|
99
|
-
i3(1), i3\-msg(1), \fIhttp://i3
|
93
|
+
i3(1), i3\-msg(1), \fIhttp://i3\.zekjur\.net/\fR, \fIhttp://github\.com/badboy/i3\-ipc\fR
|
data/man/i3-ipc.1.html
CHANGED
@@ -2,74 +2,83 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
-
<meta name='generator' value='Ronn/v0.
|
6
|
-
<title>i3-ipc(1)
|
7
|
-
<style type='text/css'>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
float:left; width:33%; list-style-type:none;
|
44
|
-
text-transform:uppercase; font-size:18px; color:#999;
|
45
|
-
letter-spacing:1px;}
|
46
|
-
#man ol.man { width:100%; }
|
47
|
-
#man ol.man li.tl { text-align:left }
|
48
|
-
#man ol.man li.tc { text-align:center;letter-spacing:4px }
|
49
|
-
#man ol.man li.tr { text-align:right }
|
50
|
-
#man ol.man a { color:#999 }
|
51
|
-
#man ol.man a:hover { color:#333231 }
|
5
|
+
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
|
6
|
+
<title>i3-ipc(1) - inter-process communication with i3</title>
|
7
|
+
<style type='text/css' media='all'>
|
8
|
+
/* style: man */
|
9
|
+
body#manpage {margin:0}
|
10
|
+
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
11
|
+
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
12
|
+
.mp h2 {margin:10px 0 0 0}
|
13
|
+
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
14
|
+
.mp h3 {margin:0 0 0 4ex}
|
15
|
+
.mp dt {margin:0;clear:left}
|
16
|
+
.mp dt.flush {float:left;width:8ex}
|
17
|
+
.mp dd {margin:0 0 0 9ex}
|
18
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
19
|
+
.mp pre {margin-bottom:20px}
|
20
|
+
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
21
|
+
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
22
|
+
.mp img {display:block;margin:auto}
|
23
|
+
.mp h1.man-title {display:none}
|
24
|
+
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
25
|
+
.mp h2 {font-size:16px;line-height:1.25}
|
26
|
+
.mp h1 {font-size:20px;line-height:2}
|
27
|
+
.mp {text-align:justify;background:#fff}
|
28
|
+
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
29
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
30
|
+
.mp u {text-decoration:underline}
|
31
|
+
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
32
|
+
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
33
|
+
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
34
|
+
.mp b.man-ref {font-weight:normal;color:#434241}
|
35
|
+
.mp pre {padding:0 4ex}
|
36
|
+
.mp pre code {font-weight:normal;color:#434241}
|
37
|
+
.mp h2+pre,h3+pre {padding-left:0}
|
38
|
+
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
39
|
+
ol.man-decor {width:100%}
|
40
|
+
ol.man-decor li.tl {text-align:left}
|
41
|
+
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
42
|
+
ol.man-decor li.tr {text-align:right;float:right}
|
52
43
|
</style>
|
53
44
|
</head>
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
<
|
63
|
-
|
64
|
-
|
65
|
-
<
|
66
|
-
<
|
67
|
-
|
68
|
-
<
|
45
|
+
<!--
|
46
|
+
The following styles are deprecated and will be removed at some point:
|
47
|
+
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
48
|
+
|
49
|
+
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
50
|
+
.man-navigation should be used instead.
|
51
|
+
-->
|
52
|
+
<body id='manpage'>
|
53
|
+
<div class='mp' id='man'>
|
54
|
+
|
55
|
+
<div class='man-navigation' style='display:none'>
|
56
|
+
<a href="#NAME">NAME</a>
|
57
|
+
<a href="#SYNOPSIS">SYNOPSIS</a>
|
58
|
+
<a href="#DESCRIPTION">DESCRIPTION</a>
|
59
|
+
<a href="#OPTIONS">OPTIONS</a>
|
60
|
+
<a href="#EXAMPLES">EXAMPLES</a>
|
61
|
+
<a href="#BUGS">BUGS</a>
|
62
|
+
<a href="#AUTHOR">AUTHOR</a>
|
63
|
+
<a href="#SEE-ALSO">SEE ALSO</a>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<ol class='man-decor man-head man head'>
|
67
|
+
<li class='tl'>i3-ipc(1)</li>
|
68
|
+
<li class='tc'>i3-ipc Manual</li>
|
69
|
+
<li class='tr'>i3-ipc(1)</li>
|
70
|
+
</ol>
|
71
|
+
|
72
|
+
<h2 id="NAME">NAME</h2>
|
73
|
+
<p class="man-name">
|
74
|
+
<code>i3-ipc</code> - <span class="man-whatis">inter-process communication with i3</span>
|
75
|
+
</p>
|
76
|
+
|
77
|
+
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
69
78
|
|
70
79
|
<p><code>i3-ipc</code> [<code>-s</code>] [<code>-t type</code>] [<code>-p</code>] [<code>-j</code>] [<code>-q</code>] [<code>message</code>]</p>
|
71
80
|
|
72
|
-
<h2>DESCRIPTION</h2>
|
81
|
+
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
73
82
|
|
74
83
|
<p><code>i3-ipc</code> can be used to communicate with i3, the improved tiling window manager, through the provided ipc socket. Useful for scripting the window manager.</p>
|
75
84
|
|
@@ -88,7 +97,7 @@
|
|
88
97
|
</dl>
|
89
98
|
|
90
99
|
|
91
|
-
<h2>OPTIONS</h2>
|
100
|
+
<h2 id="OPTIONS">OPTIONS</h2>
|
92
101
|
|
93
102
|
<p><code>i3-ipc</code>'s default mode of operation is to send the command (type 0) specified on the command line.</p>
|
94
103
|
|
@@ -113,7 +122,7 @@ type 2 subscribes to the workspace stream, type 3 gets the current output list.<
|
|
113
122
|
</dl>
|
114
123
|
|
115
124
|
|
116
|
-
<h2>EXAMPLES</h2>
|
125
|
+
<h2 id="EXAMPLES">EXAMPLES</h2>
|
117
126
|
|
118
127
|
<pre><code>$ i3-ipc -t 1
|
119
128
|
$ i3-ipc -t 2 -p
|
@@ -121,25 +130,25 @@ $ i3-ipc -t 3 -j
|
|
121
130
|
$ i3-ipc "exec xterm"
|
122
131
|
</code></pre>
|
123
132
|
|
124
|
-
<h2>BUGS</h2>
|
133
|
+
<h2 id="BUGS">BUGS</h2>
|
125
134
|
|
126
|
-
<p><a href="http://github.com/badboy/i3-ipc/issues">http://github.com/badboy/i3-ipc/issues</a></p>
|
135
|
+
<p><a href="http://github.com/badboy/i3-ipc/issues" data-bare-link="true">http://github.com/badboy/i3-ipc/issues</a></p>
|
127
136
|
|
128
|
-
<h2>AUTHOR</h2>
|
137
|
+
<h2 id="AUTHOR">AUTHOR</h2>
|
129
138
|
|
130
139
|
<p>Jan-Erik Rediger:: badboy@archlinux.us</p>
|
131
140
|
|
132
|
-
<h2>SEE ALSO</h2>
|
141
|
+
<h2 id="SEE-ALSO">SEE ALSO</h2>
|
133
142
|
|
134
|
-
<p>i3(1)
|
143
|
+
<p><span class="man-ref">i3<span class="s">(1)</span></span>, <span class="man-ref">i3-msg<span class="s">(1)</span></span>, <a href="http://i3.zekjur.net/" data-bare-link="true">http://i3.zekjur.net/</a>, <a href="http://github.com/badboy/i3-ipc" data-bare-link="true">http://github.com/badboy/i3-ipc</a></p>
|
135
144
|
|
136
145
|
|
137
|
-
<ol class='foot man'>
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
</ol>
|
146
|
+
<ol class='man-decor man-foot man foot'>
|
147
|
+
<li class='tl'>badboy</li>
|
148
|
+
<li class='tc'>August 2012</li>
|
149
|
+
<li class='tr'>i3-ipc(1)</li>
|
150
|
+
</ol>
|
142
151
|
|
143
|
-
</div>
|
152
|
+
</div>
|
144
153
|
</body>
|
145
154
|
</html>
|
metadata
CHANGED
@@ -1,115 +1,141 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: i3-ipc
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 4
|
9
|
-
version: 0.1.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Jan-Erik Rediger
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-03-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: eventmachine
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.12.10
|
22
|
+
type: :runtime
|
22
23
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
- 0
|
29
|
-
- 12
|
30
|
-
- 10
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
31
29
|
version: 0.12.10
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: yajl-ruby
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.1.0
|
32
38
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: shoulda
|
36
39
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.1.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: shoulda
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
45
53
|
version: 2.10.3
|
46
54
|
type: :development
|
47
|
-
|
48
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.10.3
|
62
|
+
- !ruby/object:Gem::Dependency
|
49
63
|
name: mocha
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.9.8
|
70
|
+
type: :development
|
50
71
|
prerelease: false
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
- 0
|
57
|
-
- 9
|
58
|
-
- 8
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
59
77
|
version: 0.9.8
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: ronn
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.7.3
|
60
86
|
type: :development
|
61
|
-
|
62
|
-
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.7.3
|
94
|
+
description: ! ' uses the ipc socket of i3 to send commands or get information directly
|
95
|
+
from the window manager. Useful for scripting the window manager.''
|
96
|
+
|
97
|
+
'
|
63
98
|
email: badboy@archlinux.us
|
64
|
-
executables:
|
99
|
+
executables:
|
65
100
|
- i3-ipc
|
66
101
|
extensions: []
|
67
|
-
|
68
102
|
extra_rdoc_files: []
|
69
|
-
|
70
|
-
files:
|
103
|
+
files:
|
71
104
|
- README.markdown
|
72
105
|
- Rakefile
|
73
106
|
- LICENSE
|
74
|
-
- lib/i3-ipc
|
75
|
-
- lib/i3-ipc/manpage.rb
|
107
|
+
- lib/i3-ipc.rb
|
76
108
|
- lib/i3-ipc/standalone.rb
|
77
|
-
- lib/i3-ipc/
|
109
|
+
- lib/i3-ipc/subscription.rb
|
78
110
|
- lib/i3-ipc/runner.rb
|
79
|
-
- lib/i3-ipc.rb
|
111
|
+
- lib/i3-ipc/version.rb
|
112
|
+
- lib/i3-ipc/manpage.rb
|
80
113
|
- bin/i3-ipc
|
81
114
|
- man/i3-ipc.1.html
|
82
|
-
- man/i3-ipc.1
|
83
115
|
- man/i3-ipc.1.ronn
|
84
|
-
|
116
|
+
- man/i3-ipc.1
|
85
117
|
homepage: http://github.com/badboy/i3-ipc
|
86
118
|
licenses: []
|
87
|
-
|
88
119
|
post_install_message:
|
89
120
|
rdoc_options: []
|
90
|
-
|
91
|
-
require_paths:
|
121
|
+
require_paths:
|
92
122
|
- lib
|
93
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
|
105
|
-
- 0
|
106
|
-
version: "0"
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
107
135
|
requirements: []
|
108
|
-
|
109
136
|
rubyforge_project:
|
110
|
-
rubygems_version: 1.
|
137
|
+
rubygems_version: 1.8.25
|
111
138
|
signing_key:
|
112
139
|
specification_version: 3
|
113
140
|
summary: inter-process communication with i3, the improved tiling window manager.
|
114
141
|
test_files: []
|
115
|
-
|