File tree Expand file tree Collapse file tree 10 files changed +262
-543
lines changed
cli.js/test/jest/__tests__ Expand file tree Collapse file tree 10 files changed +262
-543
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " api " : patch
3+ ---
4+
5+ Adds ` setSkipTaskbar ` to the window API.
Original file line number Diff line number Diff line change 1+ ---
2+ " tauri " : patch
3+ " tauri-runtime " : patch
4+ " tauri-runtime-wry " : patch
5+ ---
6+
7+ Adds ` set_skip_taskbar ` API on Window.
Original file line number Diff line number Diff line change @@ -439,6 +439,7 @@ enum WindowMessage {
439439 SetFullscreen ( bool ) ,
440440 SetFocus ,
441441 SetIcon ( WindowIcon ) ,
442+ SetSkipTaskbar ( bool ) ,
442443 DragWindow ,
443444}
444445
@@ -801,6 +802,17 @@ impl Dispatch for WryDispatcher {
801802 . map_err ( |_| Error :: FailedToSendMessage )
802803 }
803804
805+ fn set_skip_taskbar ( & self , skip : bool ) -> Result < ( ) > {
806+ self
807+ . context
808+ . proxy
809+ . send_event ( Message :: Window (
810+ self . window_id ,
811+ WindowMessage :: SetSkipTaskbar ( skip) ,
812+ ) )
813+ . map_err ( |_| Error :: FailedToSendMessage )
814+ }
815+
804816 fn start_dragging ( & self ) -> Result < ( ) > {
805817 self
806818 . context
@@ -1227,6 +1239,9 @@ fn handle_event_loop(
12271239 WindowMessage :: SetIcon ( icon) => {
12281240 window. set_window_icon ( Some ( icon) ) ;
12291241 }
1242+ WindowMessage :: SetSkipTaskbar ( skip) => {
1243+ window. set_skip_taskbar ( skip) ;
1244+ }
12301245 WindowMessage :: DragWindow => {
12311246 let _ = window. drag_window ( ) ;
12321247 }
Original file line number Diff line number Diff line change @@ -298,6 +298,9 @@ pub trait Dispatch: Clone + Send + Sized + 'static {
298298 /// Updates the window icon.
299299 fn set_icon ( & self , icon : Icon ) -> crate :: Result < ( ) > ;
300300
301+ /// Whether to show the window icon in the task bar or not.
302+ fn set_skip_taskbar ( & self , skip : bool ) -> crate :: Result < ( ) > ;
303+
301304 /// Starts dragging the window.
302305 fn start_dragging ( & self ) -> crate :: Result < ( ) > ;
303306
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ pub enum Cmd {
7474 SetIcon {
7575 icon : IconDto ,
7676 } ,
77+ SetSkipTaskbar ( bool ) ,
7778 StartDragging ,
7879 Print ,
7980}
@@ -158,6 +159,7 @@ impl Cmd {
158159 Self :: SetFullscreen ( fullscreen) => window. set_fullscreen ( fullscreen) ?,
159160 Self :: SetFocus => window. set_focus ( ) ?,
160161 Self :: SetIcon { icon } => window. set_icon ( icon. into ( ) ) ?,
162+ Self :: SetSkipTaskbar ( skip) => window. set_skip_taskbar ( skip) ?,
161163 Self :: StartDragging => window. start_dragging ( ) ?,
162164 Self :: Print => window. print ( ) ?,
163165 }
Original file line number Diff line number Diff line change @@ -543,6 +543,15 @@ impl<P: Params> Window<P> {
543543 self . window . dispatcher . set_icon ( icon) . map_err ( Into :: into)
544544 }
545545
546+ /// Whether to show the window icon in the task bar or not.
547+ pub fn set_skip_taskbar ( & self , skip : bool ) -> crate :: Result < ( ) > {
548+ self
549+ . window
550+ . dispatcher
551+ . set_skip_taskbar ( skip)
552+ . map_err ( Into :: into)
553+ }
554+
546555 /// Starts dragging the window.
547556 pub fn start_dragging ( & self ) -> crate :: Result < ( ) > {
548557 self . window . dispatcher . start_dragging ( ) . map_err ( Into :: into)
Original file line number Diff line number Diff line change @@ -745,6 +745,22 @@ class WindowManager {
745745 } )
746746 }
747747
748+ /**
749+ * Whether to show the window icon in the task bar or not.
750+ *
751+ * @param skip true to hide window icon, false to show it.
752+ * @returns A promise indicating the success or failure of the operation.
753+ */
754+ async setSkipTaskbar ( skip : boolean ) : Promise < void > {
755+ return invokeTauriCommand ( {
756+ __tauriModule : 'Window' ,
757+ message : {
758+ cmd : 'setSkipTaskbar' ,
759+ data : skip
760+ }
761+ } )
762+ }
763+
748764 /**
749765 * Starts dragging the window.
750766 *
You can’t perform that action at this time.
0 commit comments