@@ -2,17 +2,18 @@ use crate::renamer::ConfigFile;
22use crate :: renamer:: IconStatus :: * ;
33use crate :: { AppClient , Renamer } ;
44use hyprland:: data:: FullscreenMode ;
5+ use hyprland:: shared:: WorkspaceType ;
56use std:: collections:: HashMap ;
67use strfmt:: strfmt;
78
89#[ derive( Clone ) ]
910pub struct AppWorkspace {
10- pub id : i32 ,
11+ pub id : WorkspaceType ,
1112 pub clients : Vec < AppClient > ,
1213}
1314
1415impl AppWorkspace {
15- pub fn new ( id : i32 , clients : Vec < AppClient > ) -> Self {
16+ pub fn new ( id : WorkspaceType , clients : Vec < AppClient > ) -> Self {
1617 AppWorkspace { id, clients }
1718 }
1819}
@@ -22,7 +23,7 @@ impl Renamer {
2223 & self ,
2324 workspaces : Vec < AppWorkspace > ,
2425 config : & ConfigFile ,
25- ) -> HashMap < i32 , String > {
26+ ) -> HashMap < WorkspaceType , String > {
2627 let vars = HashMap :: from ( [ ( "delim" . to_string ( ) , config. format . delim . to_string ( ) ) ] ) ;
2728 workspaces
2829 . iter ( )
@@ -70,7 +71,7 @@ impl Renamer {
7071 let delimiter = formatter ( "{delim}" , & vars) ;
7172 let joined_string = workspace_output. join ( & delimiter) ;
7273
73- ( workspace. id , joined_string)
74+ ( workspace. id . clone ( ) , joined_string)
7475 } )
7576 . collect ( )
7677 }
@@ -231,9 +232,9 @@ mod tests {
231232 is_dedup_inactive_fullscreen : false ,
232233 } ;
233234
234- let workspace = AppWorkspace :: new ( 1 , vec ! [ client] ) ;
235+ let workspace = AppWorkspace :: new ( WorkspaceType :: try_from ( 1 ) . unwrap ( ) , vec ! [ client] ) ;
235236
236- assert_eq ! ( workspace. id, 1 ) ;
237+ assert_eq ! ( workspace. id, WorkspaceType :: Regular ( "1" . to_string ( ) ) ) ;
237238 assert_eq ! ( workspace. clients. len( ) , 1 ) ;
238239 assert_eq ! ( workspace. clients[ 0 ] . class, "Class" ) ;
239240 assert_eq ! ( workspace. clients[ 0 ] . title, "Title" ) ;
0 commit comments