loop

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClearCmd = &Z.Cmd{
	Name:     `clear`,
	Aliases:  []string{`kill`},
	Usage:    `lazywal clear`,
	Summary:  `Kill all process related with 'xwinwrap' that may be hanging.`,
	MinArgs:  0,
	Commands: []*Z.Cmd{help.Cmd, SetDisplayCmd},
	Call: func(caller *Z.Cmd, _ ...string) error {
		fmt.Println("Killing all xwinwrap processes")
		return exec.Command("bash", "-c", fmt.Sprintf("kill -9 $(pidof xwinwrap)")).Run()
	},
}
View Source
var Cmd = &Z.Cmd{
	Name:      `lazywal`,
	Summary:   `Lazywal: a terminal client to facilitate setting up video-loops/gifs as background.`,
	Version:   `v1.0.4`,
	Copyright: `Copyright 2021-2024 Zayac-The-Engineer, 2025 Pedro G. Branquinho (Go version)`,
	License:   `MIT License`,
	Site:      `buddhilw.com`,
	Source:    `git@github.com/BuddhiLW/lazywal.git`,
	Issues:    `github.com/BuddhiLW/lazywal/issues`,

	Commands: []*Z.Cmd{

		help.Cmd, conf.Cmd, vars.Cmd,

		LoopCmd, ClearCmd, PywalCmd, dependencies.TestDepsCmd},

	Description: `
		Lazywal: a terminal client to help setup video-loops/gifs as background.

		You can use the following commands:

		* lazywal set **path**            (Tries to get first-display screen-size automatically)
		* lazywal set **path** display **WxH**  (Width x Height - e.g. 1440x1080, 2560x1080 etc.)
		* lazywal kill                  (Kills all _xwinwrap_ processes running.)

		Note: **path** should be the path to the video-loop file.

		See the README.md for more information and examples, or use *_command-tree_ help* to see another man-page about the specific command-tree.
		`,
}
View Source
var LoopCmd = &Z.Cmd{
	Name:     `set`,
	Aliases:  []string{`set-path`, `path`},
	Usage:    `<path> display <dimension>`,
	Summary:  `Renders the file in <path> as wallpaper with specified display dimension.`,
	MinArgs:  0,
	Commands: []*Z.Cmd{help.Cmd, SetDisplayCmd},
	Call: func(caller *Z.Cmd, args ...string) error {
		err := dependencies.TestDepsCmd.Call(caller, args[0])
		if err != nil {
			return err
		}

		if len(args) == 0 {
			help.Cmd.Call(caller, "help")
			return nil
		}

		if len(args) < 2 {
			err := SetDisplayCmd.Call(caller, defaultDisplay)
			if err != nil {
				return err
			}
			return nil
		}

		path := args[0]
		if !validPath(path) {
			log.Fatal("Invalid Path")
		}

		log.Print("File chosen: ", path)
		Wall.Config.Path = args[0]

		if len(args) > 2 && args[1] == "display" {
			err := SetDisplayCmd.Call(caller, args[2:]...)
			if err != nil {
				return err
			}
		}

		if len(args) > 0 && Matches(PywalCmd, args[len(args)-1]) {
			err := PywalCmd.Call(caller)
			if err != nil {
				return err
			}
		}

		return nil
	},
}
View Source
var PywalCmd = &Z.Cmd{
	Name:     `pywal`,
	Aliases:  []string{"update-pywal", "colors"},
	Usage:    `lazywal set <path> colors`,
	Summary:  `Update pywal scheme to use a random frame from the loop.`,
	NumArgs:  0,
	Commands: []*Z.Cmd{help.Cmd},
	Call: func(_ *Z.Cmd, args ...string) error {
		available, err := dependencies.IsWalAvailable()
		if available {
			fmt.Println("wal is available in your system.")
		} else {
			return err
		}

		Wall.Pywal()
		return nil
	},
}
View Source
var SetDisplayCmd = &Z.Cmd{
	Name:     `display`,
	Aliases:  []string{`setdisplay`, `set`},
	Usage:    `<path>`,
	Summary:  `Set wallpaper to dimensions/position of screen <path>.`,
	NumArgs:  1,
	Commands: []*Z.Cmd{help.Cmd},
	Call: func(_ *Z.Cmd, args ...string) error {

		err := SetDisplay(args[0])
		if err != nil {
			return err
		}
		Wall.Set()
		return nil
	},
}

Functions

func GetDefaultDisplay

func GetDefaultDisplay() string

func Matches

func Matches(cmd *Z.Cmd, arg string) bool

func SetDisplay

func SetDisplay(display string) error

func UpdatePywalScheme

func UpdatePywalScheme(image string) error

Types

type Config

type Config struct {
	Path       string
	Dimensions *Size
	LastUsed   string // still not used
}

func NewConfig

func NewConfig() *Config

type Size

type Size struct {
	Width  float32
	Height float32
}

type Wallpaper

type Wallpaper struct {
	Config *Config
}
var (
	Wall *Wallpaper = NewWallPaper(NewConfig())
)

func NewWallPaper

func NewWallPaper(setup *Config) *Wallpaper

func (*Wallpaper) Pywal

func (w *Wallpaper) Pywal()

func (*Wallpaper) Set

func (w *Wallpaper) Set()

Jump to

Keyboard shortcuts

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