mirror of
				https://github.com/swaywm/sway.git
				synced 2025-10-29 05:40:18 -04:00 
			
		
		
		
	Remove clipboard command and get_clipboard message
				
					
				
			This commit is contained in:
		
							parent
							
								
									8afe68f920
								
							
						
					
					
						commit
						ba3511b243
					
				
					 6 changed files with 5 additions and 55 deletions
				
			
		|  | @ -22,7 +22,6 @@ types=( | |||
| 'get_marks' | ||||
| 'get_bar_config' | ||||
| 'get_version' | ||||
| 'get_clipboard' | ||||
| ) | ||||
| 
 | ||||
| _arguments -s \ | ||||
|  |  | |||
|  | @ -18,8 +18,7 @@ enum ipc_command_type { | |||
| 
 | ||||
| 	// sway-specific command types
 | ||||
| 	IPC_GET_INPUTS = 100, | ||||
| 	IPC_GET_CLIPBOARD = 101, | ||||
| 	IPC_GET_SEATS = 102, | ||||
| 	IPC_GET_SEATS = 101, | ||||
| 
 | ||||
| 	// Events sent from sway to clients. Events have the highest bits set.
 | ||||
| 	IPC_EVENT_WORKSPACE = ((1<<31) | 0), | ||||
|  |  | |||
|  | @ -95,7 +95,6 @@ sway_cmd cmd_client_unfocused; | |||
| sway_cmd cmd_client_urgent; | ||||
| sway_cmd cmd_client_placeholder; | ||||
| sway_cmd cmd_client_background; | ||||
| sway_cmd cmd_clipboard; | ||||
| sway_cmd cmd_commands; | ||||
| sway_cmd cmd_debuglog; | ||||
| sway_cmd cmd_default_border; | ||||
|  |  | |||
|  | @ -271,11 +271,10 @@ enum ipc_feature { | |||
| 	IPC_FEATURE_EVENT_WINDOW = 2048, | ||||
| 	IPC_FEATURE_EVENT_BINDING = 4096, | ||||
| 	IPC_FEATURE_EVENT_INPUT = 8192, | ||||
| 	IPC_FEATURE_GET_CLIPBOARD = 16384, | ||||
| 	IPC_FEATURE_GET_SEATS = 32768, | ||||
| 	IPC_FEATURE_GET_SEATS = 16384, | ||||
| 
 | ||||
| 	IPC_FEATURE_ALL_COMMANDS = | ||||
| 		1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 16384 | 32768, | ||||
| 		1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 16384, | ||||
| 	IPC_FEATURE_ALL_EVENTS = 256 | 512 | 1024 | 2048 | 4096 | 8192, | ||||
| 
 | ||||
| 	IPC_FEATURE_ALL = IPC_FEATURE_ALL_COMMANDS | IPC_FEATURE_ALL_EVENTS, | ||||
|  |  | |||
|  | @ -246,44 +246,11 @@ static void pretty_print_config(json_object *c) { | |||
| 	printf("%s\n", json_object_get_string(config)); | ||||
| } | ||||
| 
 | ||||
| static void pretty_print_clipboard(json_object *v) { | ||||
| 	if (success(v, true)) { | ||||
| 		if (json_object_is_type(v, json_type_array)) { | ||||
| 			for (size_t i = 0; i < json_object_array_length(v); ++i) { | ||||
| 				json_object *o = json_object_array_get_idx(v, i); | ||||
| 				printf("%s\n", json_object_get_string(o)); | ||||
| 			} | ||||
| 		} else { | ||||
| 			// NOTE: could be extended to print all received types
 | ||||
| 			// instead just the first one when sways ipc server
 | ||||
| 			// supports it
 | ||||
| 			struct json_object_iterator iter = json_object_iter_begin(v); | ||||
| 			struct json_object_iterator end = json_object_iter_end(v); | ||||
| 			if (!json_object_iter_equal(&iter, &end)) { | ||||
| 				json_object *obj = json_object_iter_peek_value(&iter); | ||||
| 				if (success(obj, false)) { | ||||
| 					json_object *content; | ||||
| 					json_object_object_get_ex(obj, "content", &content); | ||||
| 					printf("%s\n", json_object_get_string(content)); | ||||
| 				} else { | ||||
| 					json_object *error; | ||||
| 					json_object_object_get_ex(obj, "error", &error); | ||||
| 					printf("Error: %s\n", json_object_get_string(error)); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} else { | ||||
| 		json_object *error; | ||||
| 		json_object_object_get_ex(v, "error", &error); | ||||
| 		printf("Error: %s\n", json_object_get_string(error)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static void pretty_print(int type, json_object *resp) { | ||||
| 	if (type != IPC_COMMAND && type != IPC_GET_WORKSPACES && | ||||
| 			type != IPC_GET_INPUTS && type != IPC_GET_OUTPUTS && | ||||
| 			type != IPC_GET_VERSION && type != IPC_GET_CLIPBOARD && | ||||
| 			type != IPC_GET_SEATS && type != IPC_GET_CONFIG) { | ||||
| 			type != IPC_GET_VERSION && type != IPC_GET_SEATS && | ||||
| 			type != IPC_GET_CONFIG) { | ||||
| 		printf("%s\n", json_object_to_json_string_ext(resp, | ||||
| 			JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED)); | ||||
| 		return; | ||||
|  | @ -299,11 +266,6 @@ static void pretty_print(int type, json_object *resp) { | |||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	if (type == IPC_GET_CLIPBOARD) { | ||||
| 		pretty_print_clipboard(resp); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	json_object *obj; | ||||
| 	size_t len = json_object_array_length(resp); | ||||
| 	for (size_t i = 0; i < len; ++i) { | ||||
|  | @ -422,8 +384,6 @@ int main(int argc, char **argv) { | |||
| 		type = IPC_GET_BINDING_MODES; | ||||
| 	} else if (strcasecmp(cmdtype, "get_config") == 0) { | ||||
| 		type = IPC_GET_CONFIG; | ||||
| 	} else if (strcasecmp(cmdtype, "get_clipboard") == 0) { | ||||
| 		type = IPC_GET_CLIPBOARD; | ||||
| 	} else { | ||||
| 		sway_abort("Unknown message type %s", cmdtype); | ||||
| 	} | ||||
|  |  | |||
|  | @ -64,9 +64,3 @@ _swaymsg_ [options...] [message] | |||
| 
 | ||||
| *get\_config* | ||||
| 	Gets a JSON-encoded copy of the current configuration. | ||||
| 
 | ||||
| *get\_clipboard* | ||||
| 	Get JSON-encoded information about the clipboard. | ||||
| 	Returns the current clipboard mime-types if called without | ||||
| 	arguments, otherwise returns the clipboard data in the requested | ||||
| 	formats. Encodes the data using base64 for non-text mime types. | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 emersion
						emersion