Skip to content
This repository was archived by the owner on May 3, 2023. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,41 @@ func NewLinuxTracker() Tracker {
}

func (t *LinuxTracker) Deps() string {
return `Install the following command-line utilities via your package manager (e.g., apt) of choice:
* xdpyinfo
* xwininfo
* xdotool
* wmctrl
`
var output = "\r\nInstall these following command-line utilities via your package manager (e.g., apt) of choice:\r\n"
var depsRequired = false
if !verifyCommand("xdpyinfo") {
output += "\r\n* xdpyinfo"
depsRequired = true
}
if !verifyCommand("xwininfo") {
output += "\r\n* xwininfo"
depsRequired = true
}
if !verifyCommand("xdotool") {
output += "\r\n* xdotool"
depsRequired = true
}
if !verifyCommand("wmctrl") {
output += "\r\n* wmctrl"
depsRequired = true
}

if depsRequired {
output += "\r\n\r\nExample deb/apt install command: apt-get install x11-utils xdotool wmctrl"
output += "\r\nExample rpm/yum install command: yum install xorg-x11-utils xdotool wmctrl"
return output
} else {
return `All dependencies already installed.`
}
}

func verifyCommand(file string) bool {
var _, err = exec.LookPath(file)
if err != nil {
return false
} else {
return true
}
}

func (t *LinuxTracker) Snap() (*Snapshot, error) {
Expand Down