system

package
v0.93.0-rc.9 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 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 system holds the few OS integrations the window needs that are not tied to any domain service — opening a URL in the user's default browser, opening a work-tree file in their editor, raising a desktop notification, and the handful of facts a bug report needs (version, platform, where the log lives).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateExternalURL

func ValidateExternalURL(rawURL string) error

ValidateExternalURL accepts absolute http/https URLs only.

Types

type AttachNativeOptions

type AttachNativeOptions = api.AttachNativeOptions

type Diagnostics

type Diagnostics = api.Diagnostics

type NativeHooks

type NativeHooks struct {
	// Raise brings an open native window forward, false when none is connected.
	Raise func() bool
	// Launch starts the native window on this backend; exited hears how the
	// process ended once it does.
	Launch func(executable string, exited func(state string)) error
	// Locate is the native window's binary, shipped beside lich's.
	Locate func() (string, error)
	// Failed hears why a native window could not open.
	Failed func(reason string)
}

NativeHooks are how lich drives its window, the native one (`lich native`), wired by main.

type QuitOptions

type QuitOptions = api.QuitOptions

type Service

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

func New

func New(env []string, logPath, version string, uncleanExit bool) *Service

func (*Service) AttachNative

func (s *Service) AttachNative(_ context.Context, opts AttachNativeOptions) (api.None, error)

AttachNative answers attachNative over RPC.

func (*Service) Diagnostics

func (s *Service) Diagnostics(_ context.Context, _ api.None) (Diagnostics, error)

Diagnostics answers diagnostics over RPC.

func (*Service) Notify

func (s *Service) Notify(_ context.Context, opts api.NotifyOptions) (api.None, error)

Notify raises a desktop notification through the OS's own notification service — the one channel that still reaches the user after they leave the lich window. summary is the headline, detail the second line (empty omits it).

Delivery only: the window decides when a notification is warranted, because it is the side that knows whether the window has focus and which session the user is looking at.

func (*Service) OpenExternal

func (s *Service) OpenExternal(_ context.Context, opts api.OpenExternalOptions) (api.None, error)

OpenExternal opens an http(s) URL in the default browser. Scheme-gated so a crafted terminal escape can never turn a click into a file:// or custom scheme launch. The launcher itself is per-OS (see the open_* files).

func (*Service) OpenFile

func (s *Service) OpenFile(_ context.Context, opts api.OpenFileOptions) (api.None, error)

OpenFile hands one work-tree file to the application the desktop opens its type with: an image viewer, a PDF reader. Unlike OpenFolderInEditor it never consults $VISUAL/$EDITOR, which would open a PNG in vim. opts.Rel goes through relpath.Resolve, as project.ReadFile does, so a symlink out of the checkout is refused rather than opened. The launcher is openFolder's: xdg-open, open and explorer each hand any path, file or folder, to its default handler.

func (*Service) OpenFolder

func (s *Service) OpenFolder(_ context.Context, opts api.OpenFolderOptions) (api.None, error)

OpenFolder shows a checkout in the platform's file manager. It never consults $VISUAL/$EDITOR: this is the way out of lich to the OS's own view of the folder, which is the one thing opening it in an editor does not give.

func (*Service) OpenFolderInEditor

func (s *Service) OpenFolderInEditor(_ context.Context, opts api.OpenFolderOptions) (string, error)

OpenFolderInEditor opens a session's checkout in the user's editor. It prefers $VISUAL, then $EDITOR, resolved from the login shell, so a GUI launch still sees rc exports. A terminal editor (vim, nvim, nano, …) is launched nothing: the shell command line to run in a lich terminal session comes back instead, since a detached launch would give it no controlling terminal. A GUI editor, or the file manager when none is set, is launched detached, and "" comes back.

func (*Service) Quit

func (s *Service) Quit(_ context.Context, opts QuitOptions) (api.None, error)

Quit ends lich: the window closes, every session's process ends with it, and the process exits. It returns once the exit is under way, so the reply can be lost to the exit it announces.

func (*Service) RevealLog

func (s *Service) RevealLog(_ context.Context, _ api.None) (api.None, error)

RevealLog opens the log's directory with the platform's file manager, not the file itself: the rotated generation (*.old) is often the one holding the bug, and a log file handed to its default handler opens in an editor, not beside the sibling the reporter also needs.

func (*Service) SSHAgentKeys

func (s *Service) SSHAgentKeys(_ context.Context, _ api.None) ([]string, error)

SSHAgentKeys answers sSHAgentKeys over RPC.

func (*Service) SandboxBackend

func (s *Service) SandboxBackend(_ context.Context, _ api.None) (string, error)

SandboxBackend answers sandboxBackend over RPC.

func (*Service) SetEnv

func (s *Service) SetEnv(env []string)

SetEnv replaces the resolved environment after a re-read of the login shell (internal/providers.Service.RefreshPath): an $EDITOR exported by an rc file the user edited while lich was open is found from the same re-check that finds a newly installed agent, rather than from the next launch.

func (*Service) SetNativeWindow

func (s *Service) SetNativeWindow(hooks NativeHooks)

SetNativeWindow wires the native window. Called at startup.

func (*Service) SetQuit

func (s *Service) SetQuit(quit func() error)

SetQuit wires how lich ends. Called at startup.

func (*Service) ShowWindow

func (s *Service) ShowWindow(_ context.Context, opts ShowWindowOptions) (api.None, error)

ShowWindow starts the native window on the running backend, or brings it forward when it is open. It returns as soon as the window is asked for, not when it is on screen; a window that cannot open is reported to NativeHooks.Failed, not here.

func (*Service) TakeUncleanExit

func (s *Service) TakeUncleanExit(_ context.Context, _ api.None) (bool, error)

TakeUncleanExit answers takeUncleanExit over RPC.

type ShowWindowOptions

type ShowWindowOptions = api.ShowWindowOptions

Jump to

Keyboard shortcuts

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