foo-wm

(Archived) Experimental Zooming IPC-based WM
git clone http://milesalan.com/git/foo-wm
Log | Files | Refs | Mirror | README | LICENSE

commit 265ee29659b530e7273d0821299662fae130fd61
parent 3d227cb44d76aec46f4247bc27a27dcab96a4323
Author: = <miles.sandlar@gmail.com>
Date:   Thu, 18 Oct 2012 21:23:44 -0400

Added a working uncontainerize command

Diffstat:
Ascripts/marks.rb | 25+++++++++++++++++++++++++
Ascripts/uncontainerize.rb | 33+++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/scripts/marks.rb b/scripts/marks.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby +require 'socket' +require 'json' +require 'pp' +$socketPath = "/tmp/foo-wm.socket" + +def sendCommand(command) + response = "" + sock = UNIXSocket.open($socketPath) + sock.send command, 0 + loop do + if (sock.recv(1, Socket::MSG_PEEK) == "") then + break + end + response = "#{response}#{sock.recv(1)}" + end + + return response +end + +tree = sendCommand('get marks')[0..-2] +(JSON tree)["marks"].each do |mark| + puts mark +end + diff --git a/scripts/uncontainerize.rb b/scripts/uncontainerize.rb @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby +require 'socket' +require 'json' +require 'pp' +$socketPath = "/tmp/foo-wm.socket" + +def sendCommand(command) + response = "" + sock = UNIXSocket.open($socketPath) + sock.send command, 0 + loop do + if (sock.recv(1, Socket::MSG_PEEK) == "") then + break + end + response = "#{response}#{sock.recv(1)}" + end + + return response +end + +jsonTree = sendCommand('get focus')[0..-2] + +tree = JSON.parse(jsonTree); +if (tree["type"] != "container") then + puts "uncontainerize may only be used on a container" + exit +end + +tree["children"].each do |child| + nodeId = child["id"] + sendCommand("focus id #{child['id']}") + sendCommand("shift pc -1") +end