1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-07-31 21:59:25 -04:00

[Config] Remove character data type as it aliases with string.

Internal character option will now use the first ascii char from the
string type.
This commit is contained in:
Qball 2025-01-03 13:12:05 +01:00
parent de85539eb7
commit de4e10a7de
7 changed files with 47 additions and 62 deletions

View file

@ -20,6 +20,7 @@ configuration {
} }
``` ```
You can now set the options in the `configuration` block. You can now set the options in the `configuration` block.
## Create a configuration file from current setup ## Create a configuration file from current setup
@ -35,6 +36,7 @@ This will have all the possible settings and their current value.
If a value is the default value, the entry will be commented. If a value is the default value, the entry will be commented.
For example: For example:
```css ```css
configuration { configuration {
/* modes: "window,run,ssh,drun";*/ /* modes: "window,run,ssh,drun";*/
@ -144,15 +146,6 @@ show-icons: true;
This is equal to the `-show-icons` option on the commandline, and `show-icons: This is equal to the `-show-icons` option on the commandline, and `show-icons:
false;` is equal to `-no-show-icons`. false;` is equal to `-no-show-icons`.
#### Character
Character value is always surrounded by single quotes (') and should contain a
single character. It supports escaping.
```css
matching-negate-char: '-';
```
#### List #### List
This is not supported by the old configuration system, but can be used in the This is not supported by the old configuration system, but can be used in the
@ -164,6 +157,7 @@ comma-separated. The entry in the list single ASCII words.
```css ```css
combi-modes: [window,drun]; combi-modes: [window,drun];
``` ```
For older versions you have : For older versions you have :
```css ```css

View file

@ -329,6 +329,7 @@ configuration {
} }
} }
``` ```
Example Example
```css ```css
@ -416,10 +417,10 @@ The different fields are:
Default: *all* Default: *all*
`-matching-negate-char` *char* `-matching-negate-char` *string*
Set the character used to negate the query (i.e. if it does **not** match the Set the character used to negate the query (i.e. if it does **not** match the
next keyword). Set to '\x0' to disable. next keyword). Set to '\x0' to disable. It takes the first ASCII character from the string.
Default: '-' Default: '-'
@ -669,6 +670,7 @@ configuration {
} }
} }
``` ```
You can hide the currently active window with the 'hide-active-window' setting: You can hide the currently active window with the 'hide-active-window' setting:
```css ```css
@ -1002,6 +1004,7 @@ configuration {
} }
} }
``` ```
### ssh ### ssh
Shows a list of SSH targets based on your `ssh` config file, and allows to Shows a list of SSH targets based on your `ssh` config file, and allows to

View file

@ -14,8 +14,6 @@ typedef enum {
P_DOUBLE, P_DOUBLE,
/** String */ /** String */
P_STRING, P_STRING,
/** Character */
P_CHAR,
/** Boolean */ /** Boolean */
P_BOOLEAN, P_BOOLEAN,
/** Color */ /** Color */
@ -260,8 +258,6 @@ typedef union _PropertyValue {
double f; double f;
/** String */ /** String */
char *s; char *s;
/** Character */
char c;
/** boolean */ /** boolean */
gboolean b; gboolean b;
/** Color */ /** Color */

View file

@ -186,7 +186,6 @@ WORD_ENV [[:alpha:]_][[:alnum:]_]*
COLOR_NAME [[:alpha:]]+ COLOR_NAME [[:alpha:]]+
STRING \"{UANYN}*\"|\'{UANYN}*\' STRING \"{UANYN}*\"|\'{UANYN}*\'
STRING_LIST \"{UANYNP1}*\"|\'{UANYNP2}*\' STRING_LIST \"{UANYNP1}*\"|\'{UANYNP2}*\'
CHAR \'({ASCN}|\\\\|\\\'|\\0)\'
HEX [[:xdigit:]] HEX [[:xdigit:]]
NUMBER [[:digit:]]+ NUMBER [[:digit:]]+
UNARYMIN - UNARYMIN -
@ -522,7 +521,6 @@ if ( queue == NULL ) {
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{UNARYMIN} { return T_MIN; } <PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{UNARYMIN} { return T_MIN; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{STRING} { yytext[yyleng-1] = '\0'; yylval->sval = g_strcompress(&yytext[1]); return T_STRING;} <PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{STRING} { yytext[yyleng-1] = '\0'; yylval->sval = g_strcompress(&yytext[1]); return T_STRING;}
<PROPERTIES_ARRAY>{STRING_LIST} { yytext[yyleng-1] = '\0'; yylval->sval = g_strcompress(&yytext[1]); return T_STRING;} <PROPERTIES_ARRAY>{STRING_LIST} { yytext[yyleng-1] = '\0'; yylval->sval = g_strcompress(&yytext[1]); return T_STRING;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CHAR} { yytext[yyleng-1] = '\0'; yylval->cval = g_strcompress(&yytext[1])[0]; return T_CHAR;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>@{WORD} { <PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>@{WORD} {
yylval->sval = g_strdup(yytext+1); yylval->sval = g_strdup(yytext+1);

View file

@ -164,7 +164,6 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b )
%token <fval> T_DOUBLE "Floating-point number" %token <fval> T_DOUBLE "Floating-point number"
%token <sval> T_STRING "UTF-8 encode string" %token <sval> T_STRING "UTF-8 encode string"
%token <sval> T_MEDIA_TYPE "Media type" %token <sval> T_MEDIA_TYPE "Media type"
%token <cval> T_CHAR "Character"
%token <sval> T_PROP_NAME "property name" %token <sval> T_PROP_NAME "property name"
%token <colorval> T_COLOR_NAME "Color value by name" %token <colorval> T_COLOR_NAME "Color value by name"
%token <sval> T_NAME_ELEMENT "Element name" %token <sval> T_NAME_ELEMENT "Element name"
@ -567,10 +566,6 @@ t_property_element
$$ = rofi_theme_property_create ( P_STRING ); $$ = rofi_theme_property_create ( P_STRING );
$$->value.s = $1; $$->value.s = $1;
} }
| T_CHAR {
$$ = rofi_theme_property_create ( P_CHAR );
$$->value.c = $1;
}
| T_LINK { | T_LINK {
$$ = rofi_theme_property_create ( P_LINK ); $$ = rofi_theme_property_create ( P_LINK );
$$->value.link.name = $1; $$->value.link.name = $1;

View file

@ -10,8 +10,6 @@ const char *const PropertyTypeName[P_NUM_TYPES] = {
"Double", "Double",
/** String */ /** String */
"String", "String",
/** Character */
"Character",
/** Boolean */ /** Boolean */
"Boolean", "Boolean",
/** Color */ /** Color */

View file

@ -707,13 +707,14 @@ static gboolean __config_parser_set_property(XrmOption *option,
*(option->value.num) = (p->value.b); *(option->value.num) = (p->value.b);
option->source = (option->source & ~3) | CONFIG_FILE_THEME; option->source = (option->source & ~3) | CONFIG_FILE_THEME;
} else if (option->type == xrm_Char) { } else if (option->type == xrm_Char) {
if (p->type != P_CHAR) {
*error = g_strdup_printf( if (p->type != P_STRING) {
"Option: %s needs to be set with a character not a %s.", option->name, *error =
PropertyTypeName[p->type]); g_strdup_printf("Option: %s needs to be set with a string not a %s.",
option->name, PropertyTypeName[p->type]);
return TRUE; return TRUE;
} }
*(option->value.charc) = (p->value.c); *(option->value.charc) = (p->value.s[0]);
option->source = (option->source & ~3) | CONFIG_FILE_THEME; option->source = (option->source & ~3) | CONFIG_FILE_THEME;
} else { } else {
// TODO add type // TODO add type