dunlin

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit cde0b8cd56d4faae2ed6a276e7baee5666fb0ee1
parent 0befc24bc094927b889b8fbe092b1f7d7383bcc7
Author: Daniel Barlow <dan@telent.net>
Date:   Fri, 23 Dec 2022 15:21:06 +0000

pass keymap into the frame

Diffstat:
Mdunlin.fnl | 20+++++++++++++++++++-
Mframe.fnl | 19++-----------------
2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/dunlin.fnl b/dunlin.fnl @@ -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"))) diff --git a/frame.fnl b/frame.fnl @@ -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