Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: badboy/i3-ipc
base: 649e69a86a
...
head fork: badboy/i3-ipc
compare: df7d738910
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Showing with 11 additions and 0 deletions.
  1. +9 −0 lib/i3-ipc.rb
  2. +2 −0  lib/i3-ipc/runner.rb
View
9 lib/i3-ipc.rb
@@ -14,11 +14,13 @@ class IPC
MESSAGE_TYPE_GET_WORKSPACES = 1
MESSAGE_TYPE_SUBSCRIBE = 2
MESSAGE_TYPE_GET_OUTPUTS = 3
+ MESSAGE_TYPE_GET_TREE = 4
MESSAGE_REPLY_COMMAND = 0
MESSAGE_REPLY_GET_WORKSPACES = 1
MESSAGE_REPLY_SUBSCRIBE = 2
MESSAGE_REPLY_GET_OUTPUTS = 3
+ MESSAGE_REPLY_GET_TREE = 4
EVENT_MASK = (1 << 31)
EVENT_WORKSPACE = (EVENT_MASK | 0)
@@ -69,6 +71,13 @@ def get_outputs
handle_response MESSAGE_TYPE_GET_OUTPUTS
end
+ # gets current visible windows in form of a tree
+ # JSON-encoded, just like everything else
+ def get_tree
+ write format(MESSAGE_TYPE_GET_TREE)
+ handle_response MESSAGE_TYPE_GET_TREE
+ end
+
# reads the reply from the socket
# and parse the returned json into a ruby object
#
View
2  lib/i3-ipc/runner.rb
@@ -88,6 +88,8 @@ def execute(*args)
subscribe socket_file, output
when I3::IPC::MESSAGE_TYPE_GET_OUTPUTS
format_output s.get_outputs, output
+ when I3::IPC::MESSAGE_TYPE_GET_TREE
+ format_output s.get_tree, output
else
abort "error: type #{type} not yet implemented"
end

No commit comments for this range

Something went wrong with that request. Please try again.