mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Add omnipresent flag for views
This commit is contained in:
		
							parent
							
								
									6b8c79748a
								
							
						
					
					
						commit
						bad8f334ea
					
				
					 6 changed files with 32 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -78,6 +78,7 @@ enum action_type {
 | 
			
		|||
	ACTION_TYPE_TOGGLE_DECORATIONS,
 | 
			
		||||
	ACTION_TYPE_TOGGLE_ALWAYS_ON_TOP,
 | 
			
		||||
	ACTION_TYPE_TOGGLE_ALWAYS_ON_BOTTOM,
 | 
			
		||||
	ACTION_TYPE_TOGGLE_OMNIPRESENT,
 | 
			
		||||
	ACTION_TYPE_FOCUS,
 | 
			
		||||
	ACTION_TYPE_UNFOCUS,
 | 
			
		||||
	ACTION_TYPE_ICONIFY,
 | 
			
		||||
| 
						 | 
				
			
			@ -120,6 +121,7 @@ const char *action_names[] = {
 | 
			
		|||
	"ToggleDecorations",
 | 
			
		||||
	"ToggleAlwaysOnTop",
 | 
			
		||||
	"ToggleAlwaysOnBottom",
 | 
			
		||||
	"ToggleOmnipresent",
 | 
			
		||||
	"Focus",
 | 
			
		||||
	"Unfocus",
 | 
			
		||||
	"Iconify",
 | 
			
		||||
| 
						 | 
				
			
			@ -744,6 +746,11 @@ actions_run(struct view *activator, struct server *server,
 | 
			
		|||
				view_toggle_always_on_bottom(view);
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		case ACTION_TYPE_TOGGLE_OMNIPRESENT:
 | 
			
		||||
			if (view) {
 | 
			
		||||
				view_toggle_visible_on_all_workspaces(view);
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		case ACTION_TYPE_FOCUS:
 | 
			
		||||
			if (view) {
 | 
			
		||||
				desktop_focus_view(view, /*raise*/ false);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -723,6 +723,8 @@ init_windowmenu(struct server *server)
 | 
			
		|||
		fill_item("name.action", "ToggleDecorations");
 | 
			
		||||
		current_item = item_create(menu, _("AlwaysOnTop"), false);
 | 
			
		||||
		fill_item("name.action", "ToggleAlwaysOnTop");
 | 
			
		||||
		current_item = item_create(menu, _("ToggleOmnipresent"), false);
 | 
			
		||||
		fill_item("name.action", "ToggleOmnipresent");
 | 
			
		||||
 | 
			
		||||
		/* Workspace sub-menu */
 | 
			
		||||
		struct menu *workspace_menu = menu_create(server, "workspaces", "");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1045,6 +1045,13 @@ view_toggle_always_on_bottom(struct view *view)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
view_toggle_visible_on_all_workspaces(struct view *view)
 | 
			
		||||
{
 | 
			
		||||
	assert(view);
 | 
			
		||||
	view->visible_on_all_workspaces = !view->visible_on_all_workspaces;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
view_move_to_workspace(struct view *view, struct workspace *workspace)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -276,6 +276,16 @@ workspaces_switch_to(struct workspace *target, bool update_focus)
 | 
			
		|||
	wlr_scene_node_set_enabled(
 | 
			
		||||
		&server->workspace_current->tree->node, false);
 | 
			
		||||
 | 
			
		||||
	/* Move Omnipresent views to new workspace */
 | 
			
		||||
	struct view *view;
 | 
			
		||||
	enum lab_view_criteria criteria =
 | 
			
		||||
		LAB_VIEW_CRITERIA_CURRENT_WORKSPACE;
 | 
			
		||||
	for_each_view(view, &server->views, criteria) {
 | 
			
		||||
		if (view->visible_on_all_workspaces) {
 | 
			
		||||
			view_move_to_workspace(view, target);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Enable the new workspace */
 | 
			
		||||
	wlr_scene_node_set_enabled(&target->tree->node, true);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue