Documentation
¶
Overview ¶
Package shell is app/src/main.rs and notch.rs: Hover's one process. It owns the notch window and the app window, the island the notch shows at rest, Settings over the office, the timers, the shortcut and the tray's menu, and it asks the desktop for the rest through Env, which each operating system fills in (internal/platform/win, and later the X11 one).
Index ¶
- Variables
- func InitLinux() error
- func RunLinux() error
- func UIDoLinux(f func())
- type Env
- type Handlers
- type NotchCtl
- type NotchPlat
- type Shell
- func (s *Shell) AnswerAsked(a agents.AskAnswer)
- func (s *Shell) AttachReply(files []string)
- func (s *Shell) ChatMenu(open bool, fly int)
- func (s *Shell) ChatViewOn() bool
- func (s *Shell) CloseChat()
- func (s *Shell) CloseDrawer()
- func (s *Shell) CloseOffice()
- func (s *Shell) CloudShot(pick *string, repos []string)
- func (s *Shell) Collapse()
- func (s *Shell) DeskActShot(kind, text string, n int)
- func (s *Shell) DeskCloseCard()
- func (s *Shell) DeskClosePanel()
- func (s *Shell) DeskCreateShot(id int32, creating bool, res *agents.CreatePrResult)
- func (s *Shell) DeskEditors(found []agents.FoundEditor)
- func (s *Shell) DeskFile(id int32, path string, v agents.FileView)
- func (s *Shell) DeskFrameShot(img *image.RGBA)
- func (s *Shell) DeskOffline()
- func (s *Shell) DeskOpenMenuShot(on bool)
- func (s *Shell) DeskProps(f func(*ui.DeskProps))
- func (s *Shell) DeskPut(id int32, what string, got any)
- func (s *Shell) DeskScroll(off float32)
- func (s *Shell) DeskShotCard(id int32, x, y float32)
- func (s *Shell) DeskShotOpen(id int32, tab string)
- func (s *Shell) DeskTag(id int32) (x, y float32, ok bool)
- func (s *Shell) DeskTermKey(k string)
- func (s *Shell) DeskTermRunning() bool
- func (s *Shell) DeskTermSeed(id int32, entries []agents.TermEntry)
- func (s *Shell) DeskTermType(text string)
- func (s *Shell) DeskTipShot(kind int, name string, col [3]uint8, x, y float32)
- func (s *Shell) Expand(peek, focus bool)
- func (s *Shell) ListFold(i int)
- func (s *Shell) LookChanged(look core.Look)
- func (s *Shell) Menu() app.Menu
- func (s *Shell) MenuItem(i int)
- func (s *Shell) OfficeActShot(which int, e ui.OfficeEvent)
- func (s *Shell) OfficeReady() bool
- func (s *Shell) OpenAccess()
- func (s *Shell) OpenCard()
- func (s *Shell) OpenDash()
- func (s *Shell) OpenDashboard(settings bool)
- func (s *Shell) OpenModel(which int, x, y float32)
- func (s *Shell) OpenPanel(name string)
- func (s *Shell) OpenSession(id int32)
- func (s *Shell) PageMenu(id string, x, y float32)
- func (s *Shell) PagePick(id string, i int)
- func (s *Shell) PagePress(id string)
- func (s *Shell) PageToggle(id string, on bool)
- func (s *Shell) Pane() *app.Pane
- func (s *Shell) PhononCardShot() *app.PhononCard
- func (s *Shell) PhononDownloadBytesShot() uint64
- func (s *Shell) PopClose()
- func (s *Shell) PushNow()
- func (s *Shell) RefreshPage(top bool)
- func (s *Shell) RegisterHotkeys()
- func (s *Shell) RenameChat(name string)
- func (s *Shell) SetClock(t float32)
- func (s *Shell) SetListOpen(which int, on bool)
- func (s *Shell) SetNewDraft(t string)
- func (s *Shell) SetRenaming(on bool)
- func (s *Shell) SetReply(t string, compose bool, caret int)
- func (s *Shell) SetStartMenu(n int)
- func (s *Shell) SettingsChangedShot()
- func (s *Shell) ShotBar(n int)
- func (s *Shell) ShotCLI(rows ...ShotCLIRow)
- func (s *Shell) ShotCardDraft() (string, bool)
- func (s *Shell) ShotChatOpen() int32
- func (s *Shell) ShotChip(id int32, chip core.Chip)
- func (s *Shell) ShotChips(branch string, ctx float32)
- func (s *Shell) ShotConfirm(title, ok, text string, on bool)
- func (s *Shell) ShotDeskDetails(id int32)
- func (s *Shell) ShotDictation(st voice.Stage)
- func (s *Shell) ShotFolder(name string)
- func (s *Shell) ShotNewCaret(end bool)
- func (s *Shell) ShotNewDraft() string
- func (s *Shell) ShotNewFolder(label string)
- func (s *Shell) ShotNewTask(folder, text string)
- func (s *Shell) ShotPanelOpen() bool
- func (s *Shell) ShotReply() string
- func (s *Shell) ShotReplyHome()
- func (s *Shell) ShotSettingsIn(which int, sec app.Section)
- func (s *Shell) ShotSettingsOut()
- func (s *Shell) ShotThread(f func(th *chat.Thread, turns []chat.Turn))
- func (s *Shell) ShotThreadScroll() float32
- func (s *Shell) ShotThreadTop()
- func (s *Shell) ShotView() (v [3]float64, ok bool)
- func (s *Shell) ShowSettingsIn(which int, section app.Section)
- func (s *Shell) Start()
- func (s *Shell) ThemeChangedShot()
- func (s *Shell) Toast(text string)
- func (s *Shell) Toggle()
- func (s *Shell) ToggleCloud()
- func (s *Shell) ToggleView()
- func (s *Shell) TryCardShot(st voice.Stage) *app.TryCard
- func (s *Shell) UpdateRest()
- func (s *Shell) VoiceQuit()
- func (s *Shell) VoiceShot(st *voice.Stage)
- func (s *Shell) VoiceShotBusy(on bool)
- func (s *Shell) VoiceShotFeedback(said string)
- func (s *Shell) VoiceShotFlash(on bool)
- func (s *Shell) VoiceShotMenu(which int)
- func (s *Shell) VoiceShotNote(t string)
- func (s *Shell) VoiceShotPics(files []string)
- func (s *Shell) VoiceShotReady(id uint64, tools []core.AgentTool)
- func (s *Shell) VoiceShotSearch(q string)
- func (s *Shell) WebShot(list []agents.CloudSession, note string)
- type ShotCLIRow
- type SysHooks
- type Timer
- type Window
Constants ¶
This section is empty.
Variables ¶
var Version = "5.0.4"
Version is the number in VERSION (the repo root), which the installers and `hover --version` show. The builds stamp it (-ldflags "-X github.com/4regab/Hover/internal/shell.Version=..."); this value is for `go run`, and CI checks that it equals VERSION.
Functions ¶
func InitLinux ¶
func InitLinux() error
InitLinux connects to the compositor. Call it first, from main, before anything else here; the loop runs on the goroutine that calls RunLinux.
Types ¶
type Env ¶
type Env struct {
// UIDo runs f on the UI thread, from any goroutine.
UIDo func(func())
After func(d time.Duration, f func()) Timer
Every func(d time.Duration, f func()) Timer
Quit func()
OpenURL func(url string)
PickFolder func() (string, bool)
PickThemeFile func() (string, bool)
PickImage func() (string, bool)
// ClipboardImage is a picture on the clipboard as RGBA.
ClipboardImage func() (w, h int, rgba []byte, ok bool)
// SetClipboard puts text on the clipboard.
SetClipboard func(string)
// NewNotch makes the notch's window (hidden, off screen until placed). NewDashboard the
// app window, NewWarning a small dialog (w and h in logical pixels, its client area).
NewNotch func() (Window, NotchPlat, error)
NewDashboard func() (Window, error)
NewWarning func(title string, w, h float32) (Window, error)
// Bind hands the OS the shell's callbacks for what it reports: the shortcut, the
// foreground changing, the tray. TrayStart and TrayStop show and take away the icon.
Bind func(SysHooks)
TrayStart, TrayStop func()
// Hotkey takes the notch's shortcut, letting go of the last; false when the system
// refuses it. Nil: none (no display).
Hotkey func(core.Shortcut) bool
// VoiceHotkey takes voice's hold-to-talk chord (id 2), letting go of the last. down says
// whether its key and modifiers are still held. The error says why the system refused
// it. Nil sc: let go. Nil: none (no display).
VoiceHotkey func(sc *core.Shortcut) (down func() bool, err error)
// SetTrayMenu is the menu the tray shows; Notify a system notification.
SetTrayMenu func(app.Menu)
Notify func(title, body string)
// Headless: nothing is grabbed, placed or announced outside the process.
Headless bool
}
Env is the desktop as the shell uses it.
type NotchCtl ¶
type NotchCtl struct {
Plat NotchPlat
Hover notch.Hover
Open notch.Openness
// RestAnim is the resting size, springing to each new one (SetSizes).
RestAnim notch.RestAnim
// Still: with animations off, sizes change at once.
Still bool
// Asking: a question waits (or its card is open): hovering doesn't open the office.
Asking bool
RestKind int
OpenSize notch.Size
Size notch.OfficeSize
Scale float64
Work notch.Rect
Win notch.Rect
T0 time.Time
Over bool
// Signature is the displays as of the last layout.
Signature string
LastDisplayCheck time.Time
Anim bool
HoverOpens bool
Popover bool
}
NotchCtl is the notch's state.
type NotchPlat ¶
type NotchPlat interface {
// Primary is the main display's work area in device pixels, and its scale.
Primary() (notch.Rect, float64)
// Signature changes when the displays do (checked every 2 s).
Signature() string
Cursor() (int, int)
Buttons() bool
Place(notch.Rect)
Raise()
// SetAcceptsKeys: the open office needs the keyboard; the resting notch must never take it.
SetAcceptsKeys(bool)
RememberForeground()
// RestoreForeground hands the keyboard back to whatever had it before the notch took it.
RestoreForeground()
Focus()
// SetHit: everything outside the shape passes the pointer through; over says the
// pointer is on the part that takes it.
SetHit(over bool)
// ForegroundIsOurs: focus went to something that isn't ours (the click-away rule).
ForegroundIsOurs() bool
}
NotchPlat is notch.rs's Plat: what differs per platform for the notch's window. The notch's size and place are set through Place.
type Shell ¶
Shell is main.rs's App.
func New ¶
New is App::new: the notch window, the state it draws from and the hooks other threads land on the UI thread through.
func (*Shell) AnswerAsked ¶
AnswerAsked answers the question in front.
func (*Shell) AttachReply ¶
AttachReply adds pictures from elsewhere (voice's screenshots while dictating) to the reply, as a paste adds them: up to the most a message takes.
func (*Shell) ChatMenu ¶
ChatMenu opens the chat's ⋯ menu with a list out of it (0 none, 1 Open in, 2 Switch agent), or puts it away.
func (*Shell) ChatViewOn ¶
ChatViewOn says the chat view is in place of the office.
func (*Shell) CloseChat ¶
func (s *Shell) CloseChat()
CloseChat is the chat's ✕ on the start screen's way back.
func (*Shell) CloseOffice ¶
func (s *Shell) CloseOffice()
CloseOffice stops the office thread and lets its GPU device go: a rig's last step, or each rig would keep a device (about 400 MB) to the end of the test run.
func (*Shell) CloudShot ¶
CloudShot is the Kiro Web box with a repo picked (nil: an empty workspace) and the list Kiro would give, without Kiro.
func (*Shell) DeskActShot ¶
DeskActShot is what the panel's own events ask (the "desk:" kinds): a row's act, a box's words, a pick.
func (*Shell) DeskCloseCard ¶
func (s *Shell) DeskCloseCard()
DeskCloseCard and DeskClosePanel put them away.
func (*Shell) DeskClosePanel ¶
func (s *Shell) DeskClosePanel()
func (*Shell) DeskCreateShot ¶
func (s *Shell) DeskCreateShot(id int32, creating bool, res *agents.CreatePrResult)
DeskCreateShot is the pull request form while it creates (creating) or after (res).
func (*Shell) DeskEditors ¶
func (s *Shell) DeskEditors(found []agents.FoundEditor)
DeskEditors are the editors this computer is said to have, for Open in.
func (*Shell) DeskFrameShot ¶
DeskFrameShot is the Screen tab's picture of the desktop.
func (*Shell) DeskOffline ¶
func (s *Shell) DeskOffline()
DeskOffline stops the desk asking git, gh or the screen: the shots hand in their own data.
func (*Shell) DeskOpenMenuShot ¶
DeskOpenMenuShot opens or puts away the Open in menu.
func (*Shell) DeskProps ¶
DeskProps changes what the panel is handed, once more, every time it is built.
func (*Shell) DeskScroll ¶
DeskScroll scrolls the panel's list to that offset.
func (*Shell) DeskShotCard ¶
func (*Shell) DeskShotOpen ¶
DeskShotOpen opens the desk's panel on a tab, and DeskShotCard its card where the click was.
func (*Shell) DeskTermKey ¶
DeskTermKey is Enter (run what is in the prompt), Up (the command before) or Ctrl+L (clear).
func (*Shell) DeskTermRunning ¶
DeskTermRunning says a command of the user's runs now.
func (*Shell) DeskTermSeed ¶
DeskTermSeed puts commands in the terminal's list without a shell behind them.
func (*Shell) DeskTermType ¶
DeskTermType leaves these words in the terminal's prompt, as typing would.
func (*Shell) DeskTipShot ¶
DeskTipShot shows the tip over a bot (kind 1) or a desk (2) at x, y; 0 puts it away. The office keeps it there through its next pictures, as it would for a pointer that stays.
func (*Shell) LookChanged ¶
LookChanged is the system's dark mode or animation setting changing.
func (*Shell) OfficeActShot ¶
func (s *Shell) OfficeActShot(which int, e ui.OfficeEvent)
OfficeActShot is an event of an office view as a click or a key makes it (which: 0 the notch, 1 the app window): the new-task circle, its menus, a question's pick, the wheel.
func (*Shell) OfficeReady ¶
OfficeReady says the office has drawn its first picture (the shots wait for it).
func (*Shell) OpenAccess ¶
func (s *Shell) OpenAccess()
func (*Shell) OpenDashboard ¶
OpenDashboard opens the app window (a second launch does too), and Settings in it.
func (*Shell) OpenModel ¶
OpenModel opens a model pill's menu (1 the chat's, 2 the new task's), or puts it away (0).
func (*Shell) OpenPanel ¶
OpenPanel opens the board ("board"), the overview ("tv") or the history ("history"); "" puts the panel away.
func (*Shell) OpenSession ¶
OpenSession opens that session's chat in the drawer (the shots do it without a click).
func (*Shell) PageToggle ¶
func (*Shell) PhononCardShot ¶
func (s *Shell) PhononCardShot() *app.PhononCard
PhononCardShot is the local speech card as Settings shows it now, and TryCardShot Try it's card for a stage.
func (*Shell) PhononDownloadBytesShot ¶
PhononDownloadBytesShot is what the local speech model's download comes to.
func (*Shell) PushNow ¶
func (s *Shell) PushNow()
PushNow sends the office its state at once, without the 120 ms timer (the shots have none).
func (*Shell) RefreshPage ¶
RefreshPage shows the open section's page again, in whichever window has it.
func (*Shell) RegisterHotkeys ¶
func (s *Shell) RegisterHotkeys()
RegisterHotkeys is App.RegisterHotKeys: let go of the shortcut and take it again; a refusal is said once per chord, after the current event.
func (*Shell) RenameChat ¶
func (*Shell) SetListOpen ¶
SetListOpen shows or hides the chat view's session list in one window (0 the notch, 1 the app window).
func (*Shell) SetNewDraft ¶
SetNewDraft puts words in the new task's box.
func (*Shell) SetRenaming ¶
SetRenaming and RenameChat are the header's title.
func (*Shell) SetReply ¶
SetReply puts words in the open chat's reply box, open or at rest, and tells the @ / list.
func (*Shell) SetStartMenu ¶
SetStartMenu is the start screen's menu out (0 none, 1 project, 2 agent, 3 where).
func (*Shell) SettingsChangedShot ¶
func (s *Shell) SettingsChangedShot()
SettingsChangedShot is what Settings tells the shell after a change (a new office size).
func (*Shell) ShotBar ¶
ShotBar puts out the app window's title-bar menu (1 File, 2 Settings, 3 Help; 0 none).
func (*Shell) ShotCLI ¶
func (s *Shell) ShotCLI(rows ...ShotCLIRow)
ShotCLI is this computer's Kiro sessions as listCLI would keep them (a shot has no Kiro to ask). None clears them.
func (*Shell) ShotCardDraft ¶
ShotCardDraft is the words in the desk card's reply box, and whether a card is out.
func (*Shell) ShotChatOpen ¶
ShotChatOpen is the chat in the drawer (-1 for none).
func (*Shell) ShotChips ¶
ShotChips are the branch and the context the chat's header shows (no branch: "").
func (*Shell) ShotConfirm ¶
ShotConfirm is the question Restore and Try again ask before they touch the folder, or its absence.
func (*Shell) ShotDeskDetails ¶
ShotDeskDetails is the expanded chat's Files & changes: the panel beside the chat, or away.
func (*Shell) ShotDictation ¶
ShotDictation is a stage of voice dictating into the open chat's reply box.
func (*Shell) ShotFolder ¶
ShotFolder is the folder the chat's header names ("" for its own).
func (*Shell) ShotNewCaret ¶
ShotNewCaret puts the caret in the new task's words at the start or the end.
func (*Shell) ShotNewDraft ¶
ShotNewDraft is the words in the start screen's box.
func (*Shell) ShotNewFolder ¶
ShotNewFolder is the folder the new task's box names ("" for its own).
func (*Shell) ShotNewTask ¶
ShotNewTask is the new-task box with a folder and words in it (shots.rs's shot_new_task).
func (*Shell) ShotPanelOpen ¶
ShotPanelOpen says the desk's panel is out.
func (*Shell) ShotReplyHome ¶
func (s *Shell) ShotReplyHome()
ShotReplyHome is Ctrl+Home in the reply box.
func (*Shell) ShotSettingsIn ¶
ShotSettingsIn opens Settings over the notch's office on a page.
func (*Shell) ShotSettingsOut ¶
func (s *Shell) ShotSettingsOut()
ShotSettingsOut puts the notch's Settings away, leaving the office open.
func (*Shell) ShotThread ¶
ShotThread changes the open chat's thread as clicks on it do (a summary, a step, a flag), and draws it again.
func (*Shell) ShotThreadScroll ¶
ShotThreadScroll is how far the open chat is scrolled.
func (*Shell) ShotThreadTop ¶
func (s *Shell) ShotThreadTop()
ShotThreadTop scrolls the open chat to its first line.
func (*Shell) ShowSettingsIn ¶
ShowSettingsIn opens Settings in the notch (which 0) or the app window (1).
func (*Shell) Start ¶
func (s *Shell) Start()
Start is what platform_start does once the windows exist: the timers, the shortcut and the first look at the displays.
func (*Shell) ThemeChangedShot ¶
func (s *Shell) ThemeChangedShot()
ThemeChangedShot is Settings telling the shell the theme changed.
func (*Shell) Toggle ¶
func (s *Shell) Toggle()
Toggle: the shortcut and the tray open the notch, or close it.
func (*Shell) ToggleCloud ¶
func (s *Shell) ToggleCloud()
ToggleCloud and OpenAccess are the start screen's pills.
func (*Shell) ToggleView ¶
func (s *Shell) ToggleView()
ToggleView is the switch at the office's top left.
func (*Shell) UpdateRest ¶
func (s *Shell) UpdateRest()
func (*Shell) VoiceQuit ¶
func (s *Shell) VoiceQuit()
VoiceQuit is on quit: a recording or a transcription stops, and Phonon's helper with it.
func (*Shell) VoiceShot ¶
VoiceShot draws that stage in the notch instead of Voice's (nil: Voice's own).
func (*Shell) VoiceShotBusy ¶
VoiceShotBusy is a press while one is in progress: the card glows amber.
func (*Shell) VoiceShotFeedback ¶
VoiceShotFeedback is what the card says after a capture (voice.ShotTaken, or why not).
func (*Shell) VoiceShotFlash ¶
VoiceShotFlash and VoiceShotNote are the card's screenshot flash and its note.
func (*Shell) VoiceShotMenu ¶
VoiceShotMenu opens the preview's menu (0 closes it).
func (*Shell) VoiceShotNote ¶
func (*Shell) VoiceShotPics ¶
VoiceShotPics are the pictures a preview shows it will send (and the listening card's note).
func (*Shell) VoiceShotReady ¶
VoiceShotReady sets the agents the preview's menu lists as ready, for the interaction shown.
func (*Shell) VoiceShotSearch ¶
VoiceShotSearch types into the preview's repo menu's search box.
type ShotCLIRow ¶
ShotCLIRow is one of this computer's Kiro sessions for a shot: its title, its folder, and how many minutes ago it was last used.
type SysHooks ¶
type SysHooks struct {
// Hotkey: a registered chord was pressed (its id: 1 is the office's).
Hotkey func(id int)
// Deactivated: another window took the foreground from the notch.
Deactivated func()
// TrayLeft: the tray icon was clicked; TrayMenu: an item of its menu was picked.
TrayLeft func()
TrayMenu func(i int)
}
SysHooks are what the desktop reports to the shell, on the UI thread.
type Timer ¶
type Timer interface {
Stop()
Running() bool
}
Timer is what After and Every hand back.
type Window ¶
type Window interface {
// SetDraw sets what builds a frame: the Gio context (its constraints are the window's
// size in physical pixels) and the scale. It returns true while something still moves.
SetDraw(func(gtx layout.Context, scale float32) bool)
SetHandlers(Handlers)
Invalidate()
Show()
Hide()
Close()
Gone() bool
Visible() bool
Minimized() bool
Maximized() bool
Focused() bool
Minimize()
ToggleMaximize()
DragMove()
ResizeFrom(edge int)
// Caption is the title bar's colours following the panel's.
Caption(dark bool, panel uint32)
Execute(input.Command)
// Frames is how many frames have been shown.
Frames() uint64
// Size is the client area in physical pixels; Scale the pixels per logical pixel.
Size() (w, h int)
Scale() float64
}
Window is a window the shell draws into. Everything on it runs on the UI thread, except Invalidate.