Skip to content

Commit 2874632

Browse files
Get it working plus a rename
1 parent 167a48b commit 2874632

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

crates/tauri/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ const PLUGINS: &[(&str, &[(&str, bool)])] = &[
219219
("set_visible", true),
220220
("set_temp_dir_path", true),
221221
("set_icon_as_template", true),
222+
("set_icon_with_as_template", true),
222223
("set_show_menu_on_left_click", true),
223224
],
224225
),

crates/tauri/permissions/tray/autogenerated/reference.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Default permissions for the plugin, which enables all commands.
1414
- `allow-set-visible`
1515
- `allow-set-temp-dir-path`
1616
- `allow-set-icon-as-template`
17+
- `allow-set-icon-with-as-template`
1718
- `allow-set-show-menu-on-left-click`
1819

1920
## Permission Table
@@ -158,6 +159,32 @@ Denies the set_icon_as_template command without any pre-configured scope.
158159
<tr>
159160
<td>
160161

162+
`core:tray:allow-set-icon-with-as-template`
163+
164+
</td>
165+
<td>
166+
167+
Enables the set_icon_with_as_template command without any pre-configured scope.
168+
169+
</td>
170+
</tr>
171+
172+
<tr>
173+
<td>
174+
175+
`core:tray:deny-set-icon-with-as-template`
176+
177+
</td>
178+
<td>
179+
180+
Denies the set_icon_with_as_template command without any pre-configured scope.
181+
182+
</td>
183+
</tr>
184+
185+
<tr>
186+
<td>
187+
161188
`core:tray:allow-set-menu`
162189

163190
</td>

crates/tauri/scripts/bundle.global.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tauri/src/tray/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ impl<R: Runtime> TrayIcon<R> {
584584
/// ## Platform-specific:
585585
///
586586
/// - **Linux / Windows:** Falls back to calling `set_icon`.
587-
pub fn set_icon_with_template(
587+
pub fn set_icon_with_as_template(
588588
&self,
589589
icon: Option<Image<'_>>,
590590
#[allow(unused)] is_template: bool,

crates/tauri/src/tray/plugin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn set_icon_as_template<R: Runtime>(
204204
}
205205

206206
#[command(root = "crate")]
207-
fn set_icon_with_template<R: Runtime>(
207+
fn set_icon_with_as_template<R: Runtime>(
208208
app: AppHandle<R>,
209209
webview: Webview<R>,
210210
rid: ResourceId,
@@ -218,7 +218,7 @@ fn set_icon_with_template<R: Runtime>(
218218
Some(i) => Some(i.into_img(&webview_resources_table)?.as_ref().clone()),
219219
None => None,
220220
};
221-
tray.set_icon_with_template(icon, as_template)
221+
tray.set_icon_with_as_template(icon, as_template)
222222
}
223223

224224
#[command(root = "crate")]
@@ -246,7 +246,7 @@ pub(crate) fn init<R: Runtime>() -> TauriPlugin<R> {
246246
set_visible,
247247
set_temp_dir_path,
248248
set_icon_as_template,
249-
set_icon_with_template,
249+
set_icon_with_as_template,
250250
set_show_menu_on_left_click,
251251
])
252252
.build()

packages/api/src/tray.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,15 @@ export class TrayIcon extends Resource {
306306
* tauri = { version = "...", features = ["...", "image-png"] }
307307
* ```
308308
*/
309-
async setIconWithTemplate(
309+
async setIconWithAsTemplate(
310310
icon: string | Image | Uint8Array | ArrayBuffer | number[] | null,
311311
asTemplate: boolean
312312
): Promise<void> {
313313
let trayIcon = null
314314
if (icon) {
315315
trayIcon = transformImage(icon)
316316
}
317-
return invoke('plugin:tray|set_icon_with_template', { rid: this.rid, icon: trayIcon, asTemplate })
317+
return invoke('plugin:tray|set_icon_with_as_template', { rid: this.rid, icon: trayIcon, asTemplate })
318318
}
319319

320320
/**

0 commit comments

Comments
 (0)