panes

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 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 panes draws the desktop app's sidebars' panes (docs/specs/ui.md#sidebars-and-panes, plan 0009): Files, Search, Backlinks, Outgoing links, Tags, All properties, Outline and Tasks. They read notesd through their Env and ask the window to act through Actions.

Index

Constants

View Source
const (
	SortAlphabetical        = "alphabetical"
	SortAlphabeticalReverse = "alphabeticalReverse"
	SortModified            = "byModifiedTime"
	SortModifiedReverse     = "byModifiedTimeReverse"
)

The Files pane's sort orders, by Obsidian's names.

View Source
const SearchDelay = 250 * time.Millisecond

SearchDelay is how long after the last change the pane searches.

Variables

This section is empty.

Functions

func Extension

func Extension(p string) string

Extension is a path's extension in lower case, without the dot.

func FileType

func FileType(p string) string

FileType is what Obsidian makes of a file.

Types

type API

API is what the panes read of notesd; api.NoteClient has it.

type Actions

type Actions struct {
	Open         func(path, where string)
	OpenAtLine   func(path string, line int, where string)
	OpenOrCreate func(target, where string)
	SearchFor    func(query string)
	JumpToLine   func(line int) // in the active note
	Report       func(error)
}

Actions are what the panes ask of the window. where is a workspace.Here, NewTab, ToRight or Below.

type Backlinks struct {
	Env *Env
	// contains filtered or unexported fields
}

Backlinks is the Backlinks pane: linked and unlinked mentions of the active file.

func (*Backlinks) Count

func (b *Backlinks) Count() int

Count is how many notes link to the active file, for the status bar.

func (*Backlinks) Refresh

func (b *Backlinks) Refresh()

Refresh reads the pane again for the active file.

func (*Backlinks) View

func (b *Backlinks) View(c *ui.Context) ui.Element

View draws the pane.

type Env

type Env struct {
	Loop    notes.Env
	API     func() API
	Vault   int64
	Catalog *catalog.Catalog
	Actions Actions
	// Active is the active tab's file, "" for none; ActiveText its text
	// as the editor holds it, ok false when it is not open as a note.
	Active     func() string
	ActiveText func() (string, bool)
	// Where turns the modifiers of a click into where it opens.
	Where func(mods ui.Modifiers) string
}

Env is what every pane shares.

type FileActions

type FileActions struct {
	NewNote     func(folder string)
	NewFolder   func(parent string)
	Rename      func(path, name string, folder bool)
	Move        func(path, toFolder string, folder bool)
	MoveTo      func(path string, folder bool) // asks where
	Delete      func(path string, folder bool)
	CopyPath    func(path string)
	OpenDefault func(path string)
	History     func(path string)
}

FileActions are what the Files pane asks of the window.

type Files

type Files struct {
	Env     *Env
	Store   *workspace.Store
	Actions FileActions
	// ShowUnsupported is the Show unsupported files preference.
	ShowUnsupported bool
	// contains filtered or unexported fields
}

Files is the Files pane (docs/specs/ui.md#files-pane-batch-2): a vault's folders and files on frostui's source list, which builds only the rows in view.

func (*Files) Rename

func (f *Files) Rename(p string)

Rename starts renaming p in place (F2).

func (*Files) Reveal

func (f *Files) Reveal(p string)

Reveal opens every folder holding p, so its row shows.

func (*Files) View

func (f *Files) View(c *ui.Context) ui.Element

View draws the pane.

type Mention

type Mention struct {
	Path, Title string
	Lines       []MentionLine
}

Mention is a note that links to the active note, or mentions it.

func LinkedGroups

func LinkedGroups(backlinks []api.Backlink) []Mention

LinkedGroups groups backlinks by their source, in notesd's order.

type MentionLine

type MentionLine struct {
	Line  int
	Parts []api.SnippetPart
}

MentionLine is where one mention is; Line is 0 for an unlinked one.

type Node

type Node struct {
	Path string
	// Name is a folder's name, or a file's name without its extension.
	Name string
	// Extension is a file's, in lower case.
	Extension string
	// Type is a file's type; "folder" for a folder.
	Type     string
	Children []string // a folder's children, sorted; nil for a file
	// contains filtered or unexported fields
}

Node is a folder or file of the Files pane.

type Outgoing

type Outgoing struct {
	Env *Env
	// contains filtered or unexported fields
}

Outgoing is the Outgoing links pane.

func (*Outgoing) Refresh

func (o *Outgoing) Refresh()

Refresh reads the active note's links again.

func (*Outgoing) View

func (o *Outgoing) View(c *ui.Context) ui.Element

View draws the pane; an unresolved link is dimmed, and clicking it creates the note.

type Outline

type Outline struct {
	Env *Env
	// CurrentLine is the caret's line, from 1, to mark its heading.
	CurrentLine func() int
	// contains filtered or unexported fields
}

Outline is the Outline pane: the active note's headings, nested.

func (*Outline) View

func (o *Outline) View(c *ui.Context) ui.Element

View draws the pane.

type Properties

type Properties struct {
	Env     *Env
	ByCount bool
	// contains filtered or unexported fields
}

Properties is the All properties pane.

func (*Properties) Refresh

func (p *Properties) Refresh()

Refresh reads the properties again.

func (*Properties) Types

func (p *Properties) Types() map[string]string

Types are the vault's property types, by key, for the properties panel.

func (*Properties) View

func (p *Properties) View(c *ui.Context) ui.Element

View draws the pane.

type Search struct {
	Env   *Env
	Query string
	// contains filtered or unexported fields
}

Search is the Search pane (docs/specs/ui.md#search-pane-batch-2).

func (*Search) Ask

func (s *Search) Ask(query string)

Ask shows query in the pane and focuses it.

func (*Search) Refresh

func (s *Search) Refresh()

Refresh asks the current query again: the vault changed, or notesd came back.

func (*Search) View

func (s *Search) View(c *ui.Context) ui.Element

View draws the pane.

type TagNode

type TagNode struct {
	Name     string // the tag's last segment, as first spelled
	Tag      string // the whole tag, without '#'
	Count    int64  // the notes with the tag, plus its children's
	Children []*TagNode
}

TagNode is a tag and the tags nested under it.

func TagTree

func TagTree(counts []api.TagCount, byCount bool) []*TagNode

TagTree nests tag counts into a tree, sorted by name or by count at every level.

type Tags

type Tags struct {
	Env     *Env
	ByCount bool
	// contains filtered or unexported fields
}

Tags is the Tags pane: nested tags with counts; a click searches.

func (*Tags) Refresh

func (p *Tags) Refresh()

Refresh reads the tags again.

func (*Tags) View

func (p *Tags) View(c *ui.Context) ui.Element

View draws the pane.

type Tasks

type Tasks struct {
	Env *Env
	// contains filtered or unexported fields
}

Tasks is the Tasks pane: the vault's open tasks, by note.

func (*Tasks) Refresh

func (p *Tasks) Refresh()

Refresh reads the tasks again.

func (*Tasks) View

func (p *Tasks) View(c *ui.Context) ui.Element

View draws the pane.

type Tree

type Tree struct {
	Nodes map[string]*Node
	Roots []string
}

Tree is a vault's folders and files, nested and sorted.

func BuildTree

func BuildTree(files []api.VaultFile, folders []string, sort string, showUnsupported bool) *Tree

BuildTree nests the files and folders, sorted as Obsidian's file explorer sorts them: folders first by name, files by the sort order. Files of type other are left out unless showUnsupported.

Jump to

Keyboard shortcuts

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