mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	config: support <desktops number=>
This commit is contained in:
		
							parent
							
								
									629bc9c978
								
							
						
					
					
						commit
						18eb7a26c0
					
				
					 2 changed files with 9 additions and 9 deletions
				
			
		| 
						 | 
					@ -69,7 +69,7 @@ struct rcxml {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		int popuptime;
 | 
							int popuptime;
 | 
				
			||||||
		int count;
 | 
							int min_nr_workspaces;
 | 
				
			||||||
		struct wl_list workspaces;  /* struct workspace.link */
 | 
							struct wl_list workspaces;  /* struct workspace.link */
 | 
				
			||||||
	} workspace_config;
 | 
						} workspace_config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -616,7 +616,7 @@ entry(xmlNode *node, char *nodename, char *content)
 | 
				
			||||||
	} else if (!strcasecmp(nodename, "popupTime.desktops")) {
 | 
						} else if (!strcasecmp(nodename, "popupTime.desktops")) {
 | 
				
			||||||
		rc.workspace_config.popuptime = atoi(content);
 | 
							rc.workspace_config.popuptime = atoi(content);
 | 
				
			||||||
	} else if (!strcasecmp(nodename, "number.desktops")) {
 | 
						} else if (!strcasecmp(nodename, "number.desktops")) {
 | 
				
			||||||
		rc.workspace_config.count = MAX(1, atoi(content));
 | 
							rc.workspace_config.min_nr_workspaces = MAX(1, atoi(content));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -759,7 +759,7 @@ rcxml_init(void)
 | 
				
			||||||
	rc.window_switcher.outlines = true;
 | 
						rc.window_switcher.outlines = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rc.workspace_config.popuptime = INT_MIN;
 | 
						rc.workspace_config.popuptime = INT_MIN;
 | 
				
			||||||
	rc.workspace_config.count = 1;
 | 
						rc.workspace_config.min_nr_workspaces = 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct {
 | 
					static struct {
 | 
				
			||||||
| 
						 | 
					@ -1048,14 +1048,14 @@ post_processing(void)
 | 
				
			||||||
		assert(l && libinput_category_get_default() == l);
 | 
							assert(l && libinput_category_get_default() == l);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int workspaces_configured = wl_list_length(&rc.workspace_config.workspaces);
 | 
						int nr_workspaces = wl_list_length(&rc.workspace_config.workspaces);
 | 
				
			||||||
	if (workspaces_configured < rc.workspace_config.count) {
 | 
						if (nr_workspaces < rc.workspace_config.min_nr_workspaces) {
 | 
				
			||||||
		struct workspace *workspace;
 | 
							struct workspace *workspace;
 | 
				
			||||||
		char workspace_name[32]; // Maximum length of workspace name "Workspace X"
 | 
							for (int i = nr_workspaces; i < rc.workspace_config.min_nr_workspaces; i++) {
 | 
				
			||||||
		for (int i = workspaces_configured; i < rc.workspace_config.count; i++) {
 | 
					 | 
				
			||||||
			workspace = znew(*workspace);
 | 
								workspace = znew(*workspace);
 | 
				
			||||||
			snprintf(workspace_name, sizeof(workspace_name), "Workspace %d", i + 1);
 | 
								char *workspace_name = malloc(sizeof(char) * 32);
 | 
				
			||||||
			workspace->name = xstrdup(workspace_name);
 | 
								snprintf(workspace_name, 32, "Workspace %d", i + 1);
 | 
				
			||||||
 | 
								workspace->name = workspace_name;
 | 
				
			||||||
			wl_list_append(&rc.workspace_config.workspaces, &workspace->link);
 | 
								wl_list_append(&rc.workspace_config.workspaces, &workspace->link);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue