-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzenity.go
More file actions
43 lines (35 loc) · 736 Bytes
/
zenity.go
File metadata and controls
43 lines (35 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"os/exec"
)
// Assume that zenity is available
var IsZenity = true
func ZenityTest() {
out, err := RunScript("zenity-test.bash")
if err != nil {
IsZenity = false
fmt.Println("zenity disabled")
}
fmt.Println("zenity version: " + string(out))
}
func RunScript(name string, arg ...string) ([]byte, error) {
// fmt.Println(arg)
cmd := exec.Command(PathToAssets+"/scripts/"+name, arg...)
out, err := cmd.CombinedOutput()
// fmt.Println(out)
// fmt.Println(err)
return out, err
}
func ZenityHelp() {
if !IsZenity {
return
}
go RunScript("zenity-help.bash")
}
func ZenityInfo(info string, timeout string) {
if !IsZenity {
return
}
go RunScript("zenity-info.bash", info, timeout)
}