-
Notifications
You must be signed in to change notification settings - Fork 0
/
zenity.jl
153 lines (133 loc) · 3.22 KB
/
zenity.jl
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#=
author: Abdullah Yiğiterol
--info finished
--error finished
--warning finished
--question finished
--notification finished
--entry finished
--calendar finished
--file-selection finished
--color-selection finished
--scale finished
--password finished
--list
--progress
--text-info
--forms
--display=DISPLAY
=#
module Zenity
t = ""
w = false
h = false
function title(text)
global t = text
end
function wsize(we,he)
global w = we
global h = he
end
function resetsize()
global w = false
global h = false
end
function result(command)
try
run(command)
return true
catch
return false
end
end
function readresult(command)
try
return chomp(readstring(command))
catch
return false
end
end
function info(text)
command = `zenity --info --title "$t" --text "$text"`
if w != false
command = `zenity --info --title "$t" --text "$text" --width=$w --height=$h`
end
resetsize()
run(command)
end
function error(text)
command = `zenity --error --title "$t" --text "$text"`
if w != false
command = `zenity --error --title "$t" --text "$text" --width=$w --height=$h`
end
resetsize()
run(command)
end
function notification(text)
run(`zenity --notification --title "$t" --text "$text"`)
end
function question(text)
command = `zenity --question --title "$t" --text "$text"`
if w != false
command = `zenity --question --title "$t" --text "$text" --width=$w --height=$h`
end
resetsize()
return result(command)
end
function entry()
command = `zenity --entry --title "$t"`
if w != false
command = `zenity --entry --title "$t" --width=$w --height=$h`
end
resetsize()
return readresult(command)
end
function calendar()
command = `zenity --calendar --title "$t"`
if w != false
command = `zenity --calendar --title "$t" --width=$w --height=$h`
end
resetsize()
return readresult(command)
end
function file()
command = `zenity --file-selection --title "$t"`
if w != false
command = `zenity --file-selection --title "$t" --width=$w --height=$h`
end
resetsize()
return readresult(command)
end
function color()
command = `zenity --color-selection --title "$t"`
if w != false
command = `zenity --color-selection --title "$t" --width=$w --height=$h`
end
resetsize()
return readresult(command)
end
function palette()
command = `zenity --color-selection --show-palette --title "$t"`
if w != false
command = `zenity --color-selection --show-palette --title "$t" --width=$w --height=$h`
end
resetsize()
return readresult(command)
end
function scale()
command = `zenity --scale --title "$t"`
if w != false
command = `zenity --scale --title "$t" --width=$w --height=$h`
end
resetsize()
return readresult(command)
end
function password()
command = `zenity --password --title "$t"`
if w != false
command = `zenity --password --title "$t" --width=$w --height=$h`
end
resetsize()
return readresult(command)
end
end