internal

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowedVideoExtensions = []string{"mp4", "mkv", "gif"}

Functions

func CacheClear

func CacheClear() error

CacheClear empties all iris cache, including videos and remote source results.

func CacheRemove

func CacheRemove(videoPath string) error

CacheRemove removes a single item from the iris video cache.

func CacheShow

func CacheShow()

func CheckForUpdates

func CheckForUpdates(currentVersion string)

func CheckPathExists

func CheckPathExists(filePath string) bool

Checks whether a given path exists.

func CleanupLogs

func CleanupLogs()

CleanupLogs removes log files older than 31 days

func ClearTemp

func ClearTemp()

ClearTemp deletes all the wallpapers present in ~/.iris/temp.

func CloseLogger

func CloseLogger()

CloseLogger closes the log file

func FetchAndCache

func FetchAndCache(repoURL, preparedURL, owner, repo, branch, folderPath, token string) ([]map[string]any, error)

func GetIrisDir

func GetIrisDir() string

GetIrisDir returns the iris home directory, namely `~/.iris`. Also creates the directory if it doesn't exists, and the necessary subfolders wallpapers, temp and cache.

func GetLatestCommitSHA

func GetLatestCommitSHA(owner, repo, branch, folderPath, token string) (string, error)

func GetWallpaper

func GetWallpaper() string

Returns the current set wallpaper or the error.

func GitHubCacheShow

func GitHubCacheShow()

func InitLogger

func InitLogger()

InitLogger initializes the logger to write to a daily file in ~/.iris/logs

func ItemInSlice

func ItemInSlice[T comparable](s T, slice []T) bool

Checks whether the given item exists in the slice.

func LogErrorf

func LogErrorf(component string, format string, v ...any)

func LogInfof

func LogInfof(component string, format string, v ...any)

func LogWarnf

func LogWarnf(component string, format string, v ...any)

func SaveGitHubCache

func SaveGitHubCache(cache GitHubCacheMap) error

func SetVideoWallpaper

func SetVideoWallpaper(videoPath string) error

SetVideoWallpaper sets a video as wallpaper by breaking the video into frames and then changes the wallpaper every few milliseconds to imitate that wallpaper is a video.

func SetWallpaper

func SetWallpaper(filename string) error

SetWallpaper sets the wallpaper to thegiven file.

Types

type ByteSize

type ByteSize float64
const (
	KB ByteSize = 1 << (10 * iota)
	MB
	GB
	TB
	PB
	EB
	ZB
	YB
)

func CacheSize

func CacheSize() ByteSize

CacheSize returns total cache size, including video frames and remote source results.

func (ByteSize) String

func (b ByteSize) String() string

type Configuration

type Configuration struct {
	RemoteSource            string   `json:"remote_source"`             // remote source to fetch wallpapers from
	SearchTerms             []string `json:"search_terms"`              // wallpaper search terms
	ChangeWallpaper         bool     `json:"change_wallpaper"`          // whether change wallpaper after a duration
	ChangeWallpaperDuration string   `json:"change_wallpaper_duration"` // if wallpaper has to be changed, then after how many minutes
	WallpaperFile           string   `json:"wallpaper_file"`            // path to the wallpaper file, might be a video as well
	WallpaperDirectory      string   `json:"wallpaper_directory"`       // use wallpapers from a user specified directory
	SelectionType           string   `json:"selection_type"`            // directory wallpaper selection type, either sorted or random
	SaveWallpaper           bool     `json:"save_wallpaper"`            // whether to save the used wallpapers or not
	SaveWallpaperDirectory  string   `json:"save_wallpaper_directory"`  // directory to save the used wallpapers
	CheckForUpdates         bool     `json:"check_for_updates"`         // whether to check for updates
	GitHubAPIToken          string   `json:"github_api_token"`          // github api token to perform auth requests
}

func ReadConfig

func ReadConfig() *Configuration

func (*Configuration) DirectoryWallpaper

func (c *Configuration) DirectoryWallpaper()

func (*Configuration) RemoteWallpaper

func (c *Configuration) RemoteWallpaper()

RemoteWallpaper dispatches the appropriate function to change wallpaper.

func (*Configuration) Show

func (c *Configuration) Show()

func (*Configuration) SyncGitHubCache

func (c *Configuration) SyncGitHubCache(repoURL string) error

func (*Configuration) WriteConfig

func (c *Configuration) WriteConfig()

type GitHubCacheMap

type GitHubCacheMap map[string]GitHubRepoCache

func LoadGitHubCache

func LoadGitHubCache() GitHubCacheMap

type GitHubRepoCache

type GitHubRepoCache struct {
	LastSHA    string           `json:"last_sha"`
	Wallpapers []map[string]any `json:"wallpapers"`
}

Jump to

Keyboard shortcuts

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