@@ -2,18 +2,24 @@ use crate::renamer::ConfigFile;
22use crate :: renamer:: IconStatus :: * ;
33use crate :: { AppClient , Renamer } ;
44use hyprland:: data:: FullscreenMode ;
5+ use hyprland:: shared:: { WorkspaceId , WorkspaceType } ;
56use std:: collections:: HashMap ;
67use strfmt:: strfmt;
78
89#[ derive( Clone ) ]
910pub struct AppWorkspace {
10- pub id : i32 ,
11+ pub id : WorkspaceType ,
12+ pub hyprland_id : WorkspaceId ,
1113 pub clients : Vec < AppClient > ,
1214}
1315
1416impl AppWorkspace {
15- pub fn new ( id : i32 , clients : Vec < AppClient > ) -> Self {
16- AppWorkspace { id, clients }
17+ pub fn new ( id : WorkspaceType , hyprland_id : WorkspaceId , clients : Vec < AppClient > ) -> Self {
18+ AppWorkspace {
19+ id,
20+ hyprland_id,
21+ clients,
22+ }
1723 }
1824}
1925
@@ -22,7 +28,7 @@ impl Renamer {
2228 & self ,
2329 workspaces : Vec < AppWorkspace > ,
2430 config : & ConfigFile ,
25- ) -> HashMap < i32 , String > {
31+ ) -> HashMap < WorkspaceType , String > {
2632 let vars = HashMap :: from ( [ ( "delim" . to_string ( ) , config. format . delim . to_string ( ) ) ] ) ;
2733 workspaces
2834 . iter ( )
@@ -70,7 +76,7 @@ impl Renamer {
7076 let delimiter = formatter ( "{delim}" , & vars) ;
7177 let joined_string = workspace_output. join ( & delimiter) ;
7278
73- ( workspace. id , joined_string)
79+ ( workspace. id . clone ( ) , joined_string)
7480 } )
7581 . collect ( )
7682 }
@@ -231,9 +237,10 @@ mod tests {
231237 is_dedup_inactive_fullscreen : false ,
232238 } ;
233239
234- let workspace = AppWorkspace :: new ( 1 , vec ! [ client] ) ;
240+ let workspace = AppWorkspace :: new ( WorkspaceType :: try_from ( 1 ) . unwrap ( ) , 1 , vec ! [ client] ) ;
235241
236- assert_eq ! ( workspace. id, 1 ) ;
242+ assert_eq ! ( workspace. id, WorkspaceType :: try_from( 1 ) . unwrap( ) ) ;
243+ assert_eq ! ( workspace. hyprland_id, 1 ) ;
237244 assert_eq ! ( workspace. clients. len( ) , 1 ) ;
238245 assert_eq ! ( workspace. clients[ 0 ] . class, "Class" ) ;
239246 assert_eq ! ( workspace. clients[ 0 ] . title, "Title" ) ;
0 commit comments