Skip to content

Commit 96d9042

Browse files
committed
Update for spawn_desktop_exec that calls SpawnTransientUnit
Allows `xdg-desktop-portal` to get app id from PID.
1 parent 03fa390 commit 96d9042

File tree

2 files changed

+51
-44
lines changed

2 files changed

+51
-44
lines changed

Cargo.lock

Lines changed: 45 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pub enum Message {
154154
LauncherEvent(launcher::Event),
155155
Layer(LayerEvent),
156156
KeyboardNav(keyboard_nav::Message),
157-
ActivationToken(Option<String>, String, GpuPreference),
157+
ActivationToken(Option<String>, String, String, GpuPreference),
158158
AltTab,
159159
AltRelease,
160160
}
@@ -206,7 +206,7 @@ impl CosmicLauncher {
206206
}
207207
}
208208

209-
async fn launch(token: Option<String>, exec: String, gpu: GpuPreference) {
209+
async fn launch(token: Option<String>, app_id: String, exec: String, gpu: GpuPreference) {
210210
let mut envs = Vec::new();
211211
if let Some(token) = token {
212212
envs.push(("XDG_ACTIVATION_TOKEN".to_string(), token.clone()));
@@ -217,7 +217,7 @@ async fn launch(token: Option<String>, exec: String, gpu: GpuPreference) {
217217
envs.extend(gpu_envs);
218218
}
219219

220-
cosmic::desktop::spawn_desktop_exec(exec, envs);
220+
cosmic::desktop::spawn_desktop_exec(exec, envs, Some(&app_id)).await;
221221
}
222222

223223
async fn try_get_gpu_envs(gpu: GpuPreference) -> Option<HashMap<String, String>> {
@@ -414,6 +414,7 @@ impl cosmic::Application for CosmicLauncher {
414414
move |token| {
415415
cosmic::app::Message::App(Message::ActivationToken(
416416
token,
417+
entry.id.to_string(),
417418
exec,
418419
gpu_preference,
419420
))
@@ -500,8 +501,8 @@ impl cosmic::Application for CosmicLauncher {
500501
_ => {}
501502
};
502503
}
503-
Message::ActivationToken(token, exec, dgpu) => {
504-
return Command::perform(launch(token, exec, dgpu), |()| {
504+
Message::ActivationToken(token, app_id, exec, dgpu) => {
505+
return Command::perform(launch(token, app_id, exec, dgpu), |()| {
505506
cosmic::app::message::app(Message::Hide)
506507
});
507508
}

0 commit comments

Comments
 (0)