Skip to content

Commit

Permalink
try harder to find a valid command
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Nov 8, 2023
1 parent 9046a8a commit 9d81d1e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions xpra/server/window/content_guesser.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,23 @@ def load_command_to_type() -> dict[str, str]:

def guess_content_type_from_command(window) -> str:
if POSIX and not OSX:
command = getprop(window, "command")
command = getprop(window, "command") or ""
log(f"guess_content_type_from_command({window}) command={command}")
if command:
ctt = load_command_to_type()
cmd = os.path.basename(command)
ctype = ctt.get(cmd)
log("content-type(%s)=%s", cmd, ctype)
return ctype
commands = [command]
for x in command.split("\0"):
if x and x not in commands:
commands.append(x)
for x in command.split(" "):
if x and x not in commands:
commands.append(x)
for x in commands:
cmd = os.path.basename(x)
ctype = ctt.get(cmd)
log("content-type(%s)=%s", cmd, ctype)
if ctype:
return ctype
return ""


Expand Down

0 comments on commit 9d81d1e

Please sign in to comment.