@@ -41,6 +41,8 @@ pub enum Error {
4141 Tauri ( #[ from] tauri:: Error ) ,
4242 #[ error( transparent) ]
4343 SerdeJson ( #[ from] serde_json:: Error ) ,
44+ #[ error( transparent) ]
45+ Glob ( #[ from] glob:: PatternError ) ,
4446}
4547
4648pub type Result < T > = std:: result:: Result < T , Error > ;
@@ -319,7 +321,7 @@ impl<R: Runtime> WindowExtInternal for Window<R> {
319321
320322#[ derive( Default ) ]
321323pub struct Builder {
322- denylist : HashSet < String > ,
324+ denylist : Vec < glob :: Pattern > ,
323325 skip_initial_state : HashSet < String > ,
324326 state_flags : StateFlags ,
325327 map_label : Option < Box < LabelMapperFn > > ,
@@ -344,10 +346,16 @@ impl Builder {
344346 }
345347
346348 /// Sets a list of windows that shouldn't be tracked and managed by this plugin
347- /// for example splash screen windows.
348- pub fn with_denylist ( mut self , denylist : & [ & str ] ) -> Self {
349- self . denylist = denylist. iter ( ) . map ( |l| l. to_string ( ) ) . collect ( ) ;
350- self
349+ /// For example, splash screen windows. It also supports glob patterns for flexible window matching.
350+ pub fn with_denylist ( mut self , denylist : & mut [ & str ] ) -> Result < Self > {
351+ denylist. sort ( ) ;
352+
353+ let mut denylist_patterns = Vec :: new ( ) ;
354+ for pattern in denylist {
355+ denylist_patterns. push ( glob:: Pattern :: new ( & pattern) ?) ;
356+ }
357+ self . denylist = denylist_patterns;
358+ Ok ( self )
351359 }
352360
353361 /// Adds the given window label to a list of windows to skip initial state restore.
@@ -413,8 +421,11 @@ impl Builder {
413421 . map ( |map| map ( window. label ( ) ) )
414422 . unwrap_or_else ( || window. label ( ) ) ;
415423
416- if self . denylist . contains ( label) {
417- return ;
424+
425+ for pattern in & self . denylist {
426+ if pattern. matches ( label) {
427+ return ;
428+ }
418429 }
419430
420431 if !self . skip_initial_state . contains ( label) {
0 commit comments