Skip to content

A Go library to run a command after login

License

Notifications You must be signed in to change notification settings

emersion/go-autostart

Repository files navigation

go-autostart

GoDoc

A Go library to run a command after login.

Usage

package main

import (
	"log"
	"github.com/emersion/go-autostart"
)

func main() {
	app := &autostart.App{
		Name: "test",
		DisplayName: "Just a Test App",
		Exec: []string{"sh", "-c", "echo autostart >> ~/autostart.txt"},
	}

	if app.IsEnabled() {
		log.Println("App is already enabled, removing it...")

		if err := app.Disable(); err != nil {
			log.Fatal(err)
		}
	} else {
		log.Println("Enabling app...")

		if err := app.Enable(); err != nil {
			log.Fatal(err)
		}
	}

	log.Println("Done!")
}

Behavior

License

MIT

About

A Go library to run a command after login

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published