diff --git a/main.py b/main.py index 9edfa54..28480e1 100644 --- a/main.py +++ b/main.py @@ -14,10 +14,7 @@ def vnc_mode(port=1,mode="start",xstartup=os.getenv('HOME')+"/.vnc/xstartup"): else: print(vncrunningdialog(port)) elif mode == "stop": - if vnc.stopvnc(port): - print(vnckilldialog(port)) - else: - print("No VNC server running at "+str(port)) + vnc.stopvnc(port) else: print("xstartup file not found") diff --git a/utils/info.py b/utils/info.py index 7074015..2ac29c0 100644 --- a/utils/info.py +++ b/utils/info.py @@ -21,6 +21,3 @@ def vncrunningdialog(port): +green("vncserver -kill :"+str(port))\ +" or "+blue("stopvnc") -def vnckilldialog(port): - return "vncserver stopped on "+str(LOCALIP)+" port "+str(port) - diff --git a/utils/upgrade.py b/utils/upgrade.py index eb5ea92..0390fcb 100644 --- a/utils/upgrade.py +++ b/utils/upgrade.py @@ -1,7 +1,7 @@ import os from utils.funs import * -CURRENT_VERSION = "v0.2" +CURRENT_VERSION = "v0.3" REMOTE_VERISON = os.popen("git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/RandomCoderOrg/udroid-extra-tool-proot | tail -n1 | cut -d \"/\" -f 3").read().strip() def isold(): diff --git a/utils/vnc.py b/utils/vnc.py index 5707d7b..0bc0ab9 100644 --- a/utils/vnc.py +++ b/utils/vnc.py @@ -1,14 +1,15 @@ import os +from funs import nmsg DISPLAY=os.getenv('DISPLAY') -VNC_LOCK_TYPE="/tmp/X11-unix/X" +VNC_LOCK_TYPE="/tmp/.X11-unix/X" def isvncstarted(port:int) -> bool: """ Check if VNC is started """ if os.path.exists(VNC_LOCK_TYPE+str(port)) \ - or os.path.exists("/tmp/X"+str(port)+"-lock"): + or os.path.exists("/tmp/.X"+str(port)+"-lock"): return True else: return False @@ -36,9 +37,12 @@ def stopvnc(port:int) -> bool: port = int(os.getenv('DEFAULT_VNC_PORT')) if isvncstarted(port): - if os.WEXITSTATUS(os.system("vncserver -kill :"+str(port))) == 0: - return True - else: - return False + os.WEXITSTATUS(os.system("vncserver -kill :"+str(port))) + nmsg("Cleaning Lock File") + if os.path.exists(VNC_LOCK_TYPE+str(port)): + os.remove(VNC_LOCK_TYPE+str(port)) + if os.path.exists("/tmp/.X"+str(port)+"-lock"): + os.remove("/tmp/.X"+str(port)+"-lock") + nmsg("VNC Server Stopped") else: - return False + nmsg("VNC Server not started at "+str(port))