Skip to content

Commit 169c4db

Browse files
committed
wip
1 parent 47852e5 commit 169c4db

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

plugins/src/desktop_entries/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use tokio::io::AsyncWrite;
1616
struct Item {
1717
appid: String,
1818
description: String,
19+
actions: Vec<Action>,
1920
exec: String,
2021
icon: Option<String>,
2122
keywords: Option<Vec<String>>,
@@ -150,6 +151,23 @@ impl<W: AsyncWrite + Unpin> App<W> {
150151
continue;
151152
}
152153

154+
let mut actions = vec![];
155+
156+
if let Some(entries) = entry.actions() {
157+
for action in entries.split(';') {
158+
let action = entry.action_name(action, locale)
159+
.and_then(|name| entry.action_exec(action).map(|exe | Action {
160+
name: action.to_string(),
161+
description: name.to_string(),
162+
exec: exec.to_string()
163+
}));
164+
165+
if let Some(action) = action {
166+
actions.push(action);
167+
}
168+
}
169+
}
170+
153171
let item = Item {
154172
appid: entry.appid.to_owned(),
155173
name: name.to_string(),
@@ -166,6 +184,7 @@ impl<W: AsyncWrite + Unpin> App<W> {
166184
path: path.clone(),
167185
prefers_non_default_gpu: entry.prefers_non_default_gpu(),
168186
src,
187+
actions
169188
};
170189

171190
deduplicator.insert(item);

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ pub enum PluginResponse {
9191
Finished,
9292
}
9393

94+
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq)]
95+
pub struct Action {
96+
pub name: String,
97+
pub description: String,
98+
pub exec: String,
99+
}
100+
94101
/// Search information from a plugin to be sorted and filtered by the launcher service.
95102
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
96103
pub struct PluginSearchResult {
@@ -108,6 +115,7 @@ pub struct PluginSearchResult {
108115
pub exec: Option<String>,
109116
/// Designates that this search item refers to a window.
110117
pub window: Option<(Generation, Indice)>,
118+
pub actions: Vec<Action>
111119
}
112120

113121
// Sent to the input pipe of the launcher service, and disseminated to its plugins.

0 commit comments

Comments
 (0)