feat: add eww initialization

This commit is contained in:
Daylin Morgan 2024-02-08 12:56:52 -06:00
parent a4d9252d6a
commit 64641a3402
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -68,6 +68,7 @@ proc getActive(m: Monitor): int {.inline.} = m.activeWorkspace.id
proc getState(): seq[seq[WorkspaceIcon]] = proc getState(): seq[seq[WorkspaceIcon]] =
let let
monitors = parseJson(getData("[-j]/monitors")).to(seq[Monitor]) monitors = parseJson(getData("[-j]/monitors")).to(seq[Monitor])
defaultWorkspaces = getDefaultWorkspaces() defaultWorkspaces = getDefaultWorkspaces()
for m in monitors: for m in monitors:
result.add defaultWorkspaces result.add defaultWorkspaces
@ -100,7 +101,15 @@ proc reactEvent(line: string) =
discard execCmd "eww reload" discard execCmd "eww reload"
else: discard else: discard
proc initEww() =
let monitors = parseJson(getData("[-j]/monitors")).to(seq[Monitor])
discard execCmd "eww daemon"
discard execCmd "eww open bar0"
if monitors.len > 1:
discard execCmd "eww open bar1"
proc watchHyprlandEvents() {.async.} = proc watchHyprlandEvents() {.async.} =
initEww()
let let
socketPath = "/tmp/hypr" / his / ".socket2.sock" socketPath = "/tmp/hypr" / his / ".socket2.sock"
socket = newAsyncSocket(AF_UNIX, SOCK_STREAM, IPPROTO_IP) socket = newAsyncSocket(AF_UNIX, SOCK_STREAM, IPPROTO_IP)