~aleteoryx/tclircc

ref: b8279c2d003cd7f1b2229dffef8878498eddee48 tclircc/main.tcl -rwxr-xr-x 839 bytes
b8279c2daleteoryx more ui work a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/env tclsh

set path [file dirname [dict get [info frame 0] file]]
set version v0.0.1

package require Thread
package require logger
set log [logger::init tclircc::main]

${log}::info "tclircc $version <https://amehut.dev/~aleteoryx/tclircc>"
${log}::info "running from $path"

${log}::debug "starting ui thread..."
set ui_thread [thread::create -preserved]
thread::send $ui_thread [list variable path $path version $version]
if {[thread::send $ui_thread [list source "$path[file separator]ui[file separator]main.tcl"] result] == 1} {
  ${log}::critical "couldn't start ui thread: $result"
  exit -1
}
${log}::debug "started ui thread."

${log}::debug "opening main window..."
thread::send $ui_thread {mk_toplevel name; return $name} mainwin
${log}::debug "main window opened: $mainwin"

${log}::info "entering event loop"
vwait nil