pass keymap into the frame

main
Daniel Barlow 2022-12-23 15:21:06 +00:00
parent 0befc24bc0
commit cde0b8cd56
2 changed files with 21 additions and 18 deletions

View File

@ -2,10 +2,28 @@
(local lfs (require :lfs))
(local { : Gtk : Gdk : WebKit2 : cairo } lgi)
(local Command (require :command))
(local Frame (require :frame))
(local Buffer (require :buffer))
(let [f (Frame.new)
;;; when we decide how to do an init file/rc file, this will go in it
(local my-keymap {
"g" #(Command.invoke-interactively
"visit-location"
{:buffer "main"})
"M-q" #(Command.invoke-interactively
"quit-browser"
{})
"C-x" {
"C-c"
#(Command.invoke-interactively
"quit-browser"
{})
}
})
(let [f (Frame.new my-keymap)
b (Buffer.new "main")]
(f:show-buffer b)
(b:visit (.. "file://" (lfs.currentdir) "/doc/index.html")))

View File

@ -5,25 +5,10 @@
(var frames [])
(fn new-frame []
(fn new-frame [global-keymap]
(let [hpad 2
vpad 2
recogniser (keymap.recogniser
{
"g" #(Command.invoke-interactively
"visit-location"
{:buffer "main"})
"M-q" #(Command.invoke-interactively
"quit-browser"
{})
"c" {
"x"
#(Command.invoke-interactively
"quit-browser"
{})
}
})
recogniser (keymap.recogniser global-keymap)
window (Gtk.Window {
:title "Dunlin"
:default_width 800