make i3bar use libi3’s root_atom_contents()
This removes code duplication, which will be useful for a subsequent commit. Furthermore, we now don’t open X11 connections unnecessarily in some corner cases.
This commit is contained in:
@ -352,7 +352,7 @@ int main(int argc, char *argv[]) {
|
||||
break;
|
||||
} else if (strcmp(long_options[option_index].name, "get-socketpath") == 0 ||
|
||||
strcmp(long_options[option_index].name, "get_socketpath") == 0) {
|
||||
char *socket_path = root_atom_contents("I3_SOCKET_PATH");
|
||||
char *socket_path = root_atom_contents("I3_SOCKET_PATH", NULL, 0);
|
||||
if (socket_path) {
|
||||
printf("%s\n", socket_path);
|
||||
exit(EXIT_SUCCESS);
|
||||
@ -442,7 +442,7 @@ int main(int argc, char *argv[]) {
|
||||
optind++;
|
||||
}
|
||||
DLOG("Command is: %s (%zd bytes)\n", payload, strlen(payload));
|
||||
char *socket_path = root_atom_contents("I3_SOCKET_PATH");
|
||||
char *socket_path = root_atom_contents("I3_SOCKET_PATH", NULL, 0);
|
||||
if (!socket_path) {
|
||||
ELOG("Could not get i3 IPC socket path\n");
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user