Skip to content

Commit 7853c7e

Browse files
committed
Provide a few options for busy throbber
1 parent 2e586f7 commit 7853c7e

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

agent-shell.el

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,18 @@ Can be one of:
276276
:type 'boolean
277277
:group 'agent-shell)
278278

279+
(defcustom agent-shell-busy-indicator-frames 'wide
280+
"Frames for the busy indicator animation.
281+
Can be a symbol selecting a predefined style, or a vector of frame strings.
282+
When providing custom frames, do not include leading spaces as padding
283+
is added automatically."
284+
:type '(choice (const :tag "Wave (pulses up and down)" wave)
285+
(const :tag "Dots Block (circular spin)" dots-block)
286+
(const :tag "Dots Round (circular spin)" dots-round)
287+
(const :tag "Wide (horizontal blocks)" wide)
288+
(vector :tag "Custom frames" string))
289+
:group 'agent-shell)
290+
279291
(defcustom agent-shell-screenshot-command
280292
(if (eq system-type 'darwin)
281293
'("/usr/sbin/screencapture" "-i")
@@ -4285,11 +4297,17 @@ See https://agentclientprotocol.com/protocol/session-modes for details."
42854297

42864298
(defun agent-shell--status-frame ()
42874299
"Return busy frame string or nil if not busy."
4288-
(when (and agent-shell-show-busy-indicator
4289-
(eq 'busy (map-nested-elt (agent-shell--state) '(:heartbeat :status))))
4290-
(let ((frames ["" " ░░ " " ░░░ " " ░░░░" " ░░░ " " ░░ " "" " "]))
4291-
(seq-elt frames (mod (map-nested-elt (agent-shell--state) '(:heartbeat :value))
4292-
(length frames))))))
4300+
(when-let* ((agent-shell-show-busy-indicator)
4301+
((eq 'busy (map-nested-elt (agent-shell--state) '(:heartbeat :status))))
4302+
(frames (pcase agent-shell-busy-indicator-frames
4303+
('wave ["" "" "" "" "" "" "" "" "" "" "" "" "" ""])
4304+
('dots-block ["" "" "" "" "" "" "" ""])
4305+
('dots-round ["⢎⡰" "⢎⡡" "⢎⡑" "⢎⠱" "⠎⡱" "⢊⡱" "⢌⡱" "⢆⡱"])
4306+
('wide ["" "░░ " "░░░ " "░░░░" "░░░ " "░░ " "" " "])
4307+
((pred vectorp) agent-shell-busy-indicator-frames)
4308+
(_ ["" "" "" "" "" "" "" "" "" "" "" "" "" ""]))))
4309+
(concat " " (seq-elt frames (mod (map-nested-elt (agent-shell--state) '(:heartbeat :value))
4310+
(length frames))))))
42934311

42944312
(defun agent-shell--mode-line-format ()
42954313
"Return `agent-shell''s mode-line format.

0 commit comments

Comments
 (0)