From b4362b230a66217ecb4d3982cbe2c994464b3ea5 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Wed, 16 Feb 2022 21:55:09 +0000 Subject: [PATCH 1/3] add shell.nix --- just/shell.nix | 1 + 1 file changed, 1 insertion(+) create mode 100644 just/shell.nix diff --git a/just/shell.nix b/just/shell.nix new file mode 100644 index 0000000..a760f25 --- /dev/null +++ b/just/shell.nix @@ -0,0 +1 @@ +with import {} ; callPackage ./. {} From 34e5b3617230d979818eef5d8874f5f2e4c277de Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Wed, 16 Feb 2022 21:56:32 +0000 Subject: [PATCH 2/3] move "new tab" button to the tabs page clear and disable url entry on the tabs page --- just/just.fnl | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/just/just.fnl b/just/just.fnl index fc0fd49..baaddf4 100644 --- a/just/just.fnl +++ b/just/just.fnl @@ -160,7 +160,6 @@ progress, trough { (box:add (Gtk.Label { :label "Open tabs" })) - (each [i w (pairs tabs)] (when (> i 0) (box:pack_start @@ -173,6 +172,15 @@ progress, trough { (load-webview-thumbnail w)) false false 5))) + (box:pack_start (Gtk.Button + { + :label " + " + :width 300 + :height 200 + :on_clicked #(bus:publish $1 :new-tab) + }) + false false 5) + (scrolledwindow:add box) (scrolledwindow:show_all) )) @@ -225,7 +233,11 @@ progress, trough { :new-tab new-tab :current-tab current :widget widget - :show-tab-overview #(widget:set_current_page 0) + :show-tab-overview (fn [] + (widget:set_current_page 0) + (bus:publish tab-overview :url-changed false) + (bus:publish tab-overview :title-changed "Open tabs")) + })) (let [current-url "https://terse.telent.net" @@ -255,10 +267,6 @@ progress, trough { :on_clicked #(bus:publish $1 :stop-loading) }) (: :set_image (named-image "process-stop"))) - new-tab (Gtk.Button { - :on_clicked #(bus:publish $1 :new-tab) - :label "➕" - }) refresh (doto (Gtk.Button { :on_clicked #(bus:publish $1 :reload) }) @@ -277,7 +285,10 @@ progress, trough { (= (views:current-tab) tab))] (bus:subscribe :url-changed - #(when (visible? $1) (url:set_text $2))) + #(when (visible? $1) + (doto url + (: :set_text (or $2 "")) + (: :set_editable (and $2 true))))) (bus:subscribe :title-changed #(when (visible? $1) @@ -302,7 +313,6 @@ progress, trough { (nav-bar:pack_start stop false false 2) (nav-bar:pack_start url true true 2) (nav-bar:pack_end show-tabs false false 2) - (nav-bar:pack_end new-tab false false 2) (container:pack_start nav-bar false false 5) (container:pack_start progress-bar false false 0) From f9e69672a99919dbc60faa3687b0b9c0cc6137fc Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Wed, 16 Feb 2022 22:15:57 +0000 Subject: [PATCH 3/3] start new tabs with non-nil url this does suggest that our logic for (whether the url entry is editable) is rather a kludge --- just/just.fnl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/just/just.fnl b/just/just.fnl index baaddf4..d1fed0e 100644 --- a/just/just.fnl +++ b/just/just.fnl @@ -195,13 +195,16 @@ progress, trough { (when (= num 0) (update-tab-overview bus tabs page))) }) - new-tab (fn [self child] - (let [v (or child (new-webview bus)) - i (widget:append_page v)] + add-page (fn [v] + (let [i (widget:append_page v)] (tset tabs i v) (v:show) (set widget.page i) v)) + new-tab (fn [self] + (let [v (add-page (new-webview bus))] + (v:load_uri "about:blank") + v)) tab-overview (Gtk.ScrolledWindow) current #(. tabs widget.page)] (bus:subscribe :fetch #(match (current) c (c:load_uri $2))) @@ -227,7 +230,7 @@ progress, trough { (tset tabs i nil) (update-tab-overview bus tabs tab-overview) (widget:set_current_page 0))) - (new-tab nil tab-overview) + (add-page tab-overview) { :new-tab new-tab