summaryrefslogtreecommitdiff
path: root/vendor/github.com/ProtonMail/go-autostart
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/ProtonMail/go-autostart')
-rw-r--r--vendor/github.com/ProtonMail/go-autostart/.gitignore24
-rw-r--r--vendor/github.com/ProtonMail/go-autostart/LICENSE21
-rw-r--r--vendor/github.com/ProtonMail/go-autostart/README.md51
-rw-r--r--vendor/github.com/ProtonMail/go-autostart/autostart.go13
-rw-r--r--vendor/github.com/ProtonMail/go-autostart/autostart_darwin.go66
-rw-r--r--vendor/github.com/ProtonMail/go-autostart/autostart_windows.c51
-rw-r--r--vendor/github.com/ProtonMail/go-autostart/autostart_windows.go52
-rw-r--r--vendor/github.com/ProtonMail/go-autostart/autostart_xdg.go69
-rw-r--r--vendor/github.com/ProtonMail/go-autostart/quote.go16
9 files changed, 0 insertions, 363 deletions
diff --git a/vendor/github.com/ProtonMail/go-autostart/.gitignore b/vendor/github.com/ProtonMail/go-autostart/.gitignore
deleted file mode 100644
index daf913b..0000000
--- a/vendor/github.com/ProtonMail/go-autostart/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
diff --git a/vendor/github.com/ProtonMail/go-autostart/LICENSE b/vendor/github.com/ProtonMail/go-autostart/LICENSE
deleted file mode 100644
index f9e1447..0000000
--- a/vendor/github.com/ProtonMail/go-autostart/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 ProtonMail
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/ProtonMail/go-autostart/README.md b/vendor/github.com/ProtonMail/go-autostart/README.md
deleted file mode 100644
index 580862f..0000000
--- a/vendor/github.com/ProtonMail/go-autostart/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-# go-autostart
-
-[![GoDoc](https://godoc.org/github.com/ProtonMail/go-autostart?status.svg)](https://godoc.org/github.com/ProtonMail/go-autostart)
-
-A Go library to run a command after login.
-
-## Usage
-
-```go
-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
-
-* On Linux and BSD, it creates a `.desktop` file in `$XDG_CONFIG_HOME/autostart`
- (i.e. `$HOME/.config/autostart`). See http://askubuntu.com/questions/48321/how-do-i-start-applications-automatically-on-login
-* On macOS, it creates a `launchd` job. See http://blog.gordn.org/2015/03/implementing-run-on-login-for-your-node.html
-* On Windows, it creates a link to the program in `%USERPROFILE%\Start Menu\Programs\Startup`
-
-## License
-
-MIT
diff --git a/vendor/github.com/ProtonMail/go-autostart/autostart.go b/vendor/github.com/ProtonMail/go-autostart/autostart.go
deleted file mode 100644
index 7b7d6de..0000000
--- a/vendor/github.com/ProtonMail/go-autostart/autostart.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package autostart
-
-// An application that will be started when the user logs in.
-type App struct {
- // Unique identifier for the app.
- Name string
- // The command to execute, followed by its arguments.
- Exec []string
- // The app name.
- DisplayName string
- // The app icon.
- Icon string
-}
diff --git a/vendor/github.com/ProtonMail/go-autostart/autostart_darwin.go b/vendor/github.com/ProtonMail/go-autostart/autostart_darwin.go
deleted file mode 100644
index b2e0518..0000000
--- a/vendor/github.com/ProtonMail/go-autostart/autostart_darwin.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package autostart
-
-import (
- "os"
- "path/filepath"
- "text/template"
-)
-
-const jobTemplate = `<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
- <dict>
- <key>Label</key>
- <string>{{.Name}}</string>
- <key>ProgramArguments</key>
- <array>
- {{range .Exec -}}
- <string>{{.}}</string>
- {{end}}
- </array>
- <key>RunAtLoad</key>
- <true/>
- </dict>
-</plist>`
-
-var launchDir string
-
-func init() {
- launchDir = filepath.Join(os.Getenv("HOME"), "Library", "LaunchAgents")
-}
-
-func (a *App) path() string {
- return filepath.Join(launchDir, a.Name+".plist")
-}
-
-// IsEnabled Check is app enabled startup.
-func (a *App) IsEnabled() bool {
- _, err := os.Stat(a.path())
- return err == nil
-}
-
-// Enable this app on startup.
-func (a *App) Enable() error {
- t := template.Must(template.New("job").Parse(jobTemplate))
-
- if err := os.MkdirAll(launchDir, 0777); err != nil {
- return err
- }
- f, err := os.Create(a.path())
- if err != nil {
- return err
- }
- defer f.Close()
-
- if err := t.Execute(f, a); err != nil {
- return err
- }
-
- return nil
-}
-
-// Disable this app on startup.
-func (a *App) Disable() error {
-
- return os.Remove(a.path())
-}
diff --git a/vendor/github.com/ProtonMail/go-autostart/autostart_windows.c b/vendor/github.com/ProtonMail/go-autostart/autostart_windows.c
deleted file mode 100644
index a61618c..0000000
--- a/vendor/github.com/ProtonMail/go-autostart/autostart_windows.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <windows.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <objbase.h>
-#include <shlobj.h>
-
-uint64_t CreateShortcut(char *shortcutA, char *path, char *args) {
- IShellLink* pISL;
- IPersistFile* pIPF;
- HRESULT hr;
-
- CoInitializeEx(NULL, COINIT_MULTITHREADED);
-
- // Shortcut filename: convert ANSI to unicode
- WORD shortcutW[MAX_PATH];
- int nChar = MultiByteToWideChar(CP_ACP, 0, shortcutA, -1, shortcutW, MAX_PATH);
-
- hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&pISL);
- if (!SUCCEEDED(hr)) {
- return hr+0x01000000;
- }
-
- // See https://msdn.microsoft.com/en-us/library/windows/desktop/bb774950(v=vs.85).aspx
- hr = pISL->lpVtbl->SetPath(pISL, path);
- if (!SUCCEEDED(hr)) {
- return hr+0x02000000;
- }
-
- hr = pISL->lpVtbl->SetArguments(pISL, args);
- if (!SUCCEEDED(hr)) {
- return hr+0x03000000;
- }
-
- // Save the shortcut
- hr = pISL->lpVtbl->QueryInterface(pISL, &IID_IPersistFile, (void**)&pIPF);
- if (!SUCCEEDED(hr)) {
- return hr+0x04000000;
- }
-
- hr = pIPF->lpVtbl->Save(pIPF, shortcutW, FALSE);
- if (!SUCCEEDED(hr)) {
- return hr+0x05000000;
- }
-
- pIPF->lpVtbl->Release(pIPF);
- pISL->lpVtbl->Release(pISL);
-
- return 0x0;
-}
diff --git a/vendor/github.com/ProtonMail/go-autostart/autostart_windows.go b/vendor/github.com/ProtonMail/go-autostart/autostart_windows.go
deleted file mode 100644
index 3c14609..0000000
--- a/vendor/github.com/ProtonMail/go-autostart/autostart_windows.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package autostart
-
-// #cgo LDFLAGS: -lole32 -luuid
-/*
-#define WIN32_LEAN_AND_MEAN
-#include <stdint.h>
-#include <windows.h>
-
-uint64_t CreateShortcut(char *shortcutA, char *path, char *args);
-*/
-import "C"
-
-import (
- "errors"
- "fmt"
- "os"
- "path/filepath"
- "strings"
-)
-
-var startupDir string
-
-func init() {
- startupDir = filepath.Join(os.Getenv("USERPROFILE"), "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs", "Startup")
-}
-
-func (a *App) path() string {
- return filepath.Join(startupDir, a.Name+".lnk")
-}
-
-func (a *App) IsEnabled() bool {
- _, err := os.Stat(a.path())
- return err == nil
-}
-
-func (a *App) Enable() error {
- path := a.Exec[0]
- args := strings.Join(a.Exec[1:], " ")
-
- if err := os.MkdirAll(startupDir, 0777); err != nil {
- return err
- }
- res := C.CreateShortcut(C.CString(a.path()), C.CString(path), C.CString(args))
- if res != 0 {
- return errors.New(fmt.Sprintf("autostart: cannot create shortcut '%s' error code: 0x%.8x", a.path(), res))
- }
- return nil
-}
-
-func (a *App) Disable() error {
- return os.Remove(a.path())
-}
diff --git a/vendor/github.com/ProtonMail/go-autostart/autostart_xdg.go b/vendor/github.com/ProtonMail/go-autostart/autostart_xdg.go
deleted file mode 100644
index 39306a5..0000000
--- a/vendor/github.com/ProtonMail/go-autostart/autostart_xdg.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// +build !windows,!darwin
-
-package autostart
-
-import (
- "os"
- "path/filepath"
- "text/template"
-)
-
-const desktopTemplate = `[Desktop Entry]
-Type=Application
-Name={{.DisplayName}}
-Exec={{.Exec}}
-{{- if .Icon}}
-Icon={{.Icon}}{{end}}
-X-GNOME-Autostart-enabled=true
-`
-
-var autostartDir string
-
-func init() {
- if os.Getenv("XDG_CONFIG_HOME") != "" {
- autostartDir = os.Getenv("XDG_CONFIG_HOME")
- } else {
- autostartDir = filepath.Join(os.Getenv("HOME"), ".config")
- }
- autostartDir = filepath.Join(autostartDir, "autostart")
-}
-
-func (a *App) path() string {
- return filepath.Join(autostartDir, a.Name+".desktop")
-}
-
-// Check if the app is enabled on startup.
-func (a *App) IsEnabled() bool {
- _, err := os.Stat(a.path())
- return err == nil
-}
-
-type app struct {
- *App
-}
-
-// Override App.Exec to return a string.
-func (a *app) Exec() string {
- return quote(a.App.Exec)
-}
-
-// Enable this app on startup.
-func (a *App) Enable() error {
- t := template.Must(template.New("desktop").Parse(desktopTemplate))
-
- if err := os.MkdirAll(autostartDir, 0777); err != nil {
- return err
- }
- f, err := os.Create(a.path())
- if err != nil {
- return err
- }
- defer f.Close()
-
- return t.Execute(f, &app{a})
-}
-
-// Disable this app on startup.
-func (a *App) Disable() error {
- return os.Remove(a.path())
-}
diff --git a/vendor/github.com/ProtonMail/go-autostart/quote.go b/vendor/github.com/ProtonMail/go-autostart/quote.go
deleted file mode 100644
index b906eed..0000000
--- a/vendor/github.com/ProtonMail/go-autostart/quote.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build !darwin
-
-package autostart
-
-import (
- "strconv"
- "strings"
-)
-
-func quote(args []string) string {
- for i, v := range args {
- args[i] = strconv.Quote(v)
- }
-
- return strings.Join(args, " ")
-}