forked from Yisus7u7/termux-desktop-lxqt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
304 lines (273 loc) · 12.8 KB
/
main.py
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
#! /data/data/com.termux/files/usr/bin/python
import os
from os import system as sys
from os import chdir as cd
from sys import argv
from time import sleep
try :
import colorama
except ModuleNotFoundError :
sleep(1)
sys(' echo -e "\033[1;35m ERROR : \033[1;32m Module colorama Not Found " ')
sleep(3)
sys('echo -e "\033[1;35m FETCHING : \033[1;32m colorama "')
sys(' pip install colorama ')
sys(' echo -e "\033[0m"')
# -- BEING COLORS --
from colorama import *
init(autoreset=True)
Green = Fore.GREEN + Style.BRIGHT
Red = Fore.RED + Style.BRIGHT
Yellow = Fore.YELLOW + Style.BRIGHT
Blue = Fore.BLUE + Style.BRIGHT
Magenta = Fore.MAGENTA + Style.BRIGHT
Cyan = Fore.CYAN + Style.BRIGHT
# -- END COLORS --
f_v = '0'
try :
x11=open("/data/data/com.termux/files/usr/etc/apt/sources.list.d/x11.list")
except FileNotFoundError :
sleep(1)
print(Magenta + " ERROR : " + Green + " Mirror x11 Not Found")
sleep(3)
print(Magenta + " INSTALLING : " + Green + " x11")
sleep(1)
sys('pkg install -y x11-repo')
class install :
def xfce(version,url):
PKG = "wget mpv-x xfce4 geany thunar geany-plugins featherpad zenity libnotify xfce4-whiskermenu-plugin xfce4-clipman-plugin xorg-xhost uget ristretto galculator arqiver pinentry-gtk mtpaint lximage-qt lxqt-notificationd xfce4-taskmanager loqui audacious qt5-qtbase-gtk-platformtheme kvantum qt5ct otter-browser tigervnc"
DIR = "$HOME/Desktop $HOME/Documents $HOME/Downloads $HOME/Public $HOME/Videos $HOME/Templates $HOME/Pictures"
print(Magenta+"\t TERMUX - DESKTOP \n")
sleep(1)
print(Magenta+" ENVIRONMENT : "+Cyan + "XFCE")
sleep(0.3)
print(Magenta+" VERSION : "+Green + version)
sleep(2)
input(Magenta+"\n Push Enter To Continue "+Cyan+">>")
sleep(2)
print(Magenta+"\t INSTALLING PACKAGES"+Green+"...")
sleep(0.5)
sys('pkg install -y '+PKG)
sleep(1)
print(Magenta+"\t GETTING ICON FILE "+Green+"...")
sleep(1)
sys('rm -rf $HOME/.vnc')
sys('wget '+url+" -O $HOME/data.tar.xz")
print(Magenta+"\n\t EXTRACTING FILE "+Green+"...")
sleep(3)
sys('tar -xvf $HOME/data.tar.xz --directory $HOME')
sleep(2)
print(Magenta+"\t REMOVING CACHED DATA "+Green+"...")
sys('rm $HOME/data.tar.xz')
#sys('wget https://github.com/Yisus7u7/termux-desktop-lxqt/releases/downlo -O $')
sys('wget https://github.com/Yisus7u7/termux-desktop-xfce/releases/download/kde/breeze-cursor-theme_5.20.5-4_all.deb -O $HOME/theme.deb')
sys('dpkg -i $HOME/theme.deb')
sys('rm $HOME/theme.deb')
sys('wget https://github.com/Yisus7u7/termux-desktop-xfce/releases/download/arc/termux-arc-gtk-theme_20210412_all.deb -O $HOME/atheme.deb')
sys('dpkg -i $HOME/atheme.deb')
sys('rm $HOME/atheme.deb')
print(Magenta+"\n\n To Start The Vnc Server, Type :"+Green+" e-tnv"+" start")
print(Magenta+" To Stop it, Type :"+Green+" e-tnv"+" stop")
print(Magenta+" Or "+Green+" e-tnv"+" stopall")
def lxqt(version,url):
PKG = "xcompmgr audacious wget xpdf qt5-qtbase-gtk-platformtheme qt5-qttools qt5-qtx11extras lxqt lxqt-build-tools otter-browser qgit featherpad gtk2 gtk3 python-tkinter tigervnc xorg-xhost openbox geany qt5-qtwebsockets qt5-qtxmlpatterns qt5-qtdeclarative termux-api geany-plugins xorg-xprop neofetch galculator qt5-qttools glade feathernotes xorg-xprop mtpaint xorg-xhost"
DIR = "$HOME/Desktop $HOME/Documents $HOME/Downloads $HOME/Public $HOME/Videos $HOME/Templates $HOME/Pictures"
print(Magenta+"\t TERMUX - DESKTOP \n")
sleep(1)
print(Magenta+" ENVIRONMENT : "+Cyan + "LXQT")
sleep(0.3)
print(Magenta+" VERSION : "+Green + version)
sleep(2)
input(Magenta+"\n Push Enter To Continue "+Cyan+">> ")
sleep(2)
print(Magenta+"\t INSTALLING PACKAGES"+Green+"...")
sleep(0.5)
sys('pkg install -y '+PKG)
sleep(1)
print(Magenta+"\t GETTING ICON FILE "+Green+"...")
sleep(1)
sys('rm -rf $HOME/.vnc')
sys('wget '+url+" -O $HOME/data.tar.xz")
print(Magenta+"\n\t EXTRACTING FILE "+Green+"...")
sleep(3)
sys('tar -xvf $HOME/data.tar.xz --directory $HOME')
sleep(2)
print(Magenta+"\t REMOVING CACHED DATA "+Green+"...")
sys('wget https://github.com/Yisus7u7/termux-desktop-lxqt/releases/download/data/breeze-cursor-theme_5.20.5-4_all.deb -O $HOME/theme.deb')
sys('dpkg -i $HOME/theme.deb')
sys('rm $HOME/theme.deb')
sys('rm $HOME/data.tar.xz')
print(Magenta+"\n\n To Start The Vnc Server, Type :"+Green+" e-tnv"+" start")
print(Magenta+" To Stop it, Type :"+Green+" e-tnv"+" stop")
print(Magenta+" Or "+Green+" e-tnv"+" stopall")
cmd = '0'
try :
cmd = argv[1].lower()
except :
pass
if cmd == 'start':
sys('vncserver -listen tcp')
sys('vncserver -list')
sys('termux-open vnc://127.0.0.1:5901')
elif cmd == 'stop':
try :
tn=int(input(Magenta+"Enter DISPLAY ID To Kill"+Green+" : "))
tmp=str(tn)
sys('vncserver -kill :'+tmp)
except ValueError:
print(Magenta+"ERROR :"+Green+"Input Id be an Integer Only !!!")
elif cmd == 'stopall':
print(Magenta+"\t Killing Xvnc")
sys('killall Xvnc')
print(Magenta+"\t Process "+Green+": KILLED")
elif cmd == '-r' or cmd == '--remove':
print(Magenta+"\n\t REMOVING FILES "+Green+"...")
sleep(3)
sys('rm -rf $HOME/.local $HOME/.icons $HOME/.cache $HOME/.config $HOME/.vnc $HOME/.themes')
print(Magenta+" Process "+Green+" : FINISHED ")
elif cmd == '-unin' or cmd == '--uninstall' or cmd == '-u':
ui=input(Magenta +" Do You Want To Uninstall ? \n "+Green+" Other Unsaved Data will be DELETED\n"+Yellow+" Type yes To Continue "+Green+" : ")
tmp = ui.lower()
if tmp == 'yes' :
print(Magenta +"\t Uninstalling"+Green+" ...")
sleep(2)
sys('pkg uninstall mpv-x xfce4 geany thunar geany-plugins featherpad zenity libnotify xfce4-whiskermenu-plugin xfce4-clipman-plugin xorg-xhost uget ristretto galculator arqiver pinentry-gtk mtpaint lximage-qt lxqt-notificationd xfce4-taskmanager loqui audacious qt5-qtbase-gtk-platformtheme kvantum qt5ct otter-browser tigervnc xcompmgr audacious xpdf qt5-qtbase-gtk-platformtheme qt5-qttools qt5-qtx11extras lxqt lxqt-build-tools otter-browser qgit featherpad gtk2 gtk3 python-tkinter tigervnc xorg-xhost openbox geany qt5-qtwebsockets qt5-qtxmlpatterns qt5-qtdeclarative termux-api geany-plugins xorg-xprop neofetch galculator qt5-qttools glade feathernotes xorg-xprop mtpaint xorg-xhost')
sys('apt clean')
sys('apt autoremove -y')
sys('rm -rf $HOME/.local $HOME/.icons $HOME/.cache $HOME/.config $HOME/.vnc $HOME/.themes')
print(Magenta+" Process"+Green+" : FINISHED")
else :
print(Magenta+"\n Process"+Green+" : CANCELLED")
elif cmd == '--help' or cmd == '-h' :
print("\nUsage : "+argv[0]+" option [option] \n\noptions : \n\n -in or --install\t install desktop environment\n -unin or --uninstall\t uninstall desktop completely\n start\t for start vncserver\n stop\t for stop desktop by id\n stopall\t for kill all vncservers\n -r or --remove\t remove themes and icon files\n -l or --list \tfor list Available Versions\n\n Example : \n \t e-tnv --install xfce 3.0.9")
elif cmd == '--list' or cmd == '-l':
print(Magenta+" \n"+Green+" Versions : \n\t"+Magenta+"xfce"+Green+" [ 3.0.1 ] \n\t"+Magenta+"xfce"+Green+" [ 3.0.4 ] \n\t"+Magenta+"xfce"+Green+" [ 3.0.9 ] \n\t"+Magenta+"xfce"+Green+" [ 4.0.2 ] "+Yellow+"[ Default ]\n\n\t"+Magenta+"lxqt"+Green+" [ 1.0.4 ] \n\t"+Magenta+"lxqt"+Green+" [ 2.0.1 ] \n\t"+Magenta+"lxqt"+Green+" [ 2.1.3 ]"+Yellow+"[ Default ] ")
elif cmd == '-i' or cmd =='-in' or cmd == '--install':
try :
usr_d = '0'
usr_d = argv[2].lower()
except IndexError :
print(Green+" [1]"+Yellow+" Install"+Magenta+" XFCE ")
print(Green+" [2]"+Yellow+" Install"+Magenta+" LXQT ")
try :
tmp1 = int(input(Magenta+" >> "+Green))
if tmp1 > 2 or tmp1 < 1 :
print(Magenta+" ERROR "+Green+": Undefined Range ")
elif tmp1 == 1 :
usr_d = 'xfce'
else :
usr_d = 'lxqt'
except ValueError :
print(Magenta+" ERROR "+Green+": Input Must Be An Integer ")
exit(0)
if usr_d == 'xfce' :
print(Yellow+"\t Select Version ")
print(Green+" [1]"+Magenta+" 4.0.2 [ Recommended ]")
print(Green+" [2]"+Magenta+" 3.0.9")
print(Green+" [3]"+Magenta+" 3.0.4")
print(Green+" [4]"+Magenta+" 3.0.1")
try :
tmp3 = int(input(Magenta+" >> "+Green))
if tmp3 == 1 :
f_v = '4.0.2'
elif tmp3 == 2 :
f_v = '3.0.9'
elif tmp3 == 3 :
f_v = '3.0.4'
elif tmp3 == 4 :
f_v = '3.0.1'
else :
print(Magenta+" ERROR "+Green+": Undefined Range")
exit(0)
except :
print(Magenta+" ERROR OCCURED "+Green+"...")
elif usr_d == 'lxqt' :
print(Yellow+"\t Select Version ")
print(Green+" [1]"+Magenta+" 2.1.3 [Recommended]")
print(Green+" [2]"+Magenta+" 2.0.1")
print(Green+" [3]"+Magenta+" 1.0.4")
try :
tmp3 = int(input(Magenta+" >> "+Green))
if tmp3 == 1 :
f_v = '2.1.3'
elif tmp3 == 2 :
f_v = '2.0.1'
elif tmp3 == 3 :
f_v = '1.0.4'
else :
print(Magenta+" ERROR "+Green+" Undefined Range ")
except :
print(Magenta+" Error Occured")
exit(0)
usr_v = '0'
try :
usr_v = argv[3]
if usr_d == 'xfce' :
if usr_v == '4.0.2':
f_v = '4.0.2'
elif usr_v == '3.0.9':
f_v = '3.0.9'
elif usr_v == '3.0.4':
f_v = '3.0.4'
elif usr_v == '3.0.1' :
f_v = '3.0.1'
else :
print(Magenta+"ERROR "+Green+": Version Not Found")
elif usr_d == 'lxqt':
if usr_v == '1.0.4':
f_v = '1.0.4'
elif usr_v == '2.0.1':
f_v = '2.0.1'
elif usr_v == '2.1.3':
f_v = '2.1.3'
except:
if usr_d == 'xfce' :
if f_v == '0' :
f_v = '4.0.2'
elif usr_d == 'lxqt':
if f_v == '0' :
f_v = '2.1.3'
# if usr_d == 'lxqt':
# f_v = '2.1.3'
#if usr_d == 'xfce':
#print(usr_d)
#print(f_v)
#elif usr_d == 'lxqt':
#print(usr_d)
if usr_d == 'xfce' :
if f_v == '4.0.2' :
url = 'https://github.com/Yisus7u7/termux-desktop-xfce/releases/download/4.0.2/datar.tar.xz'
elif f_v == '3.0.9' :
url = 'https://github.com/er-termux/desktop-files-2/raw/main/xfce/3.0.9/data.tar.xz'
elif f_v == '3.0.4' :
url = 'https://github.com/er-termux/desktop-files-2/raw/main/xfce/3.0.4/data.tar.xz'
elif f_v == '3.0.1' :
url = 'https://github.com/er-termux/desktop-files/raw/main/xfce/3.0.1/data.tar.xz'
elif usr_d == 'lxqt' :
if f_v == '2.1.3' :
url = 'https://github.com/Yisus7u7/termux-desktop-lxqt/releases/download/data/termux_desktop_lxqt_data.tar.xz'
elif f_v == '2.0.1' :
url = 'https://github.com/er-termux/desktop-files/raw/main/lxqt/2.0.1/data.tar.xz'
elif f_v == '1.0.4' :
url = 'https://github.com/er-termux/desktop-files/raw/main/lxqt/1.0.4/data.tar.xz'
if usr_d == 'xfce' :
sys('rm -rf .cache/ .config/ .icons/ .themes/ .vnc/')
if f_v == '4.0.2' :
install.xfce(f_v,url)
elif f_v == '3.0.9' :
install.xfce(f_v,url)
elif f_v == '3.0.4' :
install.xfce(f_v,url)
elif f_v == '3.0.1' :
install.xfce(f_v,url)
elif usr_d == 'lxqt' :
sys('rm -rf .cache/ .config/ .icons/ .themes/ .vnc/')
if f_v == '2.1.3' :
install.lxqt(f_v,url)
elif f_v == '2.0.1' :
install.lxqt(f_v,url)
elif f_v == '1.0.4' :
install.lxqt(f_v,url)
else :
print(Magenta+"e-tnv"+Green+" : "+cmd + " : "+Yellow+"invalid option")
print("\n Try :\n\t --help \t To See more Information")