π¦ Golang package for interfacing with desktop applications
go get github.com/gleich/desktop
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)
}
}
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)
}
}
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)
}
}
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)
}
}