@@ -151,12 +151,12 @@ impl Renamer {
151151 active_client : String ,
152152 config : & ConfigFile ,
153153 ) -> Result < Vec < AppWorkspace > , Box < dyn Error + ' _ > > {
154- let mut workspaces = self
154+ let mut workspaces: HashMap < i32 , Vec < ( AppClient , ( i16 , i16 ) ) > > = self
155155 . known_workspaces
156156 . lock ( ) ?
157157 . iter ( )
158158 . map ( |& i| ( i, Vec :: new ( ) ) )
159- . collect :: < HashMap < i32 , Vec < AppClient > > > ( ) ;
159+ . collect ( ) ;
160160
161161 let is_dedup_inactive_fullscreen = config. format . dedup_inactive_fullscreen ;
162162
@@ -167,24 +167,33 @@ impl Renamer {
167167 workspaces
168168 . entry ( workspace_id)
169169 . or_insert_with ( Vec :: new)
170- . push ( AppClient :: new (
171- client. clone ( ) ,
172- is_active,
173- is_dedup_inactive_fullscreen,
174- self . parse_icon (
175- client. initial_class ,
176- client. class ,
177- client. initial_title ,
178- client. title ,
170+ . push ( (
171+ AppClient :: new (
172+ client. clone ( ) ,
179173 is_active,
180- config,
174+ is_dedup_inactive_fullscreen,
175+ self . parse_icon (
176+ client. initial_class ,
177+ client. class ,
178+ client. initial_title ,
179+ client. title ,
180+ is_active,
181+ config,
182+ ) ,
181183 ) ,
184+ client. at ,
182185 ) ) ;
183186 }
184187
185188 Ok ( workspaces
186- . iter ( )
187- . map ( |( & id, clients) | AppWorkspace :: new ( id, clients. to_vec ( ) ) )
189+ . into_iter ( )
190+ . map ( |( id, mut clients) | {
191+ clients. sort_by ( |a, b| a. 1 . 0 . cmp ( & b. 1 . 0 ) . then_with ( || a. 1 . 1 . cmp ( & b. 1 . 1 ) ) ) ;
192+
193+ let clients = clients. into_iter ( ) . map ( |( client, _) | client) . collect ( ) ;
194+
195+ AppWorkspace :: new ( id, clients)
196+ } )
188197 . collect ( ) )
189198 }
190199
@@ -1384,7 +1393,7 @@ mod tests {
13841393 } ,
13851394 ) ;
13861395
1387- let expected = [ ( 1 , "*term* term4 " . to_string ( ) ) ] . into_iter ( ) . collect ( ) ;
1396+ let expected = [ ( 1 , "term4 *term*" . to_string ( ) ) ] . into_iter ( ) . collect ( ) ;
13881397
13891398 let actual = renamer. generate_workspaces_string (
13901399 vec ! [ AppWorkspace {
@@ -1509,7 +1518,7 @@ mod tests {
15091518 } ,
15101519 ) ;
15111520
1512- let expected = [ ( 1 , "[term] term4 " . to_string ( ) ) ] . into_iter ( ) . collect ( ) ;
1521+ let expected = [ ( 1 , "term4 [term]" . to_string ( ) ) ] . into_iter ( ) . collect ( ) ;
15131522
15141523 let actual = renamer. generate_workspaces_string (
15151524 vec ! [ AppWorkspace {
@@ -1637,7 +1646,7 @@ mod tests {
16371646 } ,
16381647 ) ;
16391648
1640- let expected = [ ( 1 , "[*term*] term4 " . to_string ( ) ) ] . into_iter ( ) . collect ( ) ;
1649+ let expected = [ ( 1 , "term4 [*term*]" . to_string ( ) ) ] . into_iter ( ) . collect ( ) ;
16411650
16421651 let actual = renamer. generate_workspaces_string (
16431652 vec ! [ AppWorkspace {
0 commit comments