From c727580752faa5a303c6ed4f22dffbcd71742ebf Mon Sep 17 00:00:00 2001 From: Yipeng Sun Date: Thu, 26 Sep 2024 16:16:28 +0800 Subject: [PATCH] Workaround a WSL systemd issue. WSL systemd doesn't reliably provide a user session; that is, `systemctl --user status` may fail. This commit provides a workaround based on: https://github.com/microsoft/WSL/issues/10205#issuecomment-1620605535 --- config/wezterm/wezterm.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config/wezterm/wezterm.lua b/config/wezterm/wezterm.lua index d39ae05..807a975 100644 --- a/config/wezterm/wezterm.lua +++ b/config/wezterm/wezterm.lua @@ -28,7 +28,15 @@ config.wsl_domains = { { name = 'WSL:NixOS', distribution = 'NixOS', - default_prog = { '/run/current-system/sw/bin/fish' }, + default_prog = { + '/run/current-system/sw/bin/fish', + '-c', + -- to get a working user login session + 'while not test -S /run/dbus/system_bus_socket; sleep 1; end;' .. + 'if test -e /run/user/1000/bus; exec fish; end;' .. + 'sudo systemctl restart user@1000.service;' .. + 'exec fish;', + }, default_cwd = '~', }, }