app

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package app is laziergit's window: lazygit's functionality, through package core, in MyGo's native UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveSettings added in v0.5.0

func SaveSettings(dir string, s Settings) error

SaveSettings writes the settings in dir, atomically.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the state of a window on a repository.

func New

func New(host Host, opts core.Options) *App

New makes the app; Open opens its repository.

func (*App) AutoFetch added in v0.5.0

func (a *App) AutoFetch()

AutoFetch fetches in the background, as the settings ask every few minutes: quietly, and not while the window has git busy or a dialog up.

func (*App) Busy

func (a *App) Busy() bool

Busy reports whether an action runs or waits to.

func (*App) ChangedOnDisk

func (a *App) ChangedOnDisk()

ChangedOnDisk refreshes after the work tree or the repository changed outside the app. It skips changes the app's own commands and refreshes just made, and leaves a refresh running to finish.

func (*App) Close

func (a *App) Close()

Close closes the repository, as the window closes: git waiting on a credential is answered, so that it stops, and the repository closes once its command ends, off the UI thread.

func (*App) Notice

func (a *App) Notice(title, desc string)

Notice shows a message in the window, as a toast.

func (*App) Open

func (a *App) Open(dir string, done func(error))

Open opens the repository dir is in, off the UI thread, and loads it. done, when set, is told how it went, on the UI thread.

func (*App) Repo

func (a *App) Repo() *core.Repo

Repo is the repository open, nil before one is.

func (*App) SettingsChanged added in v0.5.0

func (a *App) SettingsChanged()

SettingsChanged follows settings changed: the repository's commands and, for the diffs and the log, a load again.

func (*App) ShowSection

func (a *App) ShowSection(name string)

ShowSection shows a section of the sidebar: changes, history, branches or stash.

func (*App) View

func (a *App) View(c *ui.Context)

View builds the window.

type Copies added in v0.5.2

type Copies struct {
	// contains filtered or unexported fields
}

Copies are the commits copied to cherry-pick, which every window of a repository and of its worktrees shares: their commits are the same objects, so a window pastes what another copied.

type Host

type Host struct {
	// Post runs fn on the UI thread and rebuilds the view.
	Post func(fn func())
	// Go runs fn off the UI thread.
	Go func(fn func())
	// OpenRepository asks for a repository to open, and opens it: in this
	// window while it has none, in a window of its own otherwise.
	OpenRepository func()
	// Opened is told of the repository the window opened.
	Opened func(r *core.Repo)
	// Idle, when set, is told when the window's actions are all done.
	Idle func()
	// Recent lists the repositories opened lately, newest first, and
	// OpenRecent opens one, as OpenRepository does.
	Recent     func() []string
	OpenRecent func(path string)
	// Watch, when set, watches the work tree of a repository opened, to
	// call App.ChangedOnDisk on the UI thread, in place of the last one.
	Watch func(path string)
	// Settings are the app's, shared by its windows, nil for the
	// defaults; OpenSettings shows the Settings window.
	Settings     *Settings
	OpenSettings func()
	// Copies, when set, gives the commits copied to cherry-pick of the
	// repository whose worktrees share the git directory commonDir, which
	// its windows share; CopiesChanged has those windows show them anew.
	Copies        func(commonDir string) *Copies
	CopiesChanged func()
	// Main, when set, runs fn on the UI thread whether or not the window
	// is still open, for what is the app's rather than the window's.
	Main func(fn func())
}

Host is what the app needs of its window: to run a function on the UI thread and draw again, and to run work off it.

type Settings added in v0.5.0

type Settings struct {
	// Theme is "system", "light" or "dark".
	Theme string `json:"theme"`

	// ShowKeyHints shows the status bar of keys; ShowTabShortcuts the
	// keys of the sidebar's sections; RestoreSession opens the last
	// session's windows at launch.
	ShowKeyHints     bool `json:"showKeyHints"`
	ShowTabShortcuts bool `json:"showTabShortcuts"`
	RestoreSession   bool `json:"restoreSession"`

	// SplitDiff shows diffs side by side, unless a window chose otherwise.
	SplitDiff   bool `json:"splitDiff"`
	DiffContext int  `json:"diffContext"`
	CommitLimit int  `json:"commitLimit"`

	// FetchMinutes fetches in the background that often, 0 never.
	FetchMinutes int      `json:"fetchMinutes"`
	SignOff      bool     `json:"signOff"`
	ConfirmPush  bool     `json:"confirmPush"`
	MainBranches []string `json:"mainBranches"`
}

Settings are the app's, which every window follows, kept in settings.json in the app's config directory.

func DefaultSettings added in v0.5.0

func DefaultSettings() Settings

DefaultSettings are the settings of a new install, as the app was.

func LoadSettings added in v0.5.0

func LoadSettings(dir string) (Settings, error)

LoadSettings reads the settings in dir, the defaults for those it lacks, or all of them when there are none yet.

func (Settings) Core added in v0.5.0

func (s Settings) Core() core.Config

Core is what of the settings git's commands follow.

type SettingsPane added in v0.5.0

type SettingsPane struct {
	S       *Settings
	Changed func()
	// contains filtered or unexported fields
}

SettingsPane is the Settings window: the settings s, which changed is told of after each change, on the UI thread.

func (*SettingsPane) View added in v0.5.0

func (p *SettingsPane) View(c *ui.Context)

View builds the Settings window.

Jump to

Keyboard shortcuts

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