shell

package
v0.0.0-...-7d0a1c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 47 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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.

func RunLinux

func RunLinux() error

RunLinux is the UI thread's loop: it returns when the app quits or the compositor goes.

func UIDoLinux

func UIDoLinux(f func())

UIDoLinux runs f on the UI thread.

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.

func SystemEnv

func SystemEnv() Env

SystemEnv is Env on Wayland.

type Handlers

type Handlers struct {
	OnClose func() bool
	OnFocus func(bool)
	OnState func()
	OnPress func()
}

Handlers are a window's callbacks (each may be nil).

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

type Shell struct {
	Hover *app.Hover
	// contains filtered or unexported fields
}

Shell is main.rs's App.

func New

func New(hover *app.Hover, env Env, look core.Look) (*Shell, error)

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

func (s *Shell) AnswerAsked(a agents.AskAnswer)

AnswerAsked answers the question in front.

func (*Shell) AttachReply

func (s *Shell) AttachReply(files []string)

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

func (s *Shell) ChatMenu(open bool, fly int)

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

func (s *Shell) ChatViewOn() bool

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) CloseDrawer

func (s *Shell) CloseDrawer()

CloseDrawer puts the open chat away.

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

func (s *Shell) CloudShot(pick *string, repos []string)

CloudShot is the Kiro Web box with a repo picked (nil: an empty workspace) and the list Kiro would give, without Kiro.

func (*Shell) Collapse

func (s *Shell) Collapse()

Collapse folds the notch.

func (*Shell) DeskActShot

func (s *Shell) DeskActShot(kind, text string, n int)

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) DeskFile

func (s *Shell) DeskFile(id int32, path string, v agents.FileView)

DeskFile hands the Files tab a file as a worker would have read it.

func (*Shell) DeskFrameShot

func (s *Shell) DeskFrameShot(img *image.RGBA)

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

func (s *Shell) DeskOpenMenuShot(on bool)

DeskOpenMenuShot opens or puts away the Open in menu.

func (*Shell) DeskProps

func (s *Shell) DeskProps(f func(*ui.DeskProps))

DeskProps changes what the panel is handed, once more, every time it is built.

func (*Shell) DeskPut

func (s *Shell) DeskPut(id int32, what string, got any)

DeskPut hands the desk what a worker would have read.

func (*Shell) DeskScroll

func (s *Shell) DeskScroll(off float32)

DeskScroll scrolls the panel's list to that offset.

func (*Shell) DeskShotCard

func (s *Shell) DeskShotCard(id int32, x, y float32)

func (*Shell) DeskShotOpen

func (s *Shell) DeskShotOpen(id int32, tab string)

DeskShotOpen opens the desk's panel on a tab, and DeskShotCard its card where the click was.

func (*Shell) DeskTag

func (s *Shell) DeskTag(id int32) (x, y float32, ok bool)

DeskTag is where the office drew that desk's name tag.

func (*Shell) DeskTermKey

func (s *Shell) DeskTermKey(k string)

DeskTermKey is Enter (run what is in the prompt), Up (the command before) or Ctrl+L (clear).

func (*Shell) DeskTermRunning

func (s *Shell) DeskTermRunning() bool

DeskTermRunning says a command of the user's runs now.

func (*Shell) DeskTermSeed

func (s *Shell) DeskTermSeed(id int32, entries []agents.TermEntry)

DeskTermSeed puts commands in the terminal's list without a shell behind them.

func (*Shell) DeskTermType

func (s *Shell) DeskTermType(text string)

DeskTermType leaves these words in the terminal's prompt, as typing would.

func (*Shell) DeskTipShot

func (s *Shell) DeskTipShot(kind int, name string, col [3]uint8, x, y float32)

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) Expand

func (s *Shell) Expand(peek, focus bool)

Expand opens the notch.

func (*Shell) ListFold

func (s *Shell) ListFold(i int)

ListFold folds or unfolds the folder at that row of the list.

func (*Shell) LookChanged

func (s *Shell) LookChanged(look core.Look)

LookChanged is the system's dark mode or animation setting changing.

func (*Shell) Menu

func (s *Shell) Menu() app.Menu

Menu is the tray's menu.

func (*Shell) MenuItem

func (s *Shell) MenuItem(i int)

MenuItem is a tray menu item (Actions.BuildMainMenu's order).

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

func (s *Shell) OfficeReady() bool

OfficeReady says the office has drawn its first picture (the shots wait for it).

func (*Shell) OpenAccess

func (s *Shell) OpenAccess()

func (*Shell) OpenCard

func (s *Shell) OpenCard()

OpenCard opens the question's card.

func (*Shell) OpenDash

func (s *Shell) OpenDash()

OpenDash opens the app window.

func (*Shell) OpenDashboard

func (s *Shell) OpenDashboard(settings bool)

OpenDashboard opens the app window (a second launch does too), and Settings in it.

func (*Shell) OpenModel

func (s *Shell) OpenModel(which int, x, y float32)

OpenModel opens a model pill's menu (1 the chat's, 2 the new task's), or puts it away (0).

func (*Shell) OpenPanel

func (s *Shell) OpenPanel(name string)

OpenPanel opens the board ("board"), the overview ("tv") or the history ("history"); "" puts the panel away.

func (*Shell) OpenSession

func (s *Shell) OpenSession(id int32)

OpenSession opens that session's chat in the drawer (the shots do it without a click).

func (*Shell) PageMenu

func (s *Shell) PageMenu(id string, x, y float32)

PageMenu opens a picker's menu where it was clicked.

func (*Shell) PagePick

func (s *Shell) PagePick(id string, i int)

func (*Shell) PagePress

func (s *Shell) PagePress(id string)

func (*Shell) PageToggle

func (s *Shell) PageToggle(id string, on bool)

func (*Shell) Pane

func (s *Shell) Pane() *app.Pane

Pane is the Settings page's state.

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

func (s *Shell) PhononDownloadBytesShot() uint64

PhononDownloadBytesShot is what the local speech model's download comes to.

func (*Shell) PopClose

func (s *Shell) PopClose()

PopClose puts the @ / list away.

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

func (s *Shell) RefreshPage(top bool)

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 (s *Shell) RenameChat(name string)

func (*Shell) SetClock

func (s *Shell) SetClock(t float32)

SetClock sets the notch's clock (Clock.t, seconds): the shots pin it.

func (*Shell) SetListOpen

func (s *Shell) SetListOpen(which int, on bool)

SetListOpen shows or hides the chat view's session list in one window (0 the notch, 1 the app window).

func (*Shell) SetNewDraft

func (s *Shell) SetNewDraft(t string)

SetNewDraft puts words in the new task's box.

func (*Shell) SetRenaming

func (s *Shell) SetRenaming(on bool)

SetRenaming and RenameChat are the header's title.

func (*Shell) SetReply

func (s *Shell) SetReply(t string, compose bool, caret int)

SetReply puts words in the open chat's reply box, open or at rest, and tells the @ / list.

func (*Shell) SetStartMenu

func (s *Shell) SetStartMenu(n int)

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

func (s *Shell) ShotBar(n int)

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

func (s *Shell) ShotCardDraft() (string, bool)

ShotCardDraft is the words in the desk card's reply box, and whether a card is out.

func (*Shell) ShotChatOpen

func (s *Shell) ShotChatOpen() int32

ShotChatOpen is the chat in the drawer (-1 for none).

func (*Shell) ShotChip

func (s *Shell) ShotChip(id int32, chip core.Chip)

ShotChip puts a chip in a chat's reply box.

func (*Shell) ShotChips

func (s *Shell) ShotChips(branch string, ctx float32)

ShotChips are the branch and the context the chat's header shows (no branch: "").

func (*Shell) ShotConfirm

func (s *Shell) ShotConfirm(title, ok, text string, on bool)

ShotConfirm is the question Restore and Try again ask before they touch the folder, or its absence.

func (*Shell) ShotDeskDetails

func (s *Shell) ShotDeskDetails(id int32)

ShotDeskDetails is the expanded chat's Files & changes: the panel beside the chat, or away.

func (*Shell) ShotDictation

func (s *Shell) ShotDictation(st voice.Stage)

ShotDictation is a stage of voice dictating into the open chat's reply box.

func (*Shell) ShotFolder

func (s *Shell) ShotFolder(name string)

ShotFolder is the folder the chat's header names ("" for its own).

func (*Shell) ShotNewCaret

func (s *Shell) ShotNewCaret(end bool)

ShotNewCaret puts the caret in the new task's words at the start or the end.

func (*Shell) ShotNewDraft

func (s *Shell) ShotNewDraft() string

ShotNewDraft is the words in the start screen's box.

func (*Shell) ShotNewFolder

func (s *Shell) ShotNewFolder(label string)

ShotNewFolder is the folder the new task's box names ("" for its own).

func (*Shell) ShotNewTask

func (s *Shell) ShotNewTask(folder, text string)

ShotNewTask is the new-task box with a folder and words in it (shots.rs's shot_new_task).

func (*Shell) ShotPanelOpen

func (s *Shell) ShotPanelOpen() bool

ShotPanelOpen says the desk's panel is out.

func (*Shell) ShotReply

func (s *Shell) ShotReply() string

ShotReply is the words in the open chat's reply box.

func (*Shell) ShotReplyHome

func (s *Shell) ShotReplyHome()

ShotReplyHome is Ctrl+Home in the reply box.

func (*Shell) ShotSettingsIn

func (s *Shell) ShotSettingsIn(which int, sec app.Section)

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

func (s *Shell) ShotThread(f func(th *chat.Thread, turns []chat.Turn))

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

func (s *Shell) ShotThreadScroll() float32

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) ShotView

func (s *Shell) ShotView() (v [3]float64, ok bool)

ShotView is the office camera the app last kept: x, z and zoom.

func (*Shell) ShowSettingsIn

func (s *Shell) ShowSettingsIn(which int, section app.Section)

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) Toast

func (s *Shell) Toast(text string)

Toast shows a line at the top for 2.8 s.

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) TryCardShot

func (s *Shell) TryCardShot(st voice.Stage) *app.TryCard

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

func (s *Shell) VoiceShot(st *voice.Stage)

VoiceShot draws that stage in the notch instead of Voice's (nil: Voice's own).

func (*Shell) VoiceShotBusy

func (s *Shell) VoiceShotBusy(on bool)

VoiceShotBusy is a press while one is in progress: the card glows amber.

func (*Shell) VoiceShotFeedback

func (s *Shell) VoiceShotFeedback(said string)

VoiceShotFeedback is what the card says after a capture (voice.ShotTaken, or why not).

func (*Shell) VoiceShotFlash

func (s *Shell) VoiceShotFlash(on bool)

VoiceShotFlash and VoiceShotNote are the card's screenshot flash and its note.

func (*Shell) VoiceShotMenu

func (s *Shell) VoiceShotMenu(which int)

VoiceShotMenu opens the preview's menu (0 closes it).

func (*Shell) VoiceShotNote

func (s *Shell) VoiceShotNote(t string)

func (*Shell) VoiceShotPics

func (s *Shell) VoiceShotPics(files []string)

VoiceShotPics are the pictures a preview shows it will send (and the listening card's note).

func (*Shell) VoiceShotReady

func (s *Shell) VoiceShotReady(id uint64, tools []core.AgentTool)

VoiceShotReady sets the agents the preview's menu lists as ready, for the interaction shown.

func (*Shell) VoiceShotSearch

func (s *Shell) VoiceShotSearch(q string)

VoiceShotSearch types into the preview's repo menu's search box.

func (*Shell) WebShot

func (s *Shell) WebShot(list []agents.CloudSession, note string)

WebShot is the shots' history: Kiro Web sessions as Kiro would list them, without Kiro.

type ShotCLIRow

type ShotCLIRow struct {
	Title, Folder string
	Mins          float64
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL