-
Notifications
You must be signed in to change notification settings - Fork 0
/
createdesktop
235 lines (228 loc) · 8.27 KB
/
createdesktop
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#!/usr/bin/env python3
print("Creating Desktop Shortcut window...")
import subprocess
from configparser import *
configur = ConfigParser()
import sys
from os.path import expanduser
user = sys.argv[1]
home_path = expanduser("~%s" % user)
library = configur.read(home_path+"/.thunder/library.cfg")
# First game in library
libraryoneNM = configur.get("one", "NM")
libraryoneID = configur.get("one", "ID")
libraryoneCV = configur.get("one", "CV")
libraryoneRN = configur.get("one", "RN")
# Second game in library
librarytwoNM = configur.get("two", "NM")
librarytwoID = configur.get("two", "ID")
librarytwoCV = configur.get("two", "CV")
librarytwoRN = configur.get("two", "RN")
# Third game in library
librarythreeNM = configur.get("three", "NM")
librarythreeID = configur.get("three", "ID")
librarythreeCV = configur.get("three", "CV")
librarythreeRN = configur.get("three", "RN")
# Fourth game in library
libraryfourNM = configur.get("four", "NM")
libraryfourID = configur.get("four", "ID")
libraryfourCV = configur.get("four", "CV")
libraryfourRN = configur.get("four", "RN")
# Fifth game in library
libraryfiveNM = configur.get("five", "NM")
libraryfiveID = configur.get("five", "ID")
libraryfiveCV = configur.get("five", "CV")
libraryfiveRN = configur.get("five", "RN")
# Sixth game in library
librarysixNM = configur.get("six", "NM")
librarysixID = configur.get("six", "ID")
librarysixCV = configur.get("six", "CV")
librarysixRN = configur.get("six", "RN")
# Seventh game in library
librarysevenNM = configur.get("seven", "NM")
librarysevenID = configur.get("seven", "ID")
librarysevenCV = configur.get("seven", "CV")
librarysevenRN = configur.get("seven", "RN")
# Eighth game in library
libraryeightNM = configur.get("eight", "NM")
libraryeightID = configur.get("eight", "ID")
libraryeightCV = configur.get("eight", "CV")
libraryeightRN = configur.get("eight", "RN")
# Ninth game in library
librarynineNM = configur.get("nine", "NM")
librarynineID = configur.get("nine", "ID")
librarynineCV = configur.get("nine", "CV")
librarynineRN = configur.get("nine", "RN")
# Tenth game in library
librarytenNM = configur.get("ten", "NM")
librarytenID = configur.get("ten", "ID")
librarytenCV = configur.get("ten", "CV")
librarytenRN = configur.get("ten", "RN")
# 11 game in library
library11NM = configur.get("11", "NM")
library11ID = configur.get("11", "ID")
library11CV = configur.get("11", "CV")
library11RN = configur.get("11", "RN")
# 12 game in library
library12NM = configur.get("12", "NM")
library12ID = configur.get("12", "ID")
library12CV = configur.get("12", "CV")
library12RN = configur.get("12", "RN")
# 13 game in library
library13NM = configur.get("13", "NM")
library13ID = configur.get("13", "ID")
library13CV = configur.get("13", "CV")
library13RN = configur.get("13", "RN")
# 14 game in library
library14NM = configur.get("14", "NM")
library14ID = configur.get("14", "ID")
library14CV = configur.get("14", "CV")
library14RN = configur.get("14", "RN")
# 15 game in library
library15NM = configur.get("15", "NM")
library15ID = configur.get("15", "ID")
library15CV = configur.get("15", "CV")
library15RN = configur.get("15", "RN")
# 16 game in library
library16NM = configur.get("16", "NM")
library16ID = configur.get("16", "ID")
library16CV = configur.get("16", "CV")
library16RN = configur.get("16", "RN")
# 17 game in library
library17NM = configur.get("17", "NM")
library17ID = configur.get("17", "ID")
library17CV = configur.get("17", "CV")
library17RN = configur.get("17", "RN")
# 18 game in library
library18NM = configur.get("18", "NM")
library18ID = configur.get("18", "ID")
library18CV = configur.get("18", "CV")
library18RN = configur.get("18", "RN")
# 19 game in library
library19NM = configur.get("19", "NM")
library19ID = configur.get("19", "ID")
library19CV = configur.get("19", "CV")
library19RN = configur.get("19", "RN")
# 20 game in library
library20NM = configur.get("20", "NM")
library20ID = configur.get("20", "ID")
library20CV = configur.get("20", "CV")
library20RN = configur.get("20", "RN")
from guizero import *
def createdesktop():
print("Creating Desktop Shortcut...")
f = open(home_path+"/Desktop/"+protocal.value+".desktop", "w")
f.write("[Desktop Entry]\n")
f.write("Name = "+protocal.value+"\n")
if protocal.value == libraryoneNM:
gamexec = libraryoneID
gamepic = libraryoneCV
gamerun = libraryoneRN
if protocal.value == librarytwoNM:
gamexec = librarytwoID
gamepic = librarytwoCV
gamerun = librarytwoRN
if protocal.value == librarythreeNM:
gamexec = librarythreeID
gamepic = librarythreeCV
gamerun = librarythreeRN
if protocal.value == libraryfourNM:
gamexec = libraryfourID
gamepic = libraryfourCV
gamerun = libraryfourRN
if protocal.value == libraryfiveNM:
gamexec = libraryfiveID
gamepic = libraryfiveCV
gamerun = libraryfiveRN
if protocal.value == librarysixNM:
gamexec = librarysixID
gamepic = librarysixCV
gamerun = librarysixRN
if protocal.value == librarysevenNM:
gamexec = librarysevenID
gamepic = librarysevenCV
gamerun = librarysevenRN
if protocal.value == libraryeightNM:
gamexec = libraryeightID
gamepic = libraryeightCV
gamerun = libraryeightRN
if protocal.value == librarynineNM:
gamexec = librarynineID
gamepic = librarynineCV
gamerun = librarynineRN
if protocal.value == librarytenNM:
gamexec = librarytenID
gamepic = librarytenCV
gamerun = librarytenRN
if protocal.value == library11NM:
gamexec = library11ID
gamepic = library11CV
gamerun = library11RN
if protocal.value == library12NM:
gamexec = library12ID
gamepic = library12CV
gamerun = library12RN
if protocal.value == library13NM:
gamexec = library13ID
gamepic = library13CV
gamerun = library13RN
if protocal.value == library14NM:
gamexec = library14ID
gamepic = library14CV
gamerun = library14RN
if protocal.value == library15NM:
gamexec = library15ID
gamepic = library15CV
gamerun = library15RN
if protocal.value == library16NM:
gamexec = library16ID
gamepic = library16CV
gamerun = library16RN
if protocal.value == library17NM:
gamexec = library17ID
gamepic = library17CV
gamerun = library17RN
if protocal.value == library18NM:
gamexec = library18ID
gamepic = library18CV
gamerun = library18RN
if protocal.value == library19NM:
gamexec = library19ID
gamepic = library19CV
gamerun = library19RN
if protocal.value == library20NM:
gamexec = library20ID
gamepic = library20CV
gamerun = library20RN
if gamerun == "steam":
gamerun = "steam steam://rungameid/"+gamexec
if gamerun == "wine":
gamerun = "wine "+gamexec
if gamerun == "mednafen":
gamerun = "mednafen "+gamexec
if gamerun == "linux":
gamerun = gamexec
if gamerun == "browser":
gamerun = "x-www-browser "+gamexec
if gamerun == "flatpak":
gamerun = "flatpak run "+gamexec
f.write("Exec="+gamerun+"\n")
f.write("Icon="+gamepic+"\n")
f.write("Type=Application\n")
f.write("Categories=Game;\n")
f.write("Terminal=false\n")
if startup.value == "ON":
f.write("StartupNotify=true\n")
if startup.value == "OFF":
f.write("StartupNotify=false\n")
f.close()
print('Running chmod +x "'+home_path+'/Desktop/'+protocal.value+'.desktop"')
command = f'chmod +x "'+home_path+'/Desktop/'+protocal.value+'.desktop"'
process = subprocess.Popen(command, stdout=True, stderr=True, shell=True)
app = App(title="Thunder - Create Desktop Shortcut",height=135,width=375)
text = Text(app, text="Please choose which game:")
protocal = Combo(app, options=[libraryoneNM,librarytwoNM,librarythreeNM,libraryfourNM,libraryfiveNM,librarysixNM,librarysevenNM,libraryeightNM,librarynineNM,librarytenNM,library11NM,library12NM,library13NM,library14NM,library15NM,library16NM,library17NM,library18NM,library19NM,library20NM], selected=libraryoneNM)
Text(app, text="Startup Notify:")
startup = Combo(app, options=["ON", "OFF"], selected="ON")
PushButton(app,text="Create Shortcut",command=createdesktop)
app.display()