Skip to content

Latest commit

 

History

History
127 lines (87 loc) · 2.27 KB

README.md

File metadata and controls

127 lines (87 loc) · 2.27 KB

desktop

📦 Golang package for interfacing with desktop applications

format

🚀 Install

go get github.com/gleich/desktop

📝 Documentation

🍎 MacOS

MacOSApplications()

Get a list of all running desktop applications for the mac operating system. Returns a list containing the names of the running applications and any error that might have occurred.

Example:

package main

import (
    "fmt"
    "os"

    "github.com/gleich/desktop"
)

func main() {
    apps, err := desktop.MacOSApplications()
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
}

MacOSQuitApp()

Force quit an application by passing the name of the application. Returns any error that might have occurred.

package main

import (
    "fmt"
    "os"

    "github.com/gleich/desktop"
)

func main() {
    err := desktop.MacOSQuitApp("Slack")
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
}

🐧 Linux

LinuxApplications()

⚠️ Warning!! This function requires the wmctrl tool to be installed. Please install it with your package manager

Get a list of all running desktop applications for any linux based operating system. Returns a map containing the names of the running desktop applications and their corresponding PIDs and any error that might have occurred.

Example:

package main

import (
    "fmt"
    "os"

    "github.com/gleich/desktop"
)

func main() {
    apps, err := desktop.LinuxApplications()
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
}

LinuxQuitApp()

Kill an application by passing the PID. Returns any error that might have occurred.

Example:

package main

import (
    "fmt"
    "os"

    "github.com/gleich/desktop"
)

func main() {
    err := desktop.LinuxQuitApp(72667)
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
}

👥 Contributors