dbusservice

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseDest = "org.snippetexpander.daemon"
	BasePath = "/org/snippetexpander/daemon"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBusService

type DBusService interface {
	// Ping daemon for expected response.
	Ping(expected string) (string, error)

	// Stop daemon.
	Stop() error

	// GetAutostartStatus to see whether it is turned on.
	GetAutostartStatus() (bool, error)

	// UpdateAutostart to turn it on or off.
	UpdateAutostart(on bool) error

	// GetAutoexpandStatus to see whether it is turned on.
	GetAutoexpandStatus() (bool, error)

	// UpdateAutoexpand to turn it on or off.
	UpdateAutoexpand(on bool) error

	// AddSnippet to database.
	AddSnippet(abbreviation string, body string) (*snippet.Snippet, error)

	// UpdateSnippetWithID in database.
	UpdateSnippetWithID(id uuid.UUID, snippet *snippet.Snippet) error

	// GetSnippets from database.
	GetSnippets(search string, orderByLastUsed bool) ([]*snippet.Snippet, error)

	// GetSnippetWithAbbreviation for a given abbreviation.
	GetSnippetWithAbbreviation(abbreviation string) (*snippet.Snippet, error)

	// GetSnippetWithID for a given ID.
	GetSnippetWithID(id string) (*snippet.Snippet, error)

	// RemoveSnippet from database.
	RemoveSnippet(abbreviation string) (bool, error)

	// SyncSnippets in database with options to handle clashes.
	SyncSnippets(snippets []*snippet.Snippet, options SyncOptions) (SyncResult, error)

	// ExpandAbbreviation returns the body with expanded placeholders as well as the cursor offset.
	ExpandAbbreviation(abbreviation string, skipLastUsed bool) (ExpandAbbreviationResult, error)

	// CopySnippet asks the daemon to copy an expanded snippet into the pasteboard.
	CopySnippet(abbreviation string, skipLastUsed bool) error

	// PasteSnippet asks the daemon to copy and paste a snippet after a number of milliseconds.
	PasteSnippet(abbreviation string, useShiftKey bool, delay int64) error

	// GetSetting gets a setting for a given key.
	GetSetting(key string) (string, error)

	// SaveSetting saves a setting for the given key and value, empty value returns setting to its default.
	SaveSetting(key string, value string) error
}

type ExpandAbbreviationResult

type ExpandAbbreviationResult struct {
	Body         string
	CursorOffset int
}

type Snippet

type Snippet struct {
	ID           string
	Abbreviation string
	Body         string
	LastUsed     int64
}

func FromSnippet

func FromSnippet(s *snippet.Snippet) (*Snippet, error)

FromSnippet converts a snippet.Snippet to a dbusservice.Snippet.

func (*Snippet) ToSnippet

func (s *Snippet) ToSnippet() (*snippet.Snippet, error)

ToSnippet converts a dbusservice.Snippet to a snippet.Snippet.

type SyncOptions

type SyncOptions struct {
	Update bool
}

type SyncResult

type SyncResult struct {
	Skipped int64
	Created int64
	Updated int64
	Deleted int64
}

Jump to

Keyboard shortcuts

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