1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-01-27 15:25:24 -05: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.
## 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.
For example:
```css
configuration {
/* 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:
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
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
combi-modes: [window,drun];
```
For older versions you have :
```css

View file

@ -329,6 +329,7 @@ configuration {
}
}
```
Example
```css
@ -416,10 +417,10 @@ The different fields are:
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
next keyword). Set to '\x0' to disable.
next keyword). Set to '\x0' to disable. It takes the first ASCII character from the string.
Default: '-'
@ -669,6 +670,7 @@ configuration {
}
}
```
You can hide the currently active window with the 'hide-active-window' setting:
```css
@ -1002,6 +1004,7 @@ configuration {
}
}
```
### ssh
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,
/** String */
P_STRING,
/** Character */
P_CHAR,
/** Boolean */
P_BOOLEAN,
/** Color */
@ -260,8 +258,6 @@ typedef union _PropertyValue {
double f;
/** String */
char *s;
/** Character */
char c;
/** boolean */
gboolean b;
/** Color */

View file

@ -186,7 +186,6 @@ WORD_ENV [[:alpha:]_][[:alnum:]_]*
COLOR_NAME [[:alpha:]]+
STRING \"{UANYN}*\"|\'{UANYN}*\'
STRING_LIST \"{UANYNP1}*\"|\'{UANYNP2}*\'
CHAR \'({ASCN}|\\\\|\\\'|\\0)\'
HEX [[:xdigit:]]
NUMBER [[:digit:]]+
UNARYMIN -
@ -522,7 +521,6 @@ if ( queue == NULL ) {
<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_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} {
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 <sval> T_STRING "UTF-8 encode string"
%token <sval> T_MEDIA_TYPE "Media type"
%token <cval> T_CHAR "Character"
%token <sval> T_PROP_NAME "property name"
%token <colorval> T_COLOR_NAME "Color value by name"
%token <sval> T_NAME_ELEMENT "Element name"
@ -567,10 +566,6 @@ t_property_element
$$ = rofi_theme_property_create ( P_STRING );
$$->value.s = $1;
}
| T_CHAR {
$$ = rofi_theme_property_create ( P_CHAR );
$$->value.c = $1;
}
| T_LINK {
$$ = rofi_theme_property_create ( P_LINK );
$$->value.link.name = $1;

View file

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

View file

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