diff --git a/statusbar.c b/statusbar.c index 8218ba0bd..407722acd 100644 --- a/statusbar.c +++ b/statusbar.c @@ -228,6 +228,21 @@ statusbar_draw(statusbar_t *statusbar) statusbar_systray_refresh(statusbar); } +/** Get a statusbar by its window. + * \param w The window id. + * \return A statusbar if found, NULL otherwise. + */ +statusbar_t * +statusbar_getbywin(xcb_window_t w) +{ + statusbar_t *s; + for(int i = 0; i < globalconf.screens_info->nscreen; i++) + for(s = globalconf.screens[i].statusbar; s; s = s->next) + if(s->sw->window == w) + return s; + return NULL; +} + /** Statusbar refresh function. */ void diff --git a/statusbar.h b/statusbar.h index a8e3223b2..1565b760a 100644 --- a/statusbar.h +++ b/statusbar.h @@ -35,6 +35,7 @@ statusbar_delete(statusbar_t **statusbar) p_delete(statusbar); } +statusbar_t * statusbar_getbywin(xcb_window_t); void statusbar_refresh(void); void statusbar_position_update(statusbar_t *);