1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-03 15:34:54 -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 ## 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";*/
@ -68,8 +70,8 @@ newlines format are supported. But Unix is preferred.
C and C++ file comments are supported. C and C++ file comments are supported.
- Anything after `// ` and before a newline is considered a comment. - Anything after `//` and before a newline is considered a comment.
- Everything between `/*` and `*/` is a comment. - Everything between `/*` and `*/` is a comment.
Comments can be nested and the C comments can be inline. Comments can be nested and the C comments can be inline.
@ -124,12 +126,12 @@ For example:
#### Number #### Number
An integer may contain any full number. An integer may contain any full number.
For example: For example:
```css ```css
eh: 2; eh: 2;
``` ```
#### Boolean #### Boolean
@ -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

@ -66,15 +66,15 @@ Markup support can be enabled, see CONFIGURATION options.
There are currently three methods of setting configuration options (evaluated There are currently three methods of setting configuration options (evaluated
in order below): 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). `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 It loads the first config file it finds, it does not merge multiple system
configuration files. 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. 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` 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 ```css
configuration { configuration {
dpi: 72; dpi: 72;
} }
``` ```
@ -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: '-'
@ -466,7 +467,7 @@ Default: *0*
`-fixed-num-lines` `-fixed-num-lines`
Keep a fixed number of visible lines. Keep a fixed number of visible lines.
`-sidebar-mode` `-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 primary output is set), the *xrandr* output name, or integer number (in order
of detection). Negative numbers are handled differently: 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). 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.) 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* Default: *-5*
@ -539,10 +540,10 @@ This is now the method to tweak the theme via the command line.
Override the default DPI setting. 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). 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). that **rofi** is displayed on (similar to latest Qt 5).
`-selected-row` *selected row* `-selected-row` *selected row*
@ -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
@ -696,7 +698,7 @@ or pass `-window-prefer-icon-theme true` on command line.
### Combi settings ### Combi settings
`-combi-modes ` *mode1*,*mode2* `-combi-modes` *mode1*,*mode2*
The modes to combine in combi mode. The modes to combine in combi mode.
For syntax to `-combi-modes`, see `-modes`. 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 Shows a list of executables in `$PATH` and can launch them (optional in a
terminal). 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. 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. 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. terminal.
When pressing the `mode-complete` binding (`Control-l`), you can use the File 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 files. It automatically launches them in a terminal if specified in the
Desktop File. 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. 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. 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. terminal.
When pressing the `mode-complete` binding (`Control-l`), you can use the File When pressing the `mode-complete` binding (`Control-l`), you can use the File
@ -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
@ -1044,7 +1047,7 @@ instead of `"` ("machine quotes").
The indicator shows: The indicator shows:
- ` ` Case insensitive and no sorting. - `` Case insensitive and no sorting.
- `-` Case sensitivity enabled, no sorting. - `-` Case sensitivity enabled, no sorting.
- `+` Case insensitive and Sorting enabled - `+` Case insensitive and Sorting enabled
- `±` Sorting and Case sensitivity enabled" - `±` Sorting and Case sensitivity enabled"
@ -1053,13 +1056,13 @@ The indicator shows:
Each of these modes uses different methods of resolving the icon: 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 Server, if none is set it does a lookup of the window Class name in the icon
theme. 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 ## EXAMPLES
@ -1157,7 +1160,7 @@ after the keys have been released.
## DEBUGGING ## DEBUGGING
For more information see **rofi-debugging(5)** manpage. For more information see **rofi-debugging(5)** manpage.
## ISSUE TRACKER ## ISSUE TRACKER

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

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