7474 VrrMode as ConfigVrrMode ,
7575 } ,
7676 window:: { TileState as ConfigTileState , Window , WindowMatcher } ,
77- workspace:: WorkspaceDisplayOrder ,
77+ workspace:: { WorkspaceDisplayOrder , WorkspaceEmptyBehavior } ,
7878 xwayland:: XScalingMode ,
7979 } ,
8080 kbvm:: Keycode ,
@@ -572,6 +572,9 @@ impl ConfigProxyHandler {
572572 fn handle_get_workspaces ( & self ) {
573573 let mut workspaces = vec ! [ ] ;
574574 for ws in self . state . workspaces . lock ( ) . values ( ) {
575+ if ws. hidden . get ( ) {
576+ continue ;
577+ }
575578 workspaces. push ( self . get_workspace_by_name ( & ws. name ) ) ;
576579 }
577580 self . respond ( Response :: GetWorkspaces { workspaces } ) ;
@@ -1143,7 +1146,11 @@ impl ConfigProxyHandler {
11431146 seat,
11441147 }
11451148 } ;
1146- if move_ {
1149+ let hidden = ws. hidden . get ( ) ;
1150+ if move_ && hidden {
1151+ self . state . show_workspace2 ( seat. as_ref ( ) , & output, & ws) ;
1152+ }
1153+ if move_ && !hidden {
11471154 move_ws_to_output (
11481155 & ws,
11491156 & output,
@@ -1155,9 +1162,11 @@ impl ConfigProxyHandler {
11551162 } ,
11561163 ) ;
11571164 if let Some ( seat) = & seat {
1158- ws. node_do_focus ( seat, crate :: tree:: Direction :: Unspecified ) ;
1165+ ws. clone ( )
1166+ . node_do_focus ( seat, crate :: tree:: Direction :: Unspecified ) ;
11591167 }
1160- } else {
1168+ }
1169+ if !move_ {
11611170 self . state . show_workspace2 ( seat. as_ref ( ) , & output, & ws) ;
11621171 }
11631172 if let Some ( seat) = & seat {
@@ -1173,6 +1182,14 @@ impl ConfigProxyHandler {
11731182 Some ( ws) => ws,
11741183 _ => seat. get_fallback_output ( ) . create_workspace ( name. deref ( ) ) ,
11751184 } ;
1185+ if workspace. hidden . get ( )
1186+ && self
1187+ . state
1188+ . restore_hidden_workspace ( & workspace, Some ( seat. get_fallback_output ( ) ) , Some ( & seat) )
1189+ . is_none ( )
1190+ {
1191+ return Ok ( ( ) ) ;
1192+ }
11761193 seat. set_workspace ( & workspace) ;
11771194 Ok ( ( ) )
11781195 }
@@ -1187,6 +1204,14 @@ impl ConfigProxyHandler {
11871204 _ => return Ok ( ( ) ) ,
11881205 } ,
11891206 } ;
1207+ if workspace. hidden . get ( )
1208+ && self
1209+ . state
1210+ . restore_hidden_workspace ( & workspace, window. node_output ( ) , None )
1211+ . is_none ( )
1212+ {
1213+ return Ok ( ( ) ) ;
1214+ }
11901215 toplevel_set_workspace ( & self . state , window, & workspace) ;
11911216 Ok ( ( ) )
11921217 }
@@ -1559,6 +1584,10 @@ impl ConfigProxyHandler {
15591584 self . state . set_workspace_display_order ( order. into ( ) ) ;
15601585 }
15611586
1587+ fn handle_set_workspace_empty_behavior ( & self , behavior : WorkspaceEmptyBehavior ) {
1588+ self . state . set_workspace_empty_behavior ( behavior. into ( ) ) ;
1589+ }
1590+
15621591 fn handle_get_seat_float_pinned ( & self , seat : Seat ) -> Result < ( ) , CphError > {
15631592 let seat = self . get_seat ( seat) ?;
15641593 self . respond ( Response :: GetFloatPinned {
@@ -1750,6 +1779,7 @@ impl ConfigProxyHandler {
17501779 fn handle_get_workspace_connector ( & self , workspace : Workspace ) -> Result < ( ) , CphError > {
17511780 let connector = self
17521781 . get_existing_workspace ( workspace) ?
1782+ . filter ( |ws| !ws. hidden . get ( ) )
17531783 . map ( |ws| ws. output . get ( ) )
17541784 . filter ( |o| !o. is_dummy )
17551785 . map ( |o| Connector ( o. global . connector . id . raw ( ) as _ ) )
@@ -3574,6 +3604,9 @@ impl ConfigProxyHandler {
35743604 ClientMessage :: ShowWorkspace3 { v1 } => {
35753605 self . handle_show_workspace_3 ( v1) . wrn ( "show_workspace_3" ) ?
35763606 }
3607+ ClientMessage :: SetWorkspaceEmptyBehavior { behavior } => {
3608+ self . handle_set_workspace_empty_behavior ( behavior)
3609+ }
35773610 }
35783611 Ok ( ( ) )
35793612 }
0 commit comments