add the rest of the redrawevents

This commit is contained in:
Daylin Morgan 2024-10-20 15:45:05 -05:00
parent 795e6941f8
commit f5b54f962f
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 18 additions and 19 deletions

View file

@ -104,21 +104,32 @@ proc writeEwwClasses*() =
stdout.write (ewwClasses.toJson() & "\n") stdout.write (ewwClasses.toJson() & "\n")
flushFile stdout flushFile stdout
const redrawEvents = [
"workspacev2", # emitted on workspace change. Is emitted ONLY when a user requests a workspace change, and is not emitted on mouse movements (see activemon) WORKSPACEID,WORKSPACENAME
"focusedmon", # emitted on the active monitor being changed. MONNAME,WORKSPACENAME
"activewindowv2", # emitted on the active window being changed. WINDOWADDRESS
"fullscreen", # emitted when a fullscreen status of a window changes. 0/1 (exit fullscreen / enter fullscreen)
"monitorremoved", # emitted when a monitor is removed (disconnected) MONITORNAME
"monitoraddedv2", # emitted when a monitor is added (connected) MONITORID,MONITORNAME,MONITORDESCRIPTION
"createworkspacev2", # emitted when a workspace is created WORKSPACEID,WORKSPACENAME
"destroyworkspacev", # emitted when a workspace is destroyed WORKSPACEID,WORKSPACENAME
"moveworkspacev2", # emitted when a workspace is moved to a different monitor WORKSPACEID,WORKSPACENAME,MONNAME
"openwindow", # emitted when a window is opened WINDOWADDRESS,WORKSPACENAME,WINDOWCLASS,WINDOWTITLE
"closewindow", # emitted when a window is closed WINDOWADDRESS
"movewindowv2", # emitted when a window is moved to a workspace WINDOWADDRESS,WORKSPACEID,WORKSPACENAME
]
proc handleHyprEvent(event: string) = proc handleHyprEvent(event: string) =
let let
s = event.split(">>", 1) s = event.split(">>", 1)
event = s[0] event = s[0]
# use enum? if event == "monitoraddedv2":
case event:
of "monitoraddedv2":
# TODO: open as many bars as necessary depending on num monitors # TODO: open as many bars as necessary depending on num monitors
# is it ok to just call open bar again?
notify("monitor added") notify("monitor added")
of "openwindow", "workspacev2":
writeEwwClasses()
else: discard
if event in redrawEvents:
writeEwwClasses()
proc watchHyprland*() = proc watchHyprland*() =
let socket = newSocket(AF_UNIX, SOCK_STREAM, IPPROTO_IP) let socket = newSocket(AF_UNIX, SOCK_STREAM, IPPROTO_IP)
@ -133,4 +144,3 @@ proc watchHyprland*() =
var line: string var line: string
socket.readLine line socket.readLine line
handleHyprEvent line handleHyprEvent line

View file

@ -41,14 +41,3 @@ when isMainModule:
[watch , usage = clCfg.use], [watch , usage = clCfg.use],
[swww , usage = clCfg.use], [swww , usage = clCfg.use],
) )
#!/usr/bin/env bash
#[
DIR=./woodblock-cherry-blossom/
while : ; do
for file in $(find $DIR -type f -name '*.png');do
swww img "$file" --transition-type wave
sleep 3600
done
done
]#