From 72f27e56db4e6814845777fea615ead23e6f991f Mon Sep 17 00:00:00 2001 From: Paul Wilde Date: Wed, 20 Jul 2022 10:00:23 +0100 Subject: [PATCH] working on fixes for wurrkspaces in sway --- i3_wurrkspaces/src/i3_wurrkspaces.nim | 43 +++------------------------ 1 file changed, 4 insertions(+), 39 deletions(-) diff --git a/i3_wurrkspaces/src/i3_wurrkspaces.nim b/i3_wurrkspaces/src/i3_wurrkspaces.nim index 35368d4..38edf34 100644 --- a/i3_wurrkspaces/src/i3_wurrkspaces.nim +++ b/i3_wurrkspaces/src/i3_wurrkspaces.nim @@ -76,21 +76,6 @@ proc switchWorkspace(workspace: string) = discard execCmd(cmd) showWorkspaces() -# proc getApplications(node: JsonNode): (seq[string],bool) = -# var apps: seq[string] = @[] -# var focused = false -# for item in node["nodes"].getElems(): -# var name = "" -# if item["focused"].getBool(): -# focused = true -# if item{"window_properties"} != nil : -# let prop = item["window_properties"] -# name = prop["class"].getStr() -# name &= " " & prop["title"].getStr() -# echo "Adding application : " & name -# apps.add(name) -# return (apps, focused) -# proc getApplication(node: JsonNode, ws: Workspace = Workspace()): Application = var app = Application() let window = node["window_properties"] @@ -102,30 +87,6 @@ proc getApplication(node: JsonNode, ws: Workspace = Workspace()): Application = #echo app.title & " " & app.class return app -# proc findWorkspaces(node: JsonNode) = -# for channel in node["nodes"].getElems(): -# case channel["type"].getStr(): -# of "workspace": -# if channel["output"].getStr() == "__i3": -# continue -# let w = channel -# let apps = getApplications(channel) -# var space = Workspace( -# num: w["num"].getInt(), -# name: w["name"].getStr(), -# focused: apps[1], -# #visible: w["visible"].getBool(), -# urgent: w["urgent"].getBool(), -# output: w["output"].getStr(), -# apps: apps[0] -# ) -# space.display_string = buildString(space) -# my_workspaces.add(space) -# else: -# echo "finding workspaces..." -# findWorkspaces(channel) -# return - proc newWorkspace(node: JsonNode): Workspace = return Workspace( num: node["num"].getInt(), @@ -146,9 +107,13 @@ proc findWorkspacesTree(node: JsonNode, parent: Workspace = Workspace()) = if node["output"].getStr() == "__i3": return ws = newWorkspace(node) + echo ws ### + echo channel if channel{"window_properties"} != nil: + #or (wayland and `something that is the same as window_properties'): let app = getApplication(channel,ws) + echo app if ws.name != "": #if app.focused: # ws.focused = true