dunlin/dunlin.fnl

37 lines
1.1 KiB
Fennel

(local lgi (require :lgi))
(local lfs (require :lfs))
(local { : Gtk : Gdk : WebKit2 : cairo } lgi)
(local Command (require :command))
(local Frame (require :frame))
(local Buffer (require :buffer))
(local search (require :search))
;;; when we decide how to do an init file/rc file, this will go in it
(local my-keymap {
"g" ["visit-location" {:buffer #$1.buffer }]
"BackSpace" ["back" {:buffer #$1.buffer }]
"M-q" ["quit-browser" {}]
"C-x" {
"C-c" ["quit-browser" {}]
"b" ["switch-to-buffer" {}]
}
})
(local history (require :history))
(tset _G :history (history.open
(.. (os.getenv "HOME") "/.dunlin-history.db")))
(let [f (Frame.new my-keymap)
b (Buffer.new "main")]
(f:show-buffer b)
(b:visit (.. "file://" (lfs.currentdir) "/doc/index.html")))
(let [socketdir (or (os.getenv "XDG_RUNTIME_DIR") (os.getenv "HOME"))]
((. (require :socket-repl) :start)
(.. socketdir "/dunlin.sock")))
(Gtk.main)