Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review bookmarks panel UI #3444

Merged
merged 4 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ elements are scaled accordingly.")
(define-version "3.11.8"
(:nsection :title "UI/UX"
(:ul
(:li "Review UI of " (:nxref :command 'nyxt/mode/bookmark:bookmarks-panel) ".")
(:li "Fix mode menu bar."))))

(define-version "3.11.7"
Expand Down
2 changes: 1 addition & 1 deletion source/mode/bookmark.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ against date, given `prompter:active-attributes-keys' configuration."))
(:nsection
:title (or tag "Unsorted")
:id (or tag "unsorted")
:open-p t
:open-p nil
:anchor-p nil
(dolist (bookmark bookmarks)
(:a :href (render-url (url bookmark))
Expand Down
26 changes: 12 additions & 14 deletions source/mode/buffer-listing.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,26 @@ shown linearly instead."
:class "success"
`(reload-panel-buffer ,panel-buffer))))))

(defun reload-panel-buffer (panel-buffer)
(defun reload-panel-buffer (panel-buffer &optional (window (current-window)))
(reload-buffer (find (render-url (url panel-buffer))
(nyxt::panel-buffers (current-window))
(nyxt::panel-buffers window)
:test #'string=
:key (compose #'render-url #'url))))

(defun buffers-panel-handler-set-buffer (window buffer)
(declare (ignore buffer))
(alex:when-let ((panel-buffer (first (nyxt::panel-buffers window))))
(reload-panel-buffer panel-buffer)))
;; Doesn't take into account the multi-window case. That would require a
;; refactor of the `panel-buffer' class and how panel buffers are found in (setf
;; form) of `internal-page'.
(defun reload-buffers-panel-handler (window buffer)
(declare (ignore window buffer))
(alex:when-let ((buffers-panel (find-panel-buffer 'buffers-panel)))
(reload-panel-buffer buffers-panel)))

(define-configuration window
((window-set-buffer-hook
(hooks:add-hook %slot-default% 'buffers-panel-handler-set-buffer))))

(defun buffers-panel-reload-handler (buffer)
(declare (ignore buffer))
(alex:when-let ((panel-buffer (first (nyxt::panel-buffers (current-window)))))
(reload-panel-buffer panel-buffer)))
(hooks:add-hook %slot-default% 'reload-buffers-panel-handler))))

(define-configuration network-buffer
((buffer-loaded-hook
(hooks:add-hook %slot-default% 'buffers-panel-reload-handler))
(hooks:add-hook %slot-default% (curry #'reload-buffers-panel-handler nil)))
(buffer-delete-hook
(hooks:add-hook %slot-default% 'buffers-panel-reload-handler))))
(hooks:add-hook %slot-default% (curry #'reload-buffers-panel-handler nil)))))
1 change: 1 addition & 0 deletions source/panel.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ When provided, PANELS are deleted instead."
The main difference from `internal-page' is that panel command toggles the
panel."))

(export-always 'find-panel-buffer)
(defun find-panel-buffer (name)
"Return first panel buffer which URL is a NAME `panel-page'."
(find name (panel-buffers (current-window)) :key (compose #'internal-page-name #'url)))
Expand Down
Loading