Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/rofi-script.5.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ For example:

The following options are supported:

- **icon**: Set the icon for that row.
- **icon**: Set the icon for that row. Multiple fallback icons can be specified using comma-separated values.

- **display**: Replace the displayed string. (Original string will still be used for filtering)

Expand All @@ -158,7 +158,7 @@ The following options are supported:
multiple entries can be passed using the `\x1f` separator.

```bash
echo -en "aap\0icon\x1ffolder\x1finfo\x1ftest\n"
echo -en "aap\0icon\x1ffolder,inode-directory\x1finfo\x1ftest\n"
```

## Executing external program
Expand Down
24 changes: 22 additions & 2 deletions source/modes/dmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,12 +724,32 @@ static cairo_surface_t *dmenu_get_icon(const Mode *sw,
if (dr->icon_name == NULL) {
return NULL;
}
uint32_t uid = dr->icon_fetch_uid =
if (strchr(dr->icon_name, ',') == NULL) {
uint32_t uid = dr->icon_fetch_uid =
rofi_icon_fetcher_query(dr->icon_name, height);
dr->icon_fetch_size = height;
dr->icon_fetch_scale = scale;

return rofi_icon_fetcher_get(uid);
return rofi_icon_fetcher_get(uid);
} else {
cairo_surface_t *icon_surface = NULL;
char *icon_name_copy = g_strdup(dr->icon_name);
char *icon_iter = icon_name_copy;
char *icon = NULL;
// Try each icon in the comma-separated list until one is found
while ((icon = strsep(&icon_iter, ",")) != NULL) {
uint32_t uid = rofi_icon_fetcher_query(icon, height);
icon_surface = rofi_icon_fetcher_get(uid);
if (icon_surface != NULL) {
dr->icon_fetch_uid = uid;
dr->icon_fetch_size = height;
dr->icon_fetch_scale = scale;
break;
}
}
g_free(icon_name_copy);
return icon_surface;
}
}

static void dmenu_finish(DmenuModePrivateData *pd, RofiViewState *state,
Expand Down