config

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package config initializes all files required for Amfora, even those used by other packages. It also reads in the config file and initializes a Viper and the theme

Index

Constants

View Source
const (
	CmdInvalid Command = 0
	CmdLink1           = 1
	CmdLink2           = 2
	CmdLink3           = 3
	CmdLink4           = 4
	CmdLink5           = 5
	CmdLink6           = 6
	CmdLink7           = 7
	CmdLink8           = 8
	CmdLink9           = 9
	CmdLink0           = 10
	CmdTab1            = 11
	CmdTab2            = 12
	CmdTab3            = 13
	CmdTab4            = 14
	CmdTab5            = 15
	CmdTab6            = 16
	CmdTab7            = 17
	CmdTab8            = 18
	CmdTab9            = 19
	CmdTab0            = 20
	CmdBottom          = iota
	CmdEdit
	CmdHome
	CmdBookmarks
	CmdAddBookmark
	CmdSave
	CmdReload
	CmdBack
	CmdForward
	CmdMoveUp
	CmdMoveDown
	CmdMoveLeft
	CmdMoveRight
	CmdPgup
	CmdPgdn
	CmdNewTab
	CmdCloseTab
	CmdNextTab
	CmdPrevTab
	CmdQuit
	CmdHelp
	CmdSub
	CmdAddSub
	CmdCopyPageURL
	CmdCopyTargetURL
	CmdBeginning
	CmdEnd
	CmdURLHandlerOpen // See #143
)
View Source
const ColorBg = tcell.ColorSpecial | 3

The same as ColorFg, but inverted

View Source
const ColorFg = tcell.ColorSpecial | 2

Special color with no real color value Used for a default foreground color White is the terminal background is black, black if the terminal background is white Converted to a real color in this file before being sent out to other modules

Variables

View Source
var BkmkPath string // New XBEL (XML) bookmarks file, see #68
View Source
var BkmkStore = viper.New() // TOML API for old bookmarks file

Bookmarks

View Source
var ColorToColorName = map[tcell.Color]string{}/* 139 elements not displayed */

Inverted version of a tcell map https://github.com/gdamore/tcell/blob/v2.3.3/color.go#L845

View Source
var CustomNewTab bool
View Source
var DownloadsDir string
View Source
var HTTPCommand []string

Command for opening HTTP(S) URLs in the browser, from "a-general.http" in config.

View Source
var MediaHandlers = make(map[string]MediaHandler)
View Source
var NewTabPath string
View Source
var OldBkmkPath string // Old bookmarks file that used TOML format

Controlled by "a-general.scrollbar" in config Defaults to ScrollBarAuto on an invalid value

View Source
var SubscriptionPath string
View Source
var TempDownloadsDir string
View Source
var TofuStore = viper.New()

Functions

func GetColor added in v1.4.0

func GetColor(key string) tcell.Color

GetColor will return tcell.ColorBlack if there is no tcell.Color for the provided key.

func GetColorString added in v1.4.0

func GetColorString(key string) string

GetColorString returns a string that can be used in a cview tcell.Color tag, for the given theme key. It will return "#000000" if there is no tcell.Color for the provided key.

func GetContrastingColor added in v1.9.0

func GetContrastingColor(color tcell.Color) tcell.Color

GetContrastingColor returns tcell.ColorBlack if tcell.Color is brighter than gray otherwise returns tcell.ColorWhite if tcell.Color is dimmer than gray if tcell.Color is tcell.ColorDefault (undefined luminance) this returns tcell.ColorDefault

func GetKeyBinding added in v1.8.0

func GetKeyBinding(cmd Command) string

Get all keybindings for a Command as a string. Used by the help panel so bindable keys display with their bound values rather than hardcoded defaults.

func GetTextColor added in v1.9.0

func GetTextColor(key, bg string) tcell.Color

GetTextColor is the Same as GetColor, unless the key is "default". This happens on focus of a UI element which has a bg of default, in which case It return tcell.ColorBlack or tcell.ColorWhite, depending on which is more readable

func GetTextColorString added in v1.9.0

func GetTextColorString(key, bg string) string

GetTextColorString is the Same as GetColorString, unless the key is "default". This happens on focus of a UI element which has a bg of default, in which case It return tcell.ColorBlack or tcell.ColorWhite, depending on which is more readable

func Init

func Init() error

func KeyInit added in v1.8.0

func KeyInit()

Generate the bindings map from the TOML configuration file. Called by config.Init()

func SetColor added in v1.4.0

func SetColor(key string, color tcell.Color)

Types

type Command added in v1.8.0

type Command int

NOTE: CmdLink[1-90] and CmdTab[1-90] need to be in-order and consecutive This property is used to simplify key handling in display/display.go

func TranslateKeyEvent added in v1.8.0

func TranslateKeyEvent(e *tcell.EventKey) Command

Used by the display package to turn a tcell.EventKey into a Command

type MediaHandler added in v1.8.0

type MediaHandler struct {
	Cmd      []string
	NoPrompt bool
	Stream   bool
}

Jump to

Keyboard shortcuts

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