From 1b1384b5fef5eb32d877cbb323ae850828de0478 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Wed, 13 Nov 2024 20:29:22 +0900 Subject: [PATCH] env: Pass through locale & IM stuff Leaving the default C locale can break stuff that expect UTF-8, so pass through all the locale env vars and set a default C.UTF-8 locale if nothing is set. For input methods, it turns out that the old legacy XIM does work with our X11 passthrough solution (direct GTK/QT plugin methods will not, since they use side-channels to communicate with the IM server). So, force xim usage for GTK2/3 and QT4/5, which actually works with Steam (!) for CJK input if the system is configured properly. The future is Wayland protocols, which will work with GTK4 and QT6 once we have Wayland passthrough. Hopefully that means we never have to support input methods with the shared library mechanisms, which means our rootfs will never have to include IM-specific libraries and the input method user choice will happen entirely outside of muvm. Signed-off-by: Asahi Lina --- crates/muvm/src/env.rs | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/crates/muvm/src/env.rs b/crates/muvm/src/env.rs index 0fcbbe3..65d5251 100644 --- a/crates/muvm/src/env.rs +++ b/crates/muvm/src/env.rs @@ -10,12 +10,27 @@ use log::debug; /// Automatically pass these environment variables to the microVM, if they are /// set. -const WELL_KNOWN_ENV_VARS: [&str; 5] = [ +const WELL_KNOWN_ENV_VARS: [&str; 20] = [ + "LANG", + "LC_ADDRESS", + "LC_ALL", + "LC_COLLATE", + "LC_CTYPE", + "LC_IDENTIFICATION", + "LC_MEASUREMENT", + "LC_MESSAGES", + "LC_MONETARY", + "LC_NAME", + "LC_NUMERIC", + "LC_PAPER", + "LC_TELEPHONE", + "LC_TIME", "LD_LIBRARY_PATH", "LIBGL_DRIVERS_PATH", "MESA_LOADER_DRIVER_OVERRIDE", // needed for asahi "PATH", // needed by `muvm-guest` program "RUST_LOG", + "XMODIFIERS", ]; /// See https://github.com/AsahiLinux/docs/wiki/Devices @@ -56,6 +71,23 @@ pub fn prepare_env_vars(env: Vec<(String, Option)>) -> Result