{"modulePath":"github.com/lichdotdev/lich","version":"v0.93.1","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package system\n\nPackage 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).\n\n## Functions\n\n```go\nfunc ValidateExternalURL(rawURL string) error\n```\nValidateExternalURL accepts absolute http/https URLs only.\n\n## Types\n\n```go\ntype AttachNativeOptions = api.AttachNativeOptions\n```\n\n```go\ntype Diagnostics = api.Diagnostics\n```\n\n```go\ntype NativeHooks struct {\n\t// Raise brings an open native window forward, false when none is connected.\n\tRaise func() bool\n\t// Launch starts the native window on this backend; exited hears how the\n\t// process ended once it does.\n\tLaunch func(executable string, exited func(state string)) error\n\t// Locate is the native window's binary, shipped beside lich's.\n\tLocate func() (string, error)\n\t// Failed hears why a native window could not open.\n\tFailed func(reason string)\n}\n```\nNativeHooks are how lich drives its window, the native one (\\`lich native\\`), wired by main.\n\n```go\ntype QuitOptions = api.QuitOptions\n```\n\n```go\ntype Service struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(env []string, logPath, version string, uncleanExit bool) *Service\n```\n\n```go\nfunc (s *Service) AttachNative(_ context.Context, opts AttachNativeOptions) (api.None, error)\n```\nAttachNative answers attachNative over RPC.\n\n```go\nfunc (s *Service) Diagnostics(_ context.Context, _ api.None) (Diagnostics, error)\n```\nDiagnostics answers diagnostics over RPC.\n\n```go\nfunc (s *Service) Notify(_ context.Context, opts api.NotifyOptions) (api.None, error)\n```\nNotify 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).\n\nDelivery 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.\n\n```go\nfunc (s *Service) OpenExternal(_ context.Context, opts api.OpenExternalOptions) (api.None, error)\n```\nOpenExternal 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).\n\n```go\nfunc (s *Service) OpenFile(_ context.Context, opts api.OpenFileOptions) (api.None, error)\n```\nOpenFile 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.\n\n```go\nfunc (s *Service) OpenFolder(_ context.Context, opts api.OpenFolderOptions) (api.None, error)\n```\nOpenFolder 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.\n\n```go\nfunc (s *Service) OpenFolderInEditor(_ context.Context, opts api.OpenFolderOptions) (string, error)\n```\nOpenFolderInEditor 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.\n\n```go\nfunc (s *Service) Quit(_ context.Context, opts QuitOptions) (api.None, error)\n```\nQuit 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.\n\n```go\nfunc (s *Service) RevealLog(_ context.Context, _ api.None) (api.None, error)\n```\nRevealLog 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.\n\n```go\nfunc (s *Service) SSHAgentKeys(_ context.Context, _ api.None) ([]string, error)\n```\nSSHAgentKeys answers sSHAgentKeys over RPC.\n\n```go\nfunc (s *Service) SandboxBackend(_ context.Context, _ api.None) (string, error)\n```\nSandboxBackend answers sandboxBackend over RPC.\n\n```go\nfunc (s *Service) SetEnv(env []string)\n```\nSetEnv 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.\n\n```go\nfunc (s *Service) SetNativeWindow(hooks NativeHooks)\n```\nSetNativeWindow wires the native window. Called at startup.\n\n```go\nfunc (s *Service) SetQuit(quit func() error)\n```\nSetQuit wires how lich ends. Called at startup.\n\n```go\nfunc (s *Service) ShowWindow(_ context.Context, opts ShowWindowOptions) (api.None, error)\n```\nShowWindow 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.\n\n```go\nfunc (s *Service) TakeUncleanExit(_ context.Context, _ api.None) (bool, error)\n```\nTakeUncleanExit answers takeUncleanExit over RPC.\n\n```go\ntype ShowWindowOptions = api.ShowWindowOptions\n```\n\n","path":"github.com/lichdotdev/lich/internal/system","name":"system","synopsis":"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).","isRedistributable":true}
