29#define G_LOG_DOMAIN "Modes.Window"
43#include <xcb/xcb_atom.h>
44#include <xcb/xcb_ewmh.h>
45#include <xcb/xcb_icccm.h>
66#define CLIENTWINDOWTYPE 10
75 WIN_MATCH_FIELD_TITLE,
76 WIN_MATCH_FIELD_CLASS,
79 WIN_MATCH_FIELD_DESKTOP,
81} WinModeMatchingFields;
83static WinModeField matching_window_fields[WIN_MATCH_NUM_FIELDS] = {
85 .field_name =
"title",
89 .field_name =
"class",
101 .field_name =
"desktop",
105static gboolean window_matching_fields_parsed = FALSE;
110 xcb_get_window_attributes_reply_t xattr;
116 xcb_atom_t state[CLIENTSTATE];
118 xcb_atom_t window_type[CLIENTWINDOWTYPE];
124 unsigned int wmdesktopstr_len;
125 cairo_surface_t *
icon;
126 gboolean icon_checked;
127 uint32_t icon_fetch_uid;
128 uint32_t icon_fetch_size;
129 gboolean thumbnail_checked;
130 gboolean icon_theme_checked;
146 unsigned int wmdn_len;
147 unsigned int clf_len;
148 unsigned int name_len;
149 unsigned int title_len;
150 unsigned int role_len;
151 GRegex *window_regex;
153 gboolean hide_active_window;
154 gboolean prefer_icon_theme;
155} WindowModePrivateData;
157winlist *cache_client = NULL;
164static winlist *winlist_new(
void) {
165 winlist *l = g_malloc(
sizeof(winlist));
167 l->array = g_malloc_n(WINLIST + 1,
sizeof(xcb_window_t));
168 l->data = g_malloc_n(WINLIST + 1,
sizeof(client *));
181static int winlist_append(winlist *l, xcb_window_t w, client *d) {
182 if (l->len > 0 && !(l->len % WINLIST)) {
184 g_realloc(l->array,
sizeof(xcb_window_t) * (l->len + WINLIST + 1));
185 l->data = g_realloc(l->data,
sizeof(client *) * (l->len + WINLIST + 1));
189 if (l->data == NULL || l->array == NULL) {
194 l->array[l->len++] = w;
198static void client_free(client *c) {
203 cairo_surface_destroy(c->icon);
209 g_free(c->wmdesktopstr);
211static void winlist_empty(winlist *l) {
213 client *c = l->data[--l->len];
226static void winlist_free(winlist *l) {
243static int winlist_find(winlist *l, xcb_window_t w) {
251 for (i = (l->len - 1); i >= 0; i--) {
252 if (l->array[i] == w) {
262static void x11_cache_create(
void) {
263 if (cache_client == NULL) {
264 cache_client = winlist_new();
271static void x11_cache_free(
void) {
272 winlist_free(cache_client);
285static xcb_get_window_attributes_reply_t *
286window_get_attributes(xcb_window_t w) {
287 xcb_get_window_attributes_cookie_t c =
289 xcb_get_window_attributes_reply_t *r =
297static int client_has_state(client *c, xcb_atom_t state) {
298 for (
int i = 0; i < c->states; i++) {
299 if (c->state[i] == state) {
306static int client_has_window_type(client *c, xcb_atom_t type) {
307 for (
int i = 0; i < c->window_types; i++) {
308 if (c->window_type[i] == type) {
316static client *window_client(WindowModePrivateData *pd, xcb_window_t win) {
317 if (win == XCB_WINDOW_NONE) {
321 int idx = winlist_find(cache_client, win);
324 return cache_client->data[idx];
328 xcb_get_window_attributes_reply_t *attr = window_get_attributes(win);
333 client *c = g_malloc0(
sizeof(client));
337 memmove(&c->xattr, attr,
sizeof(xcb_get_window_attributes_reply_t));
339 xcb_get_property_cookie_t cky = xcb_ewmh_get_wm_state(&
xcb->
ewmh, win);
340 xcb_ewmh_get_atoms_reply_t states;
341 if (xcb_ewmh_get_wm_state_reply(&
xcb->
ewmh, cky, &states, NULL)) {
342 c->states = MIN(CLIENTSTATE, states.atoms_len);
343 memcpy(c->state, states.atoms,
344 MIN(CLIENTSTATE, states.atoms_len) *
sizeof(xcb_atom_t));
345 xcb_ewmh_get_atoms_reply_wipe(&states);
347 cky = xcb_ewmh_get_wm_window_type(&
xcb->
ewmh, win);
348 if (xcb_ewmh_get_wm_window_type_reply(&
xcb->
ewmh, cky, &states, NULL)) {
349 c->window_types = MIN(CLIENTWINDOWTYPE, states.atoms_len);
350 memcpy(c->window_type, states.atoms,
351 MIN(CLIENTWINDOWTYPE, states.atoms_len) *
sizeof(xcb_atom_t));
352 xcb_ewmh_get_atoms_reply_wipe(&states);
356 if (tmp_title == NULL) {
359 if (tmp_title != NULL) {
360 c->title = g_markup_escape_text(tmp_title, -1);
362 c->title = g_strdup(
"<i>no title set</i>");
365 MAX(c->title ? g_utf8_strlen(c->title, -1) : 0, pd->title_len);
369 c->role = g_markup_escape_text(tmp_role ? tmp_role :
"", -1);
370 pd->role_len = MAX(c->role ? g_utf8_strlen(c->role, -1) : 0, pd->role_len);
374 xcb_icccm_get_wm_class_reply_t wcr;
375 if (xcb_icccm_get_wm_class_reply(
xcb->
connection, cky, &wcr, NULL)) {
376 c->class = g_markup_escape_text(wcr.class_name, -1);
377 c->name = g_markup_escape_text(wcr.instance_name, -1);
378 pd->name_len = MAX(c->name ? g_utf8_strlen(c->name, -1) : 0, pd->name_len);
379 xcb_icccm_get_wm_class_reply_wipe(&wcr);
382 xcb_get_property_cookie_t cc =
384 xcb_icccm_wm_hints_t r;
385 if (xcb_icccm_get_wm_hints_reply(
xcb->
connection, cc, &r, NULL)) {
386 c->hint_flags = r.flags;
389 idx = winlist_append(cache_client, c->window, c);
400guint window_reload_timeout = 0;
401static gboolean window_client_reload(G_GNUC_UNUSED
void *data) {
402 window_reload_timeout = 0;
403 if (window_mode.private_data) {
404 window_mode._destroy(&window_mode);
405 window_mode._init(&window_mode);
407 if (window_mode_cd.private_data) {
408 window_mode_cd._destroy(&window_mode_cd);
409 window_mode_cd._init(&window_mode_cd);
411 if (window_mode.private_data || window_mode_cd.private_data) {
414 return G_SOURCE_REMOVE;
416void window_client_handle_signal(G_GNUC_UNUSED xcb_window_t win,
417 G_GNUC_UNUSED gboolean create) {
419 if (window_reload_timeout > 0) {
420 g_source_remove(window_reload_timeout);
421 window_reload_timeout = 0;
423 window_reload_timeout = g_timeout_add(100, window_client_reload, NULL);
426 unsigned int index) {
427 WindowModePrivateData *rmpd =
430 const winlist *ids = (winlist *)rmpd->ids;
432 int idx = winlist_find(cache_client, ids->array[index]);
434 client *c = cache_client->data[idx];
437 for (
int j = 0; match && tokens[j] != NULL; j++) {
444 if (c->title != NULL && c->title[0] !=
'\0' &&
445 matching_window_fields[WIN_MATCH_FIELD_TITLE].enabled) {
449 if (test == tokens[j]->invert && c->class != NULL &&
450 c->class[0] !=
'\0' &&
451 matching_window_fields[WIN_MATCH_FIELD_CLASS].enabled) {
455 if (test == tokens[j]->invert && c->role != NULL && c->role[0] !=
'\0' &&
456 matching_window_fields[WIN_MATCH_FIELD_ROLE].enabled) {
460 if (test == tokens[j]->invert && c->name != NULL && c->name[0] !=
'\0' &&
461 matching_window_fields[WIN_MATCH_FIELD_NAME].enabled) {
464 if (test == tokens[j]->invert && c->wmdesktopstr != NULL &&
465 c->wmdesktopstr[0] !=
'\0' &&
466 matching_window_fields[WIN_MATCH_FIELD_DESKTOP].enabled) {
479static void window_mode_parse_fields(
void) {
480 window_matching_fields_parsed = TRUE;
484 const char *
const sep =
",#";
486 for (
unsigned int i = 0; i < WIN_MATCH_NUM_FIELDS; i++) {
487 matching_window_fields[i].enabled = FALSE;
489 for (
char *token = strtok_r(switcher_str, sep, &savept); token != NULL;
490 token = strtok_r(NULL, sep, &savept)) {
491 if (strcmp(token,
"all") == 0) {
492 for (
unsigned int i = 0; i < WIN_MATCH_NUM_FIELDS; i++) {
493 matching_window_fields[i].enabled = TRUE;
497 gboolean matched = FALSE;
498 for (
unsigned int i = 0; i < WIN_MATCH_NUM_FIELDS; i++) {
499 const char *field_name = matching_window_fields[i].field_name;
500 if (strcmp(token, field_name) == 0) {
501 matching_window_fields[i].enabled = TRUE;
506 g_warning(
"Invalid window field name :%s", token);
510 g_free(switcher_str);
513static unsigned int window_mode_get_num_entries(
const Mode *sw) {
514 const WindowModePrivateData *pd =
517 return pd->ids ? pd->ids->len : 0;
523const char *invalid_desktop_name =
"n/a";
524static const char *_window_name_list_entry(
const char *str, uint32_t length,
528 while (index < entry && offset < length) {
529 if (str[offset] == 0) {
534 if (offset >= length) {
535 return invalid_desktop_name;
539static void _window_mode_load_data(
Mode *sw,
unsigned int cd) {
540 WindowModePrivateData *pd =
543 xcb_window_t curr_win_id;
549 xcb_get_property_cookie_t c =
551 if (!xcb_ewmh_get_active_window_reply(&
xcb->
ewmh, c, &curr_win_id, NULL)) {
556 unsigned int current_desktop = 0;
558 if (!xcb_ewmh_get_current_desktop_reply(&
xcb->
ewmh, c, ¤t_desktop,
565 xcb_ewmh_get_windows_reply_t clients = {
568 if (xcb_ewmh_get_client_list_stacking_reply(&
xcb->
ewmh, c, &clients, NULL)) {
572 if (xcb_ewmh_get_client_list_reply(&
xcb->
ewmh, c, &clients, NULL)) {
580 if (clients.windows_len > 0) {
585 pd->ids = winlist_new();
587 int has_names = FALSE;
588 ssize_t ws_names_length = 0;
589 char *ws_names = NULL;
590 xcb_get_property_cookie_t prop_cookie =
592 xcb_ewmh_get_utf8_strings_reply_t names;
593 if (xcb_ewmh_get_desktop_names_reply(&
xcb->
ewmh, prop_cookie, &names,
595 ws_names_length = names.strings_len;
596 ws_names = g_malloc0_n(names.strings_len + 1,
sizeof(
char));
597 memcpy(ws_names, names.strings, names.strings_len);
599 xcb_ewmh_get_utf8_strings_reply_wipe(&names);
602 for (i = clients.windows_len - 1; i > -1; i--) {
603 client *winclient = window_client(pd, clients.windows[i]);
604 if ((winclient != NULL) && !winclient->xattr.override_redirect &&
605 !client_has_window_type(winclient,
606 xcb->
ewmh._NET_WM_WINDOW_TYPE_DOCK) &&
607 !client_has_window_type(winclient,
608 xcb->
ewmh._NET_WM_WINDOW_TYPE_DESKTOP) &&
609 !client_has_state(winclient,
xcb->
ewmh._NET_WM_STATE_SKIP_PAGER) &&
610 !client_has_state(winclient,
xcb->
ewmh._NET_WM_STATE_SKIP_TASKBAR)) {
612 MAX(pd->clf_len, (winclient->class != NULL)
613 ? (g_utf8_strlen(winclient->class, -1))
616 if (client_has_state(winclient,
617 xcb->
ewmh._NET_WM_STATE_DEMANDS_ATTENTION)) {
618 winclient->demands = TRUE;
620 if ((winclient->hint_flags & XCB_ICCCM_WM_HINT_X_URGENCY) != 0) {
621 winclient->demands = TRUE;
624 if (winclient->window == curr_win_id) {
625 winclient->active = TRUE;
628 xcb_get_property_cookie_t cookie;
629 xcb_get_property_reply_t *r;
631 winclient->wmdesktop = 0xFFFFFFFF;
632 cookie = xcb_get_property(
xcb->
connection, 0, winclient->window,
633 xcb->
ewmh._NET_WM_DESKTOP, XCB_ATOM_CARDINAL,
637 if (r->type == XCB_ATOM_CARDINAL) {
638 winclient->wmdesktop = *((uint32_t *)xcb_get_property_value(r));
642 if (winclient->wmdesktop != 0xFFFFFFFF) {
647 if (pango_parse_markup(
648 _window_name_list_entry(ws_names, ws_names_length,
649 winclient->wmdesktop),
650 -1, 0, NULL, &output, NULL, NULL)) {
651 winclient->wmdesktopstr = g_strdup(_window_name_list_entry(
652 ws_names, ws_names_length, winclient->wmdesktop));
653 winclient->wmdesktopstr_len = g_utf8_strlen(output, -1);
654 pd->wmdn_len = MAX(pd->wmdn_len, winclient->wmdesktopstr_len);
657 winclient->wmdesktopstr = g_strdup(
"Invalid name");
658 winclient->wmdesktopstr_len =
659 g_utf8_strlen(winclient->wmdesktopstr, -1);
660 pd->wmdn_len = MAX(pd->wmdn_len, winclient->wmdesktopstr_len);
663 winclient->wmdesktopstr = g_markup_escape_text(
664 _window_name_list_entry(ws_names, ws_names_length,
665 winclient->wmdesktop),
667 winclient->wmdesktopstr_len =
668 g_utf8_strlen(winclient->wmdesktopstr, -1);
669 pd->wmdn_len = MAX(pd->wmdn_len, winclient->wmdesktopstr_len);
672 winclient->wmdesktopstr =
673 g_strdup_printf(
"%u", (uint32_t)winclient->wmdesktop);
674 winclient->wmdesktopstr_len =
675 g_utf8_strlen(winclient->wmdesktopstr, -1);
676 pd->wmdn_len = MAX(pd->wmdn_len, winclient->wmdesktopstr_len);
679 winclient->wmdesktopstr = g_strdup(
"");
680 winclient->wmdesktopstr_len =
681 g_utf8_strlen(winclient->wmdesktopstr, -1);
682 pd->wmdn_len = MAX(pd->wmdn_len, winclient->wmdesktopstr_len);
684 if (cd && winclient->wmdesktop != current_desktop) {
687 if (!pd->hide_active_window || winclient->window != curr_win_id) {
688 winlist_append(pd->ids, winclient->window, NULL);
697 xcb_ewmh_get_windows_reply_wipe(&clients);
699static int window_mode_init(
Mode *sw) {
702 WindowModePrivateData *pd = g_malloc0(
sizeof(*pd));
707 pd->hide_active_window = TRUE;
712 pd->prefer_icon_theme = TRUE;
714 pd->window_regex = g_regex_new(
"{[-\\w]+(:-?[0-9]+)?}", 0, 0, NULL);
716 _window_mode_load_data(sw, FALSE);
717 if (!window_matching_fields_parsed) {
718 window_mode_parse_fields();
723static int window_mode_init_cd(
Mode *sw) {
725 WindowModePrivateData *pd = g_malloc0(
sizeof(*pd));
731 pd->hide_active_window = TRUE;
733 pd->window_regex = g_regex_new(
"{[-\\w]+(:-?[0-9]+)?}", 0, 0, NULL);
735 _window_mode_load_data(sw, TRUE);
736 if (!window_matching_fields_parsed) {
737 window_mode_parse_fields();
743static inline int act_on_window(xcb_window_t window) {
747 char window_regex[100];
749 g_snprintf(window_regex,
sizeof window_regex,
"%d", window);
752 window_regex, (
char *)0);
754 GError *error = NULL;
755 g_spawn_async(NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL,
758 char *msg = g_strdup_printf(
759 "Failed to execute action for window: '%s'\nError: '%s'", window_regex,
774 G_GNUC_UNUSED
char **input,
775 unsigned int selected_line) {
776 WindowModePrivateData *rmpd =
781 act_on_window(rmpd->ids->array[selected_line]);
788 uint32_t wmdesktop = 0;
789 xcb_get_property_cookie_t cookie;
790 xcb_get_property_reply_t *r;
792 unsigned int current_desktop = 0;
793 xcb_get_property_cookie_t c =
795 if (!xcb_ewmh_get_current_desktop_reply(&
xcb->
ewmh, c, ¤t_desktop,
800 cookie = xcb_get_property(
802 xcb->
ewmh._NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 0, 1);
804 if (r && r->type == XCB_ATOM_CARDINAL) {
805 wmdesktop = *((uint32_t *)xcb_get_property_value(r));
807 if (r && r->type != XCB_ATOM_CARDINAL) {
809 wmdesktop = current_desktop;
814 if (wmdesktop != current_desktop) {
816 wmdesktop, XCB_CURRENT_TIME);
820 xcb_ewmh_request_change_active_window(
822 XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER, XCB_CURRENT_TIME,
827 xcb_ewmh_request_close_window(
829 XCB_CURRENT_TIME, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER);
840 GError *error = NULL;
842 gsize lf_cmd_size = 0;
843 gchar *lf_cmd = g_locale_from_utf8(*input, -1, NULL, &lf_cmd_size, &error);
845 g_warning(
"Failed to convert command to locale encoding: %s",
853 run_in_term ? &context : NULL)) {
863static void window_mode_destroy(
Mode *sw) {
864 WindowModePrivateData *rmpd =
867 winlist_free(rmpd->ids);
870 g_regex_unref(rmpd->window_regex);
876 const WindowModePrivateData *pd;
880static void helper_eval_add_str(GString *str,
const char *input,
int l,
881 int max_len,
int nc) {
883 const char *input_nn = input ? input :
"";
888 int bl = g_utf8_offset_to_pointer(input_nn, l) - input_nn;
889 char *tmp = g_markup_escape_text(input_nn, bl);
890 g_string_append(str, tmp);
894 char *tmp = g_markup_escape_text(input_nn, -1);
895 g_string_append(str, tmp);
899 g_string_append(str, input_nn);
901 spaces = MAX(0, max_len - nc);
905 g_string_append_c(str,
' ');
908static gboolean helper_eval_cb(
const GMatchInfo *info, GString *str,
910 struct arg *d = (
struct arg *)data;
913 match = g_match_info_fetch(info, 0);
916 if (match[2] ==
':') {
917 l = (int)g_ascii_strtoll(&match[3], NULL, 10);
919 if (match[1] ==
'w') {
920 helper_eval_add_str(str, d->c->wmdesktopstr, l, d->pd->wmdn_len,
921 d->c->wmdesktopstr_len);
922 }
else if (match[1] ==
'c') {
923 helper_eval_add_str(str, d->c->class, l, d->pd->clf_len,
924 g_utf8_strlen(d->c->class, -1));
925 }
else if (match[1] ==
't') {
926 helper_eval_add_str(str, d->c->title, l, d->pd->title_len,
927 g_utf8_strlen(d->c->title, -1));
928 }
else if (match[1] ==
'n') {
929 helper_eval_add_str(str, d->c->name, l, d->pd->name_len,
930 g_utf8_strlen(d->c->name, -1));
931 }
else if (match[1] ==
'r') {
932 helper_eval_add_str(str, d->c->role, l, d->pd->role_len,
933 g_utf8_strlen(d->c->role, -1));
940static char *_generate_display_string(
const WindowModePrivateData *pd,
942 struct arg d = {pd, c};
944 0, 0, helper_eval_cb, &d, NULL);
945 return g_strchomp(res);
949 int *state, G_GNUC_UNUSED GList **list,
952 const client *c = window_client(rmpd, rmpd->ids->array[selected_line]);
954 return get_entry ? g_strdup(
"Window has vanished") : NULL;
963 return get_entry ? _generate_display_string(rmpd, c) : NULL;
969static cairo_user_data_key_t data_key;
977static cairo_surface_t *draw_surface_from_data(uint32_t width, uint32_t height,
978 uint32_t
const *
const data) {
980 if (width >= 65536 || height >= 65536) {
983 uint32_t len = width * height;
985 uint32_t *buffer = g_new0(uint32_t, len);
986 cairo_surface_t *surface;
989 for (i = 0; i < len; i++) {
990 uint8_t a = (data[i] >> 24) & 0xff;
991 double alpha = a / 255.0;
992 uint8_t r = ((data[i] >> 16) & 0xff) * alpha;
993 uint8_t g = ((data[i] >> 8) & 0xff) * alpha;
994 uint8_t b = ((data[i] >> 0) & 0xff) * alpha;
995 buffer[i] = (a << 24) | (r << 16) | (g << 8) | b;
998 surface = cairo_image_surface_create_for_data(
999 (
unsigned char *)buffer, CAIRO_FORMAT_ARGB32, width, height, width * 4);
1001 cairo_surface_set_user_data(surface, &data_key, buffer, g_free);
1005static cairo_surface_t *ewmh_window_icon_from_reply(xcb_get_property_reply_t *r,
1006 uint32_t preferred_size) {
1007 uint32_t *data, *end, *found_data = 0;
1008 uint32_t found_size = 0;
1010 if (!r || r->type != XCB_ATOM_CARDINAL || r->format != 32 || r->length < 2) {
1014 data = (uint32_t *)xcb_get_property_value(r);
1019 end = data + r->length;
1025 while (data + 1 < end) {
1028 uint64_t data_size = (uint64_t)data[0] * data[1];
1029 if (data_size > (uint64_t)(end - data - 2)) {
1036 uint32_t size = MAX(data[0], data[1]);
1039 gboolean found_icon_too_small = found_size < preferred_size;
1040 gboolean found_icon_too_large = found_size > preferred_size;
1041 gboolean icon_empty = data[0] == 0 || data[1] == 0;
1042 gboolean better_because_bigger = found_icon_too_small && size > found_size;
1043 gboolean better_because_smaller =
1044 found_icon_too_large && size >= preferred_size && size < found_size;
1046 (better_because_bigger || better_because_smaller || found_size == 0)) {
1051 data += data_size + 2;
1058 return draw_surface_from_data(found_data[0], found_data[1], found_data + 2);
1061static cairo_surface_t *get_net_wm_icon(xcb_window_t xid,
1062 uint32_t preferred_size) {
1063 xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(
1066 xcb_get_property_reply_t *r =
1068 cairo_surface_t *surface = ewmh_window_icon_from_reply(r, preferred_size);
1072static cairo_surface_t *
_get_icon(
const Mode *sw,
unsigned int selected_line,
1073 unsigned int size) {
1075 client *c = window_client(rmpd, rmpd->ids->array[selected_line]);
1079 if (c->icon_fetch_size != size) {
1081 cairo_surface_destroy(c->icon);
1084 c->thumbnail_checked = FALSE;
1085 c->icon_checked = FALSE;
1086 c->icon_theme_checked = FALSE;
1090 c->thumbnail_checked = TRUE;
1092 if (rmpd->prefer_icon_theme == FALSE) {
1093 if (c->icon == NULL && c->icon_checked == FALSE) {
1094 c->icon = get_net_wm_icon(rmpd->ids->array[selected_line], size);
1095 c->icon_checked = TRUE;
1097 if (c->icon == NULL && c->class && c->icon_theme_checked == FALSE) {
1098 if (c->icon_fetch_uid == 0) {
1099 char *class_lower = g_utf8_strdown(c->class, -1);
1101 g_free(class_lower);
1102 c->icon_fetch_size = size;
1104 c->icon_theme_checked =
1107 cairo_surface_reference(c->icon);
1111 if (c->icon == NULL && c->class && c->icon_theme_checked == FALSE) {
1112 if (c->icon_fetch_uid == 0) {
1113 char *class_lower = g_utf8_strdown(c->class, -1);
1115 g_free(class_lower);
1116 c->icon_fetch_size = size;
1118 c->icon_theme_checked =
1121 cairo_surface_reference(c->icon);
1124 if (c->icon_theme_checked == TRUE && c->icon == NULL &&
1125 c->icon_checked == FALSE) {
1126 c->icon = get_net_wm_icon(rmpd->ids->array[selected_line], size);
1127 c->icon_checked = TRUE;
1130 c->icon_fetch_size = size;
1135Mode window_mode = {.name =
"window",
1136 .cfg_name_key =
"display-window",
1137 ._init = window_mode_init,
1138 ._get_num_entries = window_mode_get_num_entries,
1139 ._result = window_mode_result,
1140 ._destroy = window_mode_destroy,
1141 ._token_match = window_match,
1144 ._get_completion = NULL,
1145 ._preprocess_input = NULL,
1146 .private_data = NULL,
1149Mode window_mode_cd = {.name =
"windowcd",
1150 .cfg_name_key =
"display-windowcd",
1151 ._init = window_mode_init_cd,
1152 ._get_num_entries = window_mode_get_num_entries,
1153 ._result = window_mode_result,
1154 ._destroy = window_mode_destroy,
1155 ._token_match = window_match,
1158 ._get_completion = NULL,
1159 ._preprocess_input = NULL,
1160 .private_data = NULL,
static cairo_surface_t * _get_icon(const Mode *sw, unsigned int selected_line, unsigned int height)
static char * _get_display_value(const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, G_GNUC_UNUSED GList **attr_list, int get_entry)
Property * rofi_theme_find_property(ThemeWidget *wid, PropertyType type, const char *property, gboolean exact)
gboolean helper_execute_command(const char *wd, const char *cmd, gboolean run_in_term, RofiHelperExecuteContext *context)
ThemeWidget * rofi_config_find_widget(const char *name, const char *state, gboolean exact)
int helper_parse_setup(char *string, char ***output, int *length,...)
int helper_token_match(rofi_int_matcher *const *tokens, const char *input)
gboolean rofi_icon_fetcher_get_ex(const uint32_t uid, cairo_surface_t **surface)
uint32_t rofi_icon_fetcher_query(const char *name, const int size)
void * mode_get_private_data(const Mode *mode)
void mode_set_private_data(Mode *mode, void *pd)
void rofi_view_hide(void)
void rofi_view_reload(void)
xcb_window_t rofi_view_get_window(void)
int rofi_view_error_dialog(const char *msg, int markup)
char * window_match_fields
gboolean window_thumbnail
xcb_connection_t * connection
xcb_ewmh_connection_t ewmh
xcb_window_t focus_revert
char * window_get_text_prop(xcb_window_t w, xcb_atom_t atom)
WindowManagerQuirk current_window_manager
xcb_atom_t netatoms[NUM_NETATOMS]
cairo_surface_t * x11_helper_get_screenshot_surface_window(xcb_window_t window, int size)
@ WM_PANGO_WORKSPACE_NAMES
@ WM_DO_NOT_CHANGE_CURRENT_DESKTOP