Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/launch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,39 @@ pub async fn install_master_steam(config: &LauncherConfig) -> Result<()> {
Ok(())
}

pub fn launch_wine_control_panel(config: &LauncherConfig) -> Result<()> {
let library_root = PathBuf::from(&config.steam_library_path);
let resolved_runner = crate::utils::resolve_runner(&config.proton_version, &library_root);
let mut cmd = build_runner_command(&resolved_runner)?;
let steam_cfg = crate::utils::get_master_steam_config();

std::fs::create_dir_all(&steam_cfg.wine_prefix)
.with_context(|| format!("failed creating Wine prefix {}", steam_cfg.wine_prefix.display()))?;

cmd.arg("control.exe");
cmd.env("WINEPREFIX", &steam_cfg.wine_prefix);
cmd.env("STEAM_COMPAT_DATA_PATH", &steam_cfg.root_dir);

if let Ok(display) = std::env::var("DISPLAY") {
cmd.env("DISPLAY", display);
}
if let Ok(wayland) = std::env::var("WAYLAND_DISPLAY") {
cmd.env("WAYLAND_DISPLAY", wayland);
}
if let Ok(xdg_runtime) = std::env::var("XDG_RUNTIME_DIR") {
cmd.env("XDG_RUNTIME_DIR", xdg_runtime);
}

tracing::info!(
runner = %resolved_runner.display(),
wineprefix = %steam_cfg.wine_prefix.display(),
"Launching Wine Control Panel"
);

cmd.spawn().context("Failed to spawn Wine Control Panel")?;
Ok(())
}

async fn download_steam_setup(path: &Path) -> Result<()> {
tracing::info!("Downloading SteamSetup.exe...");
let url = "https://cdn.akamai.steamstatic.com/client/installer/SteamSetup.exe";
Expand Down
23 changes: 23 additions & 0 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ pub enum AsyncOp {
AuthFailed(String),
UserProfileFetched(crate::models::UserProfile),
SettingsSaved(bool),
WineControlPanelLaunched,
ScanCompleted(u32, HashMap<u32, String>),
MetadataFetched(u32, crate::steam_client::AppMetadata),
UserConfigsFetched(crate::models::UserConfigStore),
Expand Down Expand Up @@ -590,6 +591,9 @@ impl SteamLauncher {
"Failed to save settings".to_string()
};
}
AsyncOp::WineControlPanelLaunched => {
self.status = "Wine Control Panel launched".to_string();
}
AsyncOp::ScanCompleted(appid, installed_paths) => {
for g in &mut self.library {
if g.app_id == appid {
Expand Down Expand Up @@ -2782,6 +2786,25 @@ impl eframe::App for SteamLauncher {
});
}

ui.add_space(8.0);
ui.separator();
ui.heading("Wine Tools");
if ui.button("Open Wine Control Panel").clicked() {
let config = self.launcher_config.clone();
let tx = self.operation_tx.clone();
self.runtime.spawn(async move {
match crate::launch::launch_wine_control_panel(&config) {
Ok(()) => {
let _ = tx.send(AsyncOp::WineControlPanelLaunched);
}
Err(e) => {
let _ = tx.send(AsyncOp::Error(format!("Wine Control Panel failed: {e}")));
}
}
});
}
ui.label("Launches Wine's control.exe using the default Proton version and SteamFlow's master Wine prefix.");

ui.add_space(8.0);
ui.separator();
ui.collapsing("Proton/Wine Manager", |ui| {
Expand Down