Skip to content

A Go library to run a command after login

License

Notifications You must be signed in to change notification settings

kszab0/go-autostart

 
 

Repository files navigation

go-autostart

GoDoc

A Go library to run a command after login.

Usage

package main

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

func main() {
	app := &autostart.App{
		Name: "test",
		DisplayName: "Just a Test App",
		Exec: []string{"bash", "-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

Languages

  • Go 100.0%