Commit 2ef79576 by Szeberényi Imre

--notray-icon fix

parent 2251f4d6
...@@ -26,11 +26,12 @@ loghandler.setFormatter(logformatter) ...@@ -26,11 +26,12 @@ loghandler.setFormatter(logformatter)
logger.addHandler(loghandler) logger.addHandler(loghandler)
def remina_password(pw): def remina_password(pw):
args = ["remmina", "--encrypt-password", "--no-tray-icon"] args = ["remmina", "--encrypt-password"]
process = subprocess.run(args, input=pw, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, encoding="utf-8", timeout=5) process = subprocess.run(args, input=pw, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, encoding="utf-8", timeout=5)
b = process.stdout.find("Encrypted password:") b = process.stdout.find("Encrypted password:")
process.stdout[b::].split() if b >= 0:
return process.stdout[198::].split()[2] return process.stdout[b::].split()[2]
logger.error("Cannot run remmina: %s" % process.stdout)
def connect(vm): def connect(vm):
""" """
...@@ -56,7 +57,7 @@ def connect(vm): ...@@ -56,7 +57,7 @@ def connect(vm):
elif vm.protocol in ("NX", "RDP"): elif vm.protocol in ("NX", "RDP"):
password = remina_password(vm.password) password = remina_password(vm.password)
if vm.protocol == "RDP": if vm.protocol == "RDP":
command = ("remmina --no-tray-icon" command = ("remmina"
" -c rdp://%(user)s:%(password)s@%(host)s:%(port)s" % { " -c rdp://%(user)s:%(password)s@%(host)s:%(port)s" % {
'user': vm.user, 'user': vm.user,
'password': password, 'password': password,
...@@ -64,7 +65,7 @@ def connect(vm): ...@@ -64,7 +65,7 @@ def connect(vm):
'port': vm.port, 'port': vm.port,
}) })
else: else:
command = ("remmina --no-tray-icon" command = ("remmina"
" -c rdp://%(user)s:%(password)s@%(host)s:%(port)s" % { " -c rdp://%(user)s:%(password)s@%(host)s:%(port)s" % {
'user': vm.user, 'user': vm.user,
'password': password, 'password': password,
...@@ -72,7 +73,7 @@ def connect(vm): ...@@ -72,7 +73,7 @@ def connect(vm):
'port': vm.port, 'port': vm.port,
}) })
logger.debug("Running: s", command) logger.debug("Running: s", command)
subprocess.call(command, shell=True) subprocess.call(command.split())
class Struct: class Struct:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment