(local { : Gtk : Gdk : WebKit2 : cairo } (require :lgi)) (local { : view } (require :fennel)) (local Command (require :command)) (local keymap (require :keymap)) (var frames []) (fn new-frame [global-keymap] (let [hpad 2 vpad 2 recogniser (keymap.recogniser global-keymap) window (Gtk.Window { :title "Dunlin" :default_width 800 :default_height 720 :on_destroy Gtk.main_quit }) container (Gtk.Box { :orientation Gtk.Orientation.VERTICAL }) progress-bar (Gtk.ProgressBar { :orientation Gtk.Orientation.HORIZONTAL :fraction 1.0 :margin 0 }) contentwidget (Gtk.Box { :orientation Gtk.Orientation.VERTICAL }) ] (tset window :on_key_release_event (fn [window event] (when (not (Command.active?)) (match (recogniser:accept-event event) c (c) (nil prompt) (print "prompted" prompt))) (when (and event.state.MOD1_MASK (= event.keyval (string.byte "x"))) (Command.activate)))) (doto container (: :pack_start Command.widget false false vpad) (: :pack_start progress-bar false false vpad) (: :pack_start contentwidget true true vpad)) (window:add container) (window:show_all) (let [f { :window window :buffer nil :content contentwidget :show-buffer (fn [self b] (each [_ w (pairs (contentwidget:get_children))] (w:hide)) (contentwidget:pack_start b.webview true true 0) (b.webview:show)) }] (table.insert frames f) f))) { :new new-frame :frames frames }