mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Allow status_command to be disabled via IPC
This commit is contained in:
		
							parent
							
								
									26bebb9266
								
							
						
					
					
						commit
						5e1983660d
					
				
					 3 changed files with 23 additions and 10 deletions
				
			
		| 
						 | 
					@ -46,15 +46,15 @@ struct cmd_results *cmd_bar(int argc, char **argv) {
 | 
				
			||||||
		return error;
 | 
							return error;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!config->reading) {
 | 
						if (find_handler(argv[0], bar_config_handlers,
 | 
				
			||||||
		if (!find_handler(argv[0], bar_config_handlers,
 | 
					 | 
				
			||||||
				sizeof(bar_config_handlers))) {
 | 
									sizeof(bar_config_handlers))) {
 | 
				
			||||||
			return cmd_results_new(CMD_FAILURE, "bar",
 | 
							if (config->reading) {
 | 
				
			||||||
					"Can only be used in config file.");
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
			return config_subcommand(argv, argc, bar_config_handlers,
 | 
								return config_subcommand(argv, argc, bar_config_handlers,
 | 
				
			||||||
					sizeof(bar_config_handlers));
 | 
										sizeof(bar_config_handlers));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							return cmd_results_new(CMD_FAILURE, "bar",
 | 
				
			||||||
 | 
									"Can only be used in config file.");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (argc > 1) {
 | 
						if (argc > 1) {
 | 
				
			||||||
		struct bar_config *bar = NULL;
 | 
							struct bar_config *bar = NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,8 +13,18 @@ struct cmd_results *bar_cmd_status_command(int argc, char **argv) {
 | 
				
			||||||
				"status_command", "No bar defined.");
 | 
									"status_command", "No bar defined.");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	free(config->current_bar->status_command);
 | 
						free(config->current_bar->status_command);
 | 
				
			||||||
	config->current_bar->status_command = join_args(argv, argc);
 | 
						config->current_bar->status_command = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char *new_command = join_args(argv, argc);
 | 
				
			||||||
 | 
						if (strcmp(new_command, "-") != 0) {
 | 
				
			||||||
 | 
							config->current_bar->status_command = new_command;
 | 
				
			||||||
		wlr_log(WLR_DEBUG, "Feeding bar with status command: %s",
 | 
							wlr_log(WLR_DEBUG, "Feeding bar with status command: %s",
 | 
				
			||||||
				config->current_bar->status_command);
 | 
									config->current_bar->status_command);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (config->active && !config->validating) {
 | 
				
			||||||
 | 
							load_swaybars();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return cmd_results_new(CMD_SUCCESS, NULL, NULL);
 | 
						return cmd_results_new(CMD_SUCCESS, NULL, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,6 +17,9 @@ Sway allows configuring swaybar in the sway configuration file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	https://i3wm.org/docs/i3bar-protocol.html
 | 
						https://i3wm.org/docs/i3bar-protocol.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						If running this command via IPC, you can disable a running status command by
 | 
				
			||||||
 | 
						setting the command to a single dash: _swaybar bar bar-0 status\_command -_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*pango\_markup* enabled|disabled
 | 
					*pango\_markup* enabled|disabled
 | 
				
			||||||
	Enables or disables pango markup for status lines. This has no effect on
 | 
						Enables or disables pango markup for status lines. This has no effect on
 | 
				
			||||||
	status lines using the i3bar JSON protocol.
 | 
						status lines using the i3bar JSON protocol.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue