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,7 +20,8 @@ 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
@ -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";*/
@ -68,8 +70,8 @@ newlines format are supported. But Unix is preferred.
C and C++ file comments are supported.
- Anything after `// ` and before a newline is considered a comment.
- Everything between `/*` and `*/` is a comment.
- Anything after `//` and before a newline is considered a comment.
- Everything between `/*` and `*/` is a comment.
Comments can be nested and the C comments can be inline.
@ -124,12 +126,12 @@ For example:
#### Number
An integer may contain any full number.
For example:
```css
For example:
```css
eh: 2;
```
```
#### Boolean
@ -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

@ -66,15 +66,15 @@ Markup support can be enabled, see CONFIGURATION options.
There are currently three methods of setting configuration options (evaluated
in order below):
- System configuration file (for example `/etc/rofi.rasi`). It first checks
- System configuration file (for example `/etc/rofi.rasi`). It first checks
`XDG_CONFIG_DIRS`, and then `SYSCONFDIR` (that is passed at compile time).
It loads the first config file it finds, it does not merge multiple system
configuration files.
- Rasi theme file: The new *theme* format can be used to set configuration
- Rasi theme file: The new *theme* format can be used to set configuration
values.
- Command-line options: Arguments passed to **rofi**.
- Command-line options: Arguments passed to **rofi**.
To get a template config file, run: `rofi -dump-config > config.rasi`
@ -102,7 +102,7 @@ For example to set the dpi value to 72:
```css
configuration {
dpi: 72;
dpi: 72;
}
```
@ -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: '-'
@ -466,7 +467,7 @@ Default: *0*
`-fixed-num-lines`
Keep a fixed number of visible lines.
Keep a fixed number of visible lines.
`-sidebar-mode`
@ -502,17 +503,17 @@ Select monitor to display **rofi** on. It accepts as input: *primary* (if
primary output is set), the *xrandr* output name, or integer number (in order
of detection). Negative numbers are handled differently:
- **-1**: the currently focused monitor.
- **-1**: the currently focused monitor.
- **-2**: the currently focused window (that is, **rofi** will be displayed
- **-2**: the currently focused window (that is, **rofi** will be displayed
on top of the focused window).
- **-3**: Position of mouse (overrides the location setting to get normal
- **-3**: Position of mouse (overrides the location setting to get normal
context menu behavior.)
- **-4**: the monitor with the focused window.
- **-4**: the monitor with the focused window.
- **-5**: the monitor that shows the mouse pointer.
- **-5**: the monitor that shows the mouse pointer.
Default: *-5*
@ -539,10 +540,10 @@ This is now the method to tweak the theme via the command line.
Override the default DPI setting.
- If set to `0`, it tries to auto-detect based on X11 screen size (similar to
- If set to `0`, it tries to auto-detect based on X11 screen size (similar to
i3 and GTK).
- If set to `1`, it tries to auto-detect based on the size of the monitor
- If set to `1`, it tries to auto-detect based on the size of the monitor
that **rofi** is displayed on (similar to latest Qt 5).
`-selected-row` *selected row*
@ -669,6 +670,7 @@ configuration {
}
}
```
You can hide the currently active window with the 'hide-active-window' setting:
```css
@ -696,7 +698,7 @@ or pass `-window-prefer-icon-theme true` on command line.
### Combi settings
`-combi-modes ` *mode1*,*mode2*
`-combi-modes` *mode1*,*mode2*
The modes to combine in combi mode.
For syntax to `-combi-modes`, see `-modes`.
@ -950,13 +952,13 @@ If there is no match, it will try to launch the input.
Shows a list of executables in `$PATH` and can launch them (optional in a
terminal).
- Pressing the `delete-entry` binding (`shift-delete`) will remove this entry
- Pressing the `delete-entry` binding (`shift-delete`) will remove this entry
from the run history.
- Pressing the `accept-custom` binding (`control-enter`) will run the command
- Pressing the `accept-custom` binding (`control-enter`) will run the command
as entered in the entry box.
- Pressing the `accept-alt` binding (`shift-enter`) will run the command in a
- Pressing the `accept-alt` binding (`shift-enter`) will run the command in a
terminal.
When pressing the `mode-complete` binding (`Control-l`), you can use the File
@ -968,13 +970,13 @@ Same as the **run** launches, but the list is created from the installed
desktop files. It automatically launches them in a terminal if specified in the
Desktop File.
- Pressing the `delete-entry` binding (`shift-delete`) will remove this entry
- Pressing the `delete-entry` binding (`shift-delete`) will remove this entry
from the run history.
- Pressing the `accept-custom` binding (`control-enter`) will run the command
- Pressing the `accept-custom` binding (`control-enter`) will run the command
as entered in the entry box.
- Pressing the `accept-alt` binding (`shift-enter`) will run the command in a
- Pressing the `accept-alt` binding (`shift-enter`) will run the command in a
terminal.
When pressing the `mode-complete` binding (`Control-l`), you can use the File
@ -1002,6 +1004,7 @@ configuration {
}
}
```
### ssh
Shows a list of SSH targets based on your `ssh` config file, and allows to
@ -1044,7 +1047,7 @@ instead of `"` ("machine quotes").
The indicator shows:
- ` ` Case insensitive and no sorting.
- `` Case insensitive and no sorting.
- `-` Case sensitivity enabled, no sorting.
- `+` Case insensitive and Sorting enabled
- `±` Sorting and Case sensitivity enabled"
@ -1053,13 +1056,13 @@ The indicator shows:
Each of these modes uses different methods of resolving the icon:
- Window: It first uses the icon that the application exposes via the X11
- Window: It first uses the icon that the application exposes via the X11
Server, if none is set it does a lookup of the window Class name in the icon
theme.
- drun: It uses the icon set in the desktop file.
- drun: It uses the icon set in the desktop file.
- run: It does a lookup using the executable name.
- run: It does a lookup using the executable name.
## EXAMPLES
@ -1157,7 +1160,7 @@ after the keys have been released.
## DEBUGGING
For more information see **rofi-debugging(5)** manpage.
For more information see **rofi-debugging(5)** manpage.
## ISSUE TRACKER

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

@ -128,7 +128,7 @@ static XrmOption xrmOptions[] = {
NULL,
"Whether to load and show icons",
CONFIG_DEFAULT},
{xrm_String,
"preview-cmd",
{.str = &config.preview_cmd},
@ -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