mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	use env var SWAYSOCK if available
or fall back to /tmp/sway-ipc.sock
This commit is contained in:
		
							parent
							
								
									773e85c681
								
							
						
					
					
						commit
						bfbadadf70
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -40,10 +40,13 @@ void init_ipc() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct sockaddr_un ipc_sockaddr = {
 | 
						struct sockaddr_un ipc_sockaddr = {
 | 
				
			||||||
		.sun_family = AF_UNIX,
 | 
							.sun_family = AF_UNIX,
 | 
				
			||||||
		// TODO: use a proper socket path
 | 
							.sun_path = "/tmp/sway-ipc.sock"
 | 
				
			||||||
		.sun_path = "/tmp/sway.sock"
 | 
					 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (getenv("SWAYSOCK") != NULL) {
 | 
				
			||||||
 | 
							strncpy(ipc_sockaddr.sun_path, getenv("SWAYSOCK"), sizeof(ipc_sockaddr.sun_path));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	unlink(ipc_sockaddr.sun_path);
 | 
						unlink(ipc_sockaddr.sun_path);
 | 
				
			||||||
	if (bind(ipc_socket, (struct sockaddr *)&ipc_sockaddr, sizeof(ipc_sockaddr)) == -1) {
 | 
						if (bind(ipc_socket, (struct sockaddr *)&ipc_sockaddr, sizeof(ipc_sockaddr)) == -1) {
 | 
				
			||||||
		sway_abort("Unable to bind IPC socket");
 | 
							sway_abort("Unable to bind IPC socket");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue