Skip to content

Commit

Permalink
WSLGd: load user weston.ini
Browse files Browse the repository at this point in the history
Allow user to customize weston settings (e.g to load xkb keymaps that
don't have a Windows counterpart).
Load ".weston.ini" from User Profile dir if it exists.
  • Loading branch information
fargiolas committed Apr 16, 2023
1 parent 4ad2bbf commit 716a1b1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions WSLGd/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define WESTON_NOTIFY_SOCKET SHARE_PATH "/weston-notify.sock"
#define DEFAULT_ICON_PATH "/usr/share/icons"
#define USER_DISTRO_ICON_PATH USER_DISTRO_MOUNT_PATH DEFAULT_ICON_PATH
#define USER_WESTON_CONFIG_FILE ".weston.ini"

constexpr auto c_serviceIdTemplate = "%08X-FACB-11E6-BD58-64006A7986D3";
constexpr auto c_userName = "wslg";
Expand Down Expand Up @@ -444,6 +445,21 @@ try {
westonArgs += " ";
westonArgs += westonLoggerOption;

// Check whether a user weston.ini exists and add it to weston options
std::string westonConfigOption("--config=");
std::string westonConfigFilePath;
auto userProfile = getenv(c_userProfileEnv);
if (userProfile) {
westonConfigFilePath = TranslateWindowsPath(userProfile);
westonConfigFilePath += "/" USER_WESTON_CONFIG_FILE;
}

if (std::filesystem::is_regular_file(westonConfigFilePath)) {
westonConfigOption += westonConfigFilePath;
westonArgs += " ";
westonArgs += westonConfigOption;
}

// Launch weston.
// N.B. Additional capabilities are needed to setns to the mount namespace of the user distro.
monitor.LaunchProcess(std::vector<std::string>{
Expand Down

0 comments on commit 716a1b1

Please sign in to comment.