commit 38c71c347ec3566a32e5a08f1063642fafbbcfc1 Author: Daniel Barlow Date: Mon Dec 19 18:19:13 2022 +0000 initial commit diff --git a/dunlin.fnl b/dunlin.fnl new file mode 100644 index 0000000..fdb18f9 --- /dev/null +++ b/dunlin.fnl @@ -0,0 +1,15 @@ +(local lgi (require :lgi)) +(local { : Gtk : Gdk : WebKit2 : cairo } lgi) + +(fn invoke-command [command] + ) + +(set _G.invoke-commad invoke-command) + +(local pane (require :pane)) + + + + +(pane.new) +(Gtk.main) diff --git a/musing.md b/musing.md new file mode 100644 index 0000000..22abe32 --- /dev/null +++ b/musing.md @@ -0,0 +1,68 @@ +what if ... a web browser, but tabs were more like emacs buffers? + +buffer attributes: +- url +- viewport (this is a departure from the emacs buffer) + +## commands + +A command is a description of a function that may be invoked +interactively, and the parameters it expects. + +```fennel +(define-command "visit-location" + visit-location + {:url Type.Url input-from-minibuffer}) + +;; hit "g" and then enter the location in the minibuffer +(bind-key "g" (command "visit-location")) +;; hit "h" to go straight to your home page +(bind-key "h" (command "visit-location") + {:url (Type.Url "https://home.example.com")}) +;; left mouse click on minibuffer hit "h" to go straight to your home page +(bind-event Dunlin.minibuffer :button-1-click (command "visit-location")) +``` + +when it is run from the command prompt, each parameter is +prompted, with appropriate defaults. + +when it is bound to a key chord/sequence, the binding may specify +where it gets its parameters from - otherise + +visit-location +visit-location-in-new-buffer +run-command +back +switch-to-buffer +save-file +save-link + +## objects/data types + +buffer + Buffer.find ;; by name, title, url + Buffer.by_name (maybe?) + + buffer has-a webview but it is not shown by default. Later we may + add some kind of webview reuse so that invisible and old buffers + don't need to have a webview until needed. + +frame + Frame.the-frame + frame.set-buffer (buffer) + frame.get-buffer => buffer + frame.commander - text entry widget + frame.actions - container of toolbar buttons + +location (url) +document +document element(?) +webview +lua's standard types + + +# getting started + +gtk stuffz for frame/commander/initial buffer +command parser hooked to commander +visit-location command diff --git a/pane.fnl b/pane.fnl new file mode 100644 index 0000000..8989790 --- /dev/null +++ b/pane.fnl @@ -0,0 +1,37 @@ +(local { : Gtk : Gdk : WebKit2 : cairo } (require :lgi)) + +(fn new-pane [] + (let [hpad 2 + vpad 2 + window (Gtk.Window { + :title "Dunlin" + :default_width 800 + :default_height 720 + :on_destroy Gtk.main_quit + }) + container (Gtk.Box { + :orientation Gtk.Orientation.VERTICAL + }) + commander (Gtk.Entry { + :on_activate + (fn [event] + (_G.invoke-command event.text)) + }) + progress-bar (Gtk.ProgressBar { + :orientation Gtk.Orientation.HORIZONTAL + :fraction 1.0 + :margin 0 + }) + contentwidget (Gtk.Button { + :label "paceholder" + }) + ] + (doto container + (: :pack_start commander false false vpad) + (: :pack_start progress-bar false false vpad) + (: :pack_start contentwidget true true vpad)) + (window:add container) + (window:show_all) + window)) + +{ :new new-pane }