diff --git a/src/man/xpra.1 b/src/man/xpra.1 index 307a9aaa08..3482bf572b 100644 --- a/src/man/xpra.1 +++ b/src/man/xpra.1 @@ -169,6 +169,8 @@ xpra \- viewer for remote, persistent X applications .HP \fBxpra\fP \fBinitenv\fP [\fB\-\-socket\-dir\fP=\fIDIR\fP] .HP +\fBxpra\fP \fBshowconfig\fP +.HP \fBxpra\fP \fBlist\fP [\fB\-\-socket\-dir\fP=\fIDIR\fP] .HP \fBxpra\fP \fBupgrade\fP \fI:[DISPLAY]\fP [...any options accepted by @@ -231,6 +233,11 @@ appear until you attach with \fBxpra attach\fP. \fBxpra list\fP Show a list of xpra servers you have running on the current host. .TP +\fBxpra showconfig\fP +Shows the configuration that would be used with other sub-commands, +taking into account the global defaults, per-user defaults and command +line arguments. +.TP \fBxpra attach\fP \fI:7\fP Attach to the xpra server that is using local display number \fI:7\fP. Any apps running on that server will appear on your screen. diff --git a/src/setup.py b/src/setup.py index 0e5b34bb98..a27c78bfbf 100755 --- a/src/setup.py +++ b/src/setup.py @@ -780,10 +780,6 @@ def build_xpra_conf(install_dir): xvfb_command, has_displayfd, _ = detect_xorg_setup(install_dir) with open("etc/xpra/xpra.conf.in", "r") as f_in: template = f_in.read() - if WIN32: - ssh_command = "plink -ssh -agent" - else: - ssh_command = "ssh -x" env_strs = [] if os.name=="posix": env_strs += [ @@ -803,11 +799,12 @@ def bstr(b): return ["no", "yes"][int(b)] env = "\n".join(envstr(*x) for x in env_strs) conf_dir = get_conf_dir(install_dir) + from xpra.platform.features import DEFAULT_SSH_COMMAND from xpra.platform.paths import get_socket_dirs, get_default_log_dir #remove build paths and user specific paths with UID ("/run/user/UID/Xpra"): socket_dirs = get_socket_dirs() SUBS = {'xvfb_command' : xvfb_command, - 'ssh_command' : ssh_command, + 'ssh_command' : DEFAULT_SSH_COMMAND, 'remote_logging' : bstr(OSX or WIN32), 'env' : env, 'has_displayfd' : bstr(has_displayfd), diff --git a/src/xpra/log.py b/src/xpra/log.py index 8de8ed14c3..9d71947c8a 100644 --- a/src/xpra/log.py +++ b/src/xpra/log.py @@ -12,6 +12,7 @@ LOG_PREFIX = os.environ.get("XPRA_LOG_PREFIX", "") LOG_FORMAT = os.environ.get("XPRA_LOG_FORMAT", "%(asctime)s %(message)s") +NOPREFIX_FORMAT = "%(message)s" logging.basicConfig(format=LOG_FORMAT) logging.root.setLevel(logging.INFO) diff --git a/src/xpra/platform/darwin/features.py b/src/xpra/platform/darwin/features.py index 03f507998e..3c45c8399b 100644 --- a/src/xpra/platform/darwin/features.py +++ b/src/xpra/platform/darwin/features.py @@ -12,5 +12,5 @@ UI_THREAD_POLLING = 500 #poll every 500 ms -DEFAULT_SSH_CMD = "ssh" +DEFAULT_SSH_COMMAND = "ssh" GOT_PASSWORD_PROMPT_SUGGESTION = "Perhaps you need to set up your ssh agent?\n" diff --git a/src/xpra/platform/features.py b/src/xpra/platform/features.py index a337d3e335..6696b73f96 100644 --- a/src/xpra/platform/features.py +++ b/src/xpra/platform/features.py @@ -20,12 +20,12 @@ UI_THREAD_POLLING = 0 OPEN_COMMAND = "xdg-open" +DEFAULT_SSH_COMMAND = "ssh -x" DEFAULT_PULSEAUDIO_COMMAND = "pulseaudio --start --daemonize=false --system=false " + \ "--exit-idle-time=-1 -n --load=module-suspend-on-idle " + \ "--load=module-null-sink --load=module-native-protocol-unix "+ \ "--log-level=2 --log-target=stderr" DEFAULT_XVFB_COMMAND = "Xvfb +extension Composite -screen 0 3840x2560x24+32 -nolisten tcp -noreset -auth $XAUTHORITY" -DEFAULT_SSH_CMD = False GOT_PASSWORD_PROMPT_SUGGESTION = "" @@ -34,9 +34,9 @@ "CAN_DAEMONIZE", "MMAP_SUPPORTED", "SYSTEM_TRAY_SUPPORTED", - "DEFAULT_SSH_CMD", "DEFAULT_PULSEAUDIO_COMMAND", "DEFAULT_XVFB_COMMAND", + "DEFAULT_SSH_COMMAND", "GOT_PASSWORD_PROMPT_SUGGESTION", "CLIPBOARDS", "CLIPBOARD_WANT_TARGETS", diff --git a/src/xpra/platform/win32/features.py b/src/xpra/platform/win32/features.py index e95864639c..50412bb726 100644 --- a/src/xpra/platform/win32/features.py +++ b/src/xpra/platform/win32/features.py @@ -8,7 +8,6 @@ CAN_DAEMONIZE = False MMAP_SUPPORTED = False SYSTEM_TRAY_SUPPORTED = True -DEFAULT_SSH_CMD = "plink" GOT_PASSWORD_PROMPT_SUGGESTION = \ 'Perhaps you need to set up Pageant, or (less secure) use --ssh="plink -pw YOUR-PASSWORD"?\n' @@ -20,3 +19,4 @@ DEFAULT_PULSEAUDIO_COMMAND = "" DEFAULT_XVFB_COMMAND = "" PRINT_COMMAND = "" +DEFAULT_SSH_COMMAND="plink -ssh -agent" \ No newline at end of file diff --git a/src/xpra/scripts/config.py b/src/xpra/scripts/config.py index ba4d631f9b..5291a32560 100644 --- a/src/xpra/scripts/config.py +++ b/src/xpra/scripts/config.py @@ -352,7 +352,7 @@ def get_defaults(): global GLOBAL_DEFAULTS if GLOBAL_DEFAULTS is not None: return GLOBAL_DEFAULTS - from xpra.platform.features import DEFAULT_SSH_CMD, OPEN_COMMAND, DEFAULT_PULSEAUDIO_COMMAND, DEFAULT_XVFB_COMMAND + from xpra.platform.features import DEFAULT_SSH_COMMAND, OPEN_COMMAND, DEFAULT_PULSEAUDIO_COMMAND, DEFAULT_XVFB_COMMAND from xpra.platform.paths import get_download_dir, get_default_log_dir try: from xpra.platform.info import get_username @@ -378,7 +378,7 @@ def get_defaults(): "tcp-encryption" : "", "encryption-keyfile": "", "tcp-encryption-keyfile": "", - "ssh" : DEFAULT_SSH_CMD, + "ssh" : DEFAULT_SSH_COMMAND, "xvfb" : DEFAULT_XVFB_COMMAND, "socket-dir" : "", "log-dir" : get_default_log_dir(), @@ -405,7 +405,7 @@ def get_defaults(): "file-size-limit" : 10, "idle-timeout" : 0, "server-idle-timeout" : 0, - "auto-refresh-delay": 0.25, + "auto-refresh-delay": 0.15, "daemon" : True, "use-display" : False, "displayfd" : False, @@ -456,10 +456,10 @@ def get_defaults(): "Meta+Shift+F8:magic_key", "Meta+Shift+F11:show_session_info" ], - "bind-tcp" : None, - "start" : None, - "start-child" : None, - "env" : None, + "bind-tcp" : [], + "start" : [], + "start-child" : [], + "env" : [], } return GLOBAL_DEFAULTS #fields that got renamed: diff --git a/src/xpra/scripts/main.py b/src/xpra/scripts/main.py index 5b7fcd338a..a9e1584f31 100755 --- a/src/xpra/scripts/main.py +++ b/src/xpra/scripts/main.py @@ -292,6 +292,7 @@ def do_parse_cmdline(cmdline, defaults): "\t%prog control DISPLAY command [arg1] [arg2]..\n", "\t%prog print DISPLAY filename", "\t%prog version [DISPLAY]\n" + "\t%prog showconfig\n" ] server_modes = [] if supports_server: @@ -961,6 +962,8 @@ def run_mode(script_file, error_cb, options, args, mode, defaults): script = xpra_runner_shell_script(script_file, os.getcwd(), options.socket_dir) write_runner_shell_script(script, False) return 0 + elif mode == "showconfig": + return run_showconfig(options, args) else: error_cb("invalid mode '%s'" % mode) return 1 @@ -1711,6 +1714,33 @@ def run_list(error_cb, opts, extra_args): may_cleanup_socket(state, display, sockpath, clean_states=clean_states) return 0 +def run_showconfig(options, args): + from xpra.colorstreamhandler import ColorStreamHandler + from xpra.log import Logger, NOPREFIX_FORMAT + from logging import Formatter + csh = ColorStreamHandler(sys.stdout) + csh.setFormatter(Formatter(NOPREFIX_FORMAT)) + setloghandler(csh) + log = Logger("util") + if args: + log.warn("extra command arguments ignored") + log.info("Default Configuration:") + from xpra.scripts.config import get_defaults + d = get_defaults() + NODEFAULTS = ["socket-dirs", "env", "xvfb"] + marker = object() + for k in sorted(d.keys()): + dv = d[k] + cv = getattr(options, name_to_field(k), marker) + if cv==marker: + continue #virtual field with no command line equivallent, don't show it + if cv!=dv and k not in NODEFAULTS: + if dv==["all"]: + dv = "all" + log.warn("%-20s= %-32s (default=%s)", k, cv, dv) + else: + log.info("%-20s= %s", k, cv) + if __name__ == "__main__": code = main("xpra.exe", sys.argv)