sxhkd-rc

[fork] simple X hotkey daemon (but for the rc shell)
Log | Files | Refs | README | LICENSE

commit 3f3ae5106aed01ef0264053ce970ef34146ec9b4
parent 880d8740f99c7efd0d2fca09752d181c5e5d1972
Author: Miroslav Koškár <mk@mkoskar.com>
Date:   Wed, 16 Oct 2019 00:14:43 +0200

Use preferred X screen

Diffstat:
Msrc/sxhkd.c | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/sxhkd.c b/src/sxhkd.c @@ -253,10 +253,18 @@ void mapping_notify(xcb_generic_event_t *evt) void setup(void) { - dpy = xcb_connect(NULL, NULL); + int screen_idx; + dpy = xcb_connect(NULL, &screen_idx); if (xcb_connection_has_error(dpy)) err("Can't open display.\n"); - xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(dpy)).data; + xcb_screen_t *screen = NULL; + xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(xcb_get_setup(dpy)); + for (; screen_iter.rem; xcb_screen_next(&screen_iter), screen_idx--) { + if (screen_idx == 0) { + screen = screen_iter.data; + break; + } + } if (screen == NULL) err("Can't acquire screen.\n"); root = screen->root;