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:
@ -791,17 +791,17 @@ int main(int argc, char *argv[]) {
|
||||
close(fd);
|
||||
unlink(config_path);
|
||||
|
||||
int screen;
|
||||
if ((conn = xcb_connect(NULL, &screen)) == NULL ||
|
||||
xcb_connection_has_error(conn))
|
||||
errx(1, "Cannot open display\n");
|
||||
|
||||
if (socket_path == NULL)
|
||||
socket_path = root_atom_contents("I3_SOCKET_PATH");
|
||||
socket_path = root_atom_contents("I3_SOCKET_PATH", conn, screen);
|
||||
|
||||
if (socket_path == NULL)
|
||||
socket_path = "/tmp/i3-ipc.sock";
|
||||
|
||||
int screens;
|
||||
if ((conn = xcb_connect(NULL, &screens)) == NULL ||
|
||||
xcb_connection_has_error(conn))
|
||||
errx(1, "Cannot open display\n");
|
||||
|
||||
keysyms = xcb_key_symbols_alloc(conn);
|
||||
xcb_get_modifier_mapping_cookie_t modmap_cookie;
|
||||
modmap_cookie = xcb_get_modifier_mapping(conn);
|
||||
@ -813,7 +813,7 @@ int main(int argc, char *argv[]) {
|
||||
#include "atoms.xmacro"
|
||||
#undef xmacro
|
||||
|
||||
root_screen = xcb_aux_get_screen(conn, screens);
|
||||
root_screen = xcb_aux_get_screen(conn, screen);
|
||||
root = root_screen->root;
|
||||
|
||||
if (!(modmap_reply = xcb_get_modifier_mapping_reply(conn, modmap_cookie, NULL)))
|
||||
|
Reference in New Issue
Block a user