1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-11 13:50:48 -05:00

Add quote and escape string option.

This commit is contained in:
Dave Davenport 2015-05-13 18:35:55 +02:00
parent 8abf3335dc
commit 22f35983c0
3 changed files with 10 additions and 3 deletions

View file

@ -519,7 +519,8 @@ The following options are further explained in the theming section:
* 's' selected string. * 's' selected string.
* 'i' index (0 - (N-1)). * 'i' index (0 - (N-1)).
* 'd' index (1 - N). * 'd' index (1 - N).
* 'e' selected string escaped. * 'q' quote string.
* 'e' escape string.
Default: 's' Default: 's'

View file

@ -678,7 +678,8 @@ Allows the output of dmenu to be customized (N is total number of input entries)
* 's' selected string. * 's' selected string.
* 'i' index (0 \- (N\-1)). * 'i' index (0 \- (N\-1)).
* 'd' index (1 \- N). * 'd' index (1 \- N).
* 'e' selected string escaped. * 'q' quote string.
* 'e' escape string.
Default: 's' Default: 's'
.fi .fi
.RE .RE

View file

@ -154,11 +154,16 @@ static void dmenu_output_formatted_line ( const char *format, const char *string
else if ( format[i] == 's' ) { else if ( format[i] == 's' ) {
fputs ( string, stdout ); fputs ( string, stdout );
} }
else if ( format[i] == 'e' ) { else if ( format[i] == 'q' ) {
char *quote = g_shell_quote ( string ); char *quote = g_shell_quote ( string );
fputs ( quote, stdout ); fputs ( quote, stdout );
g_free ( quote ); g_free ( quote );
} }
else if ( format[i] == 'e' ) {
char *quote = g_strescape ( string, "" );
fputs ( quote, stdout );
g_free ( quote );
}
else { else {
fputc ( format[i], stdout ); fputc ( format[i], stdout );
} }