mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
[Doc][Config] Update documentation for new fallback icon
* Allow multiple config be combined.
This commit is contained in:
parent
fc64265343
commit
141bd3d197
7 changed files with 91 additions and 77 deletions
40
doc/rofi.1
40
doc/rofi.1
|
@ -431,12 +431,6 @@ Specify icon theme to be used.
|
||||||
If not specified default theme from DE is used, \fIAdwaita\fP and \fIgnome\fP themes act as
|
If not specified default theme from DE is used, \fIAdwaita\fP and \fIgnome\fP themes act as
|
||||||
fallback themes.
|
fallback themes.
|
||||||
|
|
||||||
.PP
|
|
||||||
\fB\fC-application-fallback-icon\fR
|
|
||||||
|
|
||||||
.PP
|
|
||||||
Specify an icon to be used when the application icon in run/drun are not yet loaded or is not available.
|
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
\fB\fC-markup\fR
|
\fB\fC-markup\fR
|
||||||
|
|
||||||
|
@ -464,6 +458,38 @@ The limit of elements that is used to switch from instant to delayed filter mode
|
||||||
.PP
|
.PP
|
||||||
Default: 8192
|
Default: 8192
|
||||||
|
|
||||||
|
.PP
|
||||||
|
A fallback icon can be specified for each mode:
|
||||||
|
|
||||||
|
.PP
|
||||||
|
.RS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
configuration {
|
||||||
|
<mode>{
|
||||||
|
fallback-icon: "<icon name>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
|
||||||
|
.PP
|
||||||
|
Example
|
||||||
|
|
||||||
|
.PP
|
||||||
|
.RS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
configuration {
|
||||||
|
run,drun {
|
||||||
|
fallback-icon: "application-x-addon";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
|
||||||
.SS Matching
|
.SS Matching
|
||||||
.PP
|
.PP
|
||||||
\fB\fC-matching\fR \fImethod\fP
|
\fB\fC-matching\fR \fImethod\fP
|
||||||
|
@ -1000,7 +1026,7 @@ Default: {mode} {text}
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
Note: This setting is ignored if \fB\fCcombi-hide-mode-prefix\fR is eanbled.
|
Note: This setting is ignored if \fB\fCcombi-hide-mode-prefix\fR is enabled.
|
||||||
|
|
||||||
.SS History and Sorting
|
.SS History and Sorting
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -258,10 +258,6 @@ Specify icon theme to be used.
|
||||||
If not specified default theme from DE is used, *Adwaita* and *gnome* themes act as
|
If not specified default theme from DE is used, *Adwaita* and *gnome* themes act as
|
||||||
fallback themes.
|
fallback themes.
|
||||||
|
|
||||||
`-application-fallback-icon`
|
|
||||||
|
|
||||||
Specify an icon to be used when the application icon in run/drun are not yet loaded or is not available.
|
|
||||||
|
|
||||||
`-markup`
|
`-markup`
|
||||||
|
|
||||||
Use Pango markup to format output wherever possible.
|
Use Pango markup to format output wherever possible.
|
||||||
|
@ -280,6 +276,27 @@ The limit of elements that is used to switch from instant to delayed filter mode
|
||||||
|
|
||||||
Default: 8192
|
Default: 8192
|
||||||
|
|
||||||
|
A fallback icon can be specified for each mode:
|
||||||
|
|
||||||
|
```css
|
||||||
|
configuration {
|
||||||
|
<mode>{
|
||||||
|
fallback-icon: "<icon name>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Example
|
||||||
|
|
||||||
|
```css
|
||||||
|
configuration {
|
||||||
|
run,drun {
|
||||||
|
fallback-icon: "application-x-addon";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Matching
|
### Matching
|
||||||
|
|
||||||
`-matching` *method*
|
`-matching` *method*
|
||||||
|
|
|
@ -489,7 +489,7 @@ if ( queue == NULL ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
<NAMESTR>\.|{WHITESPACE} { return T_NSEP; }
|
<NAMESTR>\.|{WHITESPACE} { return T_NSEP; }
|
||||||
<NAMESTR>,{WHITESPACE}* { return T_SSEP; }
|
<NAMESTR,SECTION>,{WHITESPACE}* { return T_SSEP; }
|
||||||
/* Alias color to text-color */
|
/* Alias color to text-color */
|
||||||
<SECTION>"color" { yylval->sval = g_strdup("text-color"); return T_PROP_NAME;}
|
<SECTION>"color" { yylval->sval = g_strdup("text-color"); return T_PROP_NAME;}
|
||||||
<SECTION>{WORD} { yylval->sval = g_strdup(yytext); return T_PROP_NAME;}
|
<SECTION>{WORD} { yylval->sval = g_strdup(yytext); return T_PROP_NAME;}
|
||||||
|
@ -820,7 +820,6 @@ if ( queue == NULL ) {
|
||||||
}
|
}
|
||||||
<SECTION>. {
|
<SECTION>. {
|
||||||
yytext[yyleng-1] = '\0';
|
yytext[yyleng-1] = '\0';
|
||||||
fprintf(stderr,"section found: |%s|\n", yytext);
|
|
||||||
return T_ERROR_SECTION;
|
return T_ERROR_SECTION;
|
||||||
}
|
}
|
||||||
<PROPERTIES_ARRAY,PROPERTIES_VAR>{WORD_ELEMENT} {
|
<PROPERTIES_ARRAY,PROPERTIES_VAR>{WORD_ELEMENT} {
|
||||||
|
|
|
@ -278,6 +278,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b )
|
||||||
%type <theme> t_entry_list
|
%type <theme> t_entry_list
|
||||||
%type <theme> t_entry_list_included
|
%type <theme> t_entry_list_included
|
||||||
%type <list> t_entry_name_path
|
%type <list> t_entry_name_path
|
||||||
|
%type <list> t_property_name_list
|
||||||
%type <list> t_entry_name_path_selectors
|
%type <list> t_entry_name_path_selectors
|
||||||
%type <list> t_color_list
|
%type <list> t_color_list
|
||||||
%type <property> t_property
|
%type <property> t_property
|
||||||
|
@ -459,16 +460,19 @@ t_config_property
|
||||||
// We don't keep any reference to this after this point, so the property can be free'ed.
|
// We don't keep any reference to this after this point, so the property can be free'ed.
|
||||||
rofi_theme_property_free ( $1 );
|
rofi_theme_property_free ( $1 );
|
||||||
}
|
}
|
||||||
| t_property_name T_BOPEN t_property_list_optional T_BCLOSE
|
| t_property_name_list T_BOPEN t_property_list_optional T_BCLOSE
|
||||||
{
|
{
|
||||||
ThemeWidget *widget = rofi_configuration;
|
|
||||||
widget = rofi_theme_find_or_create_name ( widget, $1 );
|
for ( GList *iter = g_list_first( $1) ; iter; iter = g_list_next(iter)){
|
||||||
widget->set = TRUE;
|
ThemeWidget *widget = rofi_configuration;
|
||||||
rofi_theme_widget_add_properties ( widget, $3);
|
widget = rofi_theme_find_or_create_name ( widget, iter->data );
|
||||||
|
widget->set = TRUE;
|
||||||
|
rofi_theme_widget_add_properties ( widget, $3);
|
||||||
|
}
|
||||||
if ( $3 ) {
|
if ( $3 ) {
|
||||||
g_hash_table_destroy ( $3 );
|
g_hash_table_destroy ( $3 );
|
||||||
}
|
}
|
||||||
g_free ( $1 );
|
g_list_free_full ( $1, g_free );
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1049,5 +1053,11 @@ T_NAME_ELEMENT { $$ = g_list_append ( NULL, $1 );}
|
||||||
| t_entry_name_path T_NSEP { $$ = $1; }
|
| t_entry_name_path T_NSEP { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
t_property_name_list:
|
||||||
|
t_property_name { $$ = g_list_append ( NULL, $1 );}
|
||||||
|
| t_property_name_list T_SSEP t_property_name { $$ = g_list_append ( $1, $3);}
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
|
|
@ -78,28 +78,29 @@ cairo_surface_t *mode_get_icon(Mode *mode, unsigned int selected_line,
|
||||||
|
|
||||||
if (mode->_get_icon != NULL) {
|
if (mode->_get_icon != NULL) {
|
||||||
cairo_surface_t *icon = mode->_get_icon(mode, selected_line, height);
|
cairo_surface_t *icon = mode->_get_icon(mode, selected_line, height);
|
||||||
if ( icon ) {
|
if (icon) {
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mode->fallback_icon_not_found == TRUE) {
|
||||||
if ( mode->fallback_icon_not_found == TRUE) {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (mode->fallback_icon_fetch_uid > 0) {
|
if (mode->fallback_icon_fetch_uid > 0) {
|
||||||
cairo_surface_t *icon = rofi_icon_fetcher_get(mode->fallback_icon_fetch_uid);
|
cairo_surface_t *icon =
|
||||||
|
rofi_icon_fetcher_get(mode->fallback_icon_fetch_uid);
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
ThemeWidget *wid = rofi_config_find_widget(mode->name, NULL, TRUE);
|
ThemeWidget *wid = rofi_config_find_widget(mode->name, NULL, TRUE);
|
||||||
if ( wid ) {
|
if (wid) {
|
||||||
/** Load user entires */
|
/** Load user entires */
|
||||||
Property *p = rofi_theme_find_property(wid, P_STRING, "fallback-icon", TRUE);
|
Property *p =
|
||||||
if (p != NULL && (p->type == P_STRING && p->value.s)) {
|
rofi_theme_find_property(wid, P_STRING, "fallback-icon", TRUE);
|
||||||
mode->fallback_icon_fetch_uid =
|
if (p != NULL && (p->type == P_STRING && p->value.s)) {
|
||||||
rofi_icon_fetcher_query(p->value.s, height);
|
mode->fallback_icon_fetch_uid =
|
||||||
|
rofi_icon_fetcher_query(p->value.s, height);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mode->fallback_icon_not_found = TRUE;
|
mode->fallback_icon_not_found = TRUE;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -213,10 +213,6 @@ struct _DRunModePrivateData {
|
||||||
char *old_completer_input;
|
char *old_completer_input;
|
||||||
uint32_t selected_line;
|
uint32_t selected_line;
|
||||||
char *old_input;
|
char *old_input;
|
||||||
|
|
||||||
/** fallback icon */
|
|
||||||
uint32_t fallback_icon_fetch_uid;
|
|
||||||
cairo_surface_t *fallback_icon;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RegexEvalArg {
|
struct RegexEvalArg {
|
||||||
|
@ -1331,17 +1327,6 @@ static char *_get_display_value(const Mode *sw, unsigned int selected_line,
|
||||||
return retv;
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_surface_t *fallback_icon(DRunModePrivateData *pd, int height) {
|
|
||||||
if (config.application_fallback_icon) {
|
|
||||||
// FALLBACK
|
|
||||||
if (pd->fallback_icon_fetch_uid > 0) {
|
|
||||||
return rofi_icon_fetcher_get(pd->fallback_icon_fetch_uid);
|
|
||||||
}
|
|
||||||
pd->fallback_icon_fetch_uid =
|
|
||||||
rofi_icon_fetcher_query(config.application_fallback_icon, height);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
||||||
int height) {
|
int height) {
|
||||||
DRunModePrivateData *pd = (DRunModePrivateData *)mode_get_private_data(sw);
|
DRunModePrivateData *pd = (DRunModePrivateData *)mode_get_private_data(sw);
|
||||||
|
@ -1353,18 +1338,13 @@ static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
||||||
if (dr->icon_name != NULL) {
|
if (dr->icon_name != NULL) {
|
||||||
if (dr->icon_fetch_uid > 0) {
|
if (dr->icon_fetch_uid > 0) {
|
||||||
cairo_surface_t *icon = rofi_icon_fetcher_get(dr->icon_fetch_uid);
|
cairo_surface_t *icon = rofi_icon_fetcher_get(dr->icon_fetch_uid);
|
||||||
if (icon) {
|
return icon;
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
return fallback_icon(pd, height);
|
|
||||||
}
|
}
|
||||||
dr->icon_fetch_uid = rofi_icon_fetcher_query(dr->icon_name, height);
|
dr->icon_fetch_uid = rofi_icon_fetcher_query(dr->icon_name, height);
|
||||||
cairo_surface_t *icon = rofi_icon_fetcher_get(dr->icon_fetch_uid);
|
cairo_surface_t *icon = rofi_icon_fetcher_get(dr->icon_fetch_uid);
|
||||||
if (icon) {
|
return icon;
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return fallback_icon(pd, height);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *drun_get_completion(const Mode *sw, unsigned int index) {
|
static char *drun_get_completion(const Mode *sw, unsigned int index) {
|
||||||
|
|
|
@ -46,10 +46,10 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "modes/filebrowser.h"
|
|
||||||
#include "modes/run.h"
|
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
|
#include "modes/filebrowser.h"
|
||||||
|
#include "modes/run.h"
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
|
@ -85,9 +85,6 @@ typedef struct {
|
||||||
|
|
||||||
Mode *completer;
|
Mode *completer;
|
||||||
char *old_completer_input;
|
char *old_completer_input;
|
||||||
/** fallback icon */
|
|
||||||
uint32_t fallback_icon_fetch_uid;
|
|
||||||
cairo_surface_t *fallback_icon;
|
|
||||||
} RunModePrivateData;
|
} RunModePrivateData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -531,17 +528,6 @@ static char *run_get_message(const Mode *sw) {
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
static cairo_surface_t *fallback_icon(RunModePrivateData *pd, int height) {
|
|
||||||
if (config.application_fallback_icon) {
|
|
||||||
// FALLBACK
|
|
||||||
if (pd->fallback_icon_fetch_uid > 0) {
|
|
||||||
return rofi_icon_fetcher_get(pd->fallback_icon_fetch_uid);
|
|
||||||
}
|
|
||||||
pd->fallback_icon_fetch_uid =
|
|
||||||
rofi_icon_fetcher_query(config.application_fallback_icon, height);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
||||||
int height) {
|
int height) {
|
||||||
RunModePrivateData *pd = (RunModePrivateData *)mode_get_private_data(sw);
|
RunModePrivateData *pd = (RunModePrivateData *)mode_get_private_data(sw);
|
||||||
|
@ -553,10 +539,7 @@ static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
||||||
|
|
||||||
if (dr->icon_fetch_uid > 0) {
|
if (dr->icon_fetch_uid > 0) {
|
||||||
cairo_surface_t *icon = rofi_icon_fetcher_get(dr->icon_fetch_uid);
|
cairo_surface_t *icon = rofi_icon_fetcher_get(dr->icon_fetch_uid);
|
||||||
if (icon) {
|
return icon;
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
return fallback_icon(pd, height);
|
|
||||||
}
|
}
|
||||||
/** lookup icon */
|
/** lookup icon */
|
||||||
char **str = g_strsplit(dr->entry, " ", 2);
|
char **str = g_strsplit(dr->entry, " ", 2);
|
||||||
|
@ -564,11 +547,9 @@ static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
||||||
dr->icon_fetch_uid = rofi_icon_fetcher_query(str[0], height);
|
dr->icon_fetch_uid = rofi_icon_fetcher_query(str[0], height);
|
||||||
g_strfreev(str);
|
g_strfreev(str);
|
||||||
cairo_surface_t *icon = rofi_icon_fetcher_get(dr->icon_fetch_uid);
|
cairo_surface_t *icon = rofi_icon_fetcher_get(dr->icon_fetch_uid);
|
||||||
if (icon) {
|
return icon;
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return fallback_icon(pd, height);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "mode-private.h"
|
#include "mode-private.h"
|
||||||
|
|
Loading…
Reference in a new issue