Add support for I3_SOCKET_PATH-atom
This commit is contained in:
parent
d993f8a3a1
commit
2fd7449e29
|
@ -29,7 +29,7 @@ typedef struct xcb_colors_t xcb_colors_t;
|
||||||
* Initialize xcb and use the specified fontname for text-rendering
|
* Initialize xcb and use the specified fontname for text-rendering
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void init_xcb();
|
char *init_xcb();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the colors
|
* Initialize the colors
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
ATOM_DO(_NET_WM_WINDOW_TYPE)
|
ATOM_DO(_NET_WM_WINDOW_TYPE)
|
||||||
ATOM_DO(_NET_WM_WINDOW_TYPE_DOCK)
|
ATOM_DO(_NET_WM_WINDOW_TYPE_DOCK)
|
||||||
ATOM_DO(_NET_WM_STRUT_PARTIAL)
|
ATOM_DO(_NET_WM_STRUT_PARTIAL)
|
||||||
|
ATOM_DO(I3_SOCKET_PATH)
|
||||||
#undef ATOM_DO
|
#undef ATOM_DO
|
||||||
|
|
|
@ -218,11 +218,6 @@ int main(int argc, char **argv) {
|
||||||
fontname = "-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-iso10646-1";
|
fontname = "-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-iso10646-1";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (socket_path == NULL) {
|
|
||||||
ELOG("No Socket Path Specified, default to %s\n", i3_default_sock_path);
|
|
||||||
socket_path = expand_path(i3_default_sock_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.dockpos != DOCKPOS_NONE) {
|
if (config.dockpos != DOCKPOS_NONE) {
|
||||||
if (config.hide_on_modifier) {
|
if (config.hide_on_modifier) {
|
||||||
ELOG("--dock and --hide are mutually exclusive!\n");
|
ELOG("--dock and --hide are mutually exclusive!\n");
|
||||||
|
@ -235,7 +230,16 @@ int main(int argc, char **argv) {
|
||||||
main_loop = ev_default_loop(0);
|
main_loop = ev_default_loop(0);
|
||||||
|
|
||||||
init_colors(&colors);
|
init_colors(&colors);
|
||||||
init_xcb(fontname);
|
char *atom_sock_path = init_xcb(fontname);
|
||||||
|
|
||||||
|
if (socket_path == NULL) {
|
||||||
|
socket_path = atom_sock_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (socket_path == NULL) {
|
||||||
|
ELOG("No Socket Path Specified, default to %s\n", i3_default_sock_path);
|
||||||
|
socket_path = expand_path(i3_default_sock_path);
|
||||||
|
}
|
||||||
|
|
||||||
free_colors(&colors);
|
free_colors(&colors);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <i3/ipc.h>
|
#include <i3/ipc.h>
|
||||||
#include <ev.h>
|
#include <ev.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
|
@ -445,7 +446,7 @@ void xkb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
||||||
* Initialize xcb and use the specified fontname for text-rendering
|
* Initialize xcb and use the specified fontname for text-rendering
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void init_xcb(char *fontname) {
|
char *init_xcb(char *fontname) {
|
||||||
/* FIXME: xcb_connect leaks Memory */
|
/* FIXME: xcb_connect leaks Memory */
|
||||||
xcb_connection = xcb_connect(NULL, NULL);
|
xcb_connection = xcb_connect(NULL, NULL);
|
||||||
if (xcb_connection_has_error(xcb_connection)) {
|
if (xcb_connection_has_error(xcb_connection)) {
|
||||||
|
@ -555,6 +556,26 @@ void init_xcb(char *fontname) {
|
||||||
/* Now we get the atoms and save them in a nice data-structure */
|
/* Now we get the atoms and save them in a nice data-structure */
|
||||||
get_atoms();
|
get_atoms();
|
||||||
|
|
||||||
|
xcb_get_property_cookie_t path_cookie;
|
||||||
|
path_cookie = xcb_get_property_unchecked(xcb_connection,
|
||||||
|
0,
|
||||||
|
xcb_root,
|
||||||
|
atoms[I3_SOCKET_PATH],
|
||||||
|
XCB_GET_PROPERTY_TYPE_ANY,
|
||||||
|
0, PATH_MAX);
|
||||||
|
|
||||||
|
/* We check, if i3 set it's socket-path */
|
||||||
|
xcb_get_property_reply_t *path_reply = xcb_get_property_reply(xcb_connection,
|
||||||
|
path_cookie,
|
||||||
|
NULL);
|
||||||
|
char *path = NULL;
|
||||||
|
if (path_reply) {
|
||||||
|
int len = xcb_get_property_value_length(path_reply);
|
||||||
|
if (len != 0) {
|
||||||
|
path = strndup(xcb_get_property_value(path_reply), len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Now we save the font-infos */
|
/* Now we save the font-infos */
|
||||||
font_info = xcb_query_font_reply(xcb_connection,
|
font_info = xcb_query_font_reply(xcb_connection,
|
||||||
query_font_cookie,
|
query_font_cookie,
|
||||||
|
@ -577,6 +598,8 @@ void init_xcb(char *fontname) {
|
||||||
if (xcb_request_failed(sl_ctx_cookie, "Could not create context for statusline")) {
|
if (xcb_request_failed(sl_ctx_cookie, "Could not create context for statusline")) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue