distro specific fixes
[distro-setup] / i3-event-hook
index 196e6081296f73f0fe343f86918226f223294c25..87487c6ebdcc0fac84584bf1045533e1d4917a30 100755 (executable)
@@ -39,26 +39,26 @@ from i3ipc import Connection, Event
 from pprint import pprint
 
 
-def find_parent(i3, window_id):
+def find_workspace(i3, window_id):
     """
-        Find the parent of a given window id
+        Find the workspace of a given window id
     """
 
-    def finder(con, parent, workspace):
+    def finder(con, workspace):
         if con.id == window_id:
-            return (parent, workspace)
+            return (workspace)
         for node in con.nodes:
-            res = finder(node, con, con if con and con.type == 'workspace' else workspace)
+            res = finder(node, con if con and con.type == 'workspace' else workspace)
             if res:
                 return res
         return None
 
-    return finder(i3.get_tree(), None, None)
+    return finder(i3.get_tree(), None)
 
 
 def kill_single_win_containers(i3, e, node, parent):
     if len(parent.nodes) == 1 and len(node.nodes) == 0:
-        print("d1: killing parent")
+        #print("d1: killing parent")
         # parent is a single window container, kill it.
 
         # Note: based on testing,
@@ -67,10 +67,10 @@ def kill_single_win_containers(i3, e, node, parent):
         # we could create our disabling file here
         # and delete it later if it wasn't already there.
         i3.command('[con_id=%s] focus' % node.id)
-        i3.command('mark i3ha')
+        i3.command('mark --add i3ha')
         i3.command('focus parent')
         i3.command('focus parent')
-        i3.command('mark i3hb')
+        i3.command('mark --add i3hb')
         i3.command('[con_mark="i3ha"] focus')
         i3.command('move window to mark i3hb')
         i3.command('unmark i3ha')
@@ -98,7 +98,7 @@ def focus_hook(i3, e):
     # 'window': None,
     # 'window_type': None,
 
-    parent, workspace = find_parent(i3, e.container.id)
+    workspace = find_workspace(i3, e.container.id)
     # debugging
     #exit(0)