|
@ -3,6 +3,11 @@ import threadpool, osproc, tables, sequtils |
|
|
|
|
|
|
|
|
var root : TWindow |
|
|
var root : TWindow |
|
|
|
|
|
|
|
|
|
|
|
proc handleBadWindow(display : PDisplay, ev : PXErrorEvent) : cint {.cdecl.} = |
|
|
|
|
|
# resourceID maps to the Window's XID |
|
|
|
|
|
# ev.resourceID |
|
|
|
|
|
0 |
|
|
|
|
|
|
|
|
template HandleKey(key : TKeySym, body : untyped) : untyped = |
|
|
template HandleKey(key : TKeySym, body : untyped) : untyped = |
|
|
block: |
|
|
block: |
|
|
if (XLookupKeySym(cast[PXKeyEvent](ev.xkey.addr), 0) == key.cuint): |
|
|
if (XLookupKeySym(cast[PXKeyEvent](ev.xkey.addr), 0) == key.cuint): |
|
@ -144,6 +149,8 @@ when isMainModule: |
|
|
|
|
|
|
|
|
var openProcesses = initTable[int, Process]() # hashset of processes |
|
|
var openProcesses = initTable[int, Process]() # hashset of processes |
|
|
|
|
|
|
|
|
|
|
|
discard XSetErrorHandler(handleBadWindow) |
|
|
|
|
|
|
|
|
while true: |
|
|
while true: |
|
|
let processExited = processChan.tryRecv() |
|
|
let processExited = processChan.tryRecv() |
|
|
|
|
|
|
|
|