Skip to content
/ desktop Public
generated from gleich/go_template

πŸ“¦ Golang package for interfacing with desktop applications

License

Notifications You must be signed in to change notification settings

gleich/desktop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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