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

Add option to dump color scheme.

This commit is contained in:
Dave Davenport 2015-12-10 18:20:04 +01:00
parent 691b06f767
commit 8ed31cab7e
5 changed files with 36 additions and 1 deletions

View file

@ -50,6 +50,7 @@
[ -version ]
[ -help ]
[ -dump-xresources ]
[ -dump-xresources-theme ]
[ -auto-select ]
[ -parse-hosts ]
[ -no-parse-known-hosts ]
@ -147,6 +148,10 @@ The help option shows the full list of commandline options and the current set v
Dump the current active configuration in Xresources format to the command-line.
This does not validate all passed values (e.g. colors).
`-dump-xresources-theme`
Dump the current color schme in Xresources format to the command-line.
`-key-{mode}` **KEY**
Set the key combination to display a {mode} in daemon mode.

View file

@ -7,7 +7,7 @@
\fBrofi\fR \- A window switcher, run launcher, ssh dialog and dmenu replacement
.
.SH "SYNOPSIS"
\fBrofi\fR [ \-width \fIpct_scr\fR ] [ \-lines \fIlines\fR ] [ \-columns \fIcolumns\fR ] [ \-font \fIpangofont\fR ] [ \-fg \fIcolor\fR ] [ \-fg\-urgent \fIcolor\fR ] [ \-fg\-active \fIcolor\fR ] [ \-bg\-urgent \fIcolor\fR ] [ \-bg\-active \fIcolor\fR ] [ \-bg \fIcolor\fR ] [ \-bgalt \fIcolor\fR ] [ \-hlfg \fIcolor\fR ] [ \-hlbg \fIcolor\fR ] [ \-key\-\fBmode\fR \fIcombo\fR ] [ \-terminal \fIterminal\fR ] [ \-location \fIposition\fR ] [ \-fixed\-num\-lines ] [ \-padding \fIpadding\fR ] [ \-opacity \fIopacity%\fR ] [ \-display \fIdisplay\fR ] [ \-bc \fIcolor\fR ] [ \-bw \fIwidth\fR ] [ \-dmenu [ \-p \fIprompt\fR ] [ \-sep \fIseparator\fR ] [ \-l \fIselected line\fR ] [ \-mesg ] [ \-select ] [ \-input \fIinput\fR ] ] [ \-filter \fIfilter\fR ] [ \-ssh\-client \fIclient\fR ] [ \-ssh\-command \fIcommand\fR ] [ \-disable\-history ] [ \-levenshtein\-sort ] [ \-case\-sensitive ] [ \-show \fImode\fR ] [ \-modi \fImode1,mode2\fR ] [ \-eh \fIelement height\fR ] [ \-lazy\-filter\-limit \fIlimit\fR ] [ \-e \fImessage\fR] [ \-a \fIrow\fR ] [ \-u \fIrow\fR ] [ \-pid \fIpath\fR ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-version ] [ \-help ] [ \-dump\-xresources ] [ \-auto\-select ] [ \-parse\-hosts ] [ \-no\-parse\-known\-hosts ] [ \-combi\-modi \fImode1,mode2\fR ] [ \-normal\-window ] [ \-fake\-transparency ] [ \-quiet ] [ \-glob ] [ \-regex ] [ \-tokenize ] [ \-threads \fInum\fR ]
\fBrofi\fR [ \-width \fIpct_scr\fR ] [ \-lines \fIlines\fR ] [ \-columns \fIcolumns\fR ] [ \-font \fIpangofont\fR ] [ \-fg \fIcolor\fR ] [ \-fg\-urgent \fIcolor\fR ] [ \-fg\-active \fIcolor\fR ] [ \-bg\-urgent \fIcolor\fR ] [ \-bg\-active \fIcolor\fR ] [ \-bg \fIcolor\fR ] [ \-bgalt \fIcolor\fR ] [ \-hlfg \fIcolor\fR ] [ \-hlbg \fIcolor\fR ] [ \-key\-\fBmode\fR \fIcombo\fR ] [ \-terminal \fIterminal\fR ] [ \-location \fIposition\fR ] [ \-fixed\-num\-lines ] [ \-padding \fIpadding\fR ] [ \-opacity \fIopacity%\fR ] [ \-display \fIdisplay\fR ] [ \-bc \fIcolor\fR ] [ \-bw \fIwidth\fR ] [ \-dmenu [ \-p \fIprompt\fR ] [ \-sep \fIseparator\fR ] [ \-l \fIselected line\fR ] [ \-mesg ] [ \-select ] [ \-input \fIinput\fR ] ] [ \-filter \fIfilter\fR ] [ \-ssh\-client \fIclient\fR ] [ \-ssh\-command \fIcommand\fR ] [ \-disable\-history ] [ \-levenshtein\-sort ] [ \-case\-sensitive ] [ \-show \fImode\fR ] [ \-modi \fImode1,mode2\fR ] [ \-eh \fIelement height\fR ] [ \-lazy\-filter\-limit \fIlimit\fR ] [ \-e \fImessage\fR] [ \-a \fIrow\fR ] [ \-u \fIrow\fR ] [ \-pid \fIpath\fR ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-version ] [ \-help ] [ \-dump\-xresources ] [ \-dump\-xresources\-theme ] [ \-auto\-select ] [ \-parse\-hosts ] [ \-no\-parse\-known\-hosts ] [ \-combi\-modi \fImode1,mode2\fR ] [ \-normal\-window ] [ \-fake\-transparency ] [ \-quiet ] [ \-glob ] [ \-regex ] [ \-tokenize ] [ \-threads \fInum\fR ]
.
.SH "DESCRIPTION"
\fBrofi\fR is an X11 popup window switcher, run dialog, dmenu replacement and more\. It focuses on being fast to use and have minimal distraction\. It supports keyboard and mouse navigation, type to filter, tokenized search and more\.
@ -162,6 +162,12 @@ The help option shows the full list of commandline options and the current set v
Dump the current active configuration in Xresources format to the command\-line\. This does not validate all passed values (e\.g\. colors)\.
.
.P
\fB\-dump\-xresources\-theme\fR
.
.P
Dump the current color schme in Xresources format to the command\-line\.
.
.P
\fB\-key\-{mode}\fR \fBKEY\fR
.
.P

View file

@ -53,4 +53,5 @@ void xresource_dump ( void );
void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment );
void print_options ( void );
void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty );
void print_xresources_theme ( void );
#endif

View file

@ -1940,6 +1940,7 @@ static void print_main_application_options ( void )
print_help_msg ( "-display", "[string]", "X server to contact.", "${DISPLAY}", is_term );
print_help_msg ( "-h,-help", "", "This help message.", NULL, is_term );
print_help_msg ( "-dump-xresources", "", "Dump the current configuration in Xresources format and exit.", NULL, is_term );
print_help_msg ( "-dump-xresources-theme", "", "Dump the current color scheme in Xresources format and exit.", NULL, is_term );
print_help_msg ( "-e", "[string]", "Show a dialog displaying the passed message and exit.", NULL, is_term );
print_help_msg ( "-markup", "", "Enable pango markup where possible.", NULL, is_term );
print_help_msg ( "-normal-window", "", "In dmenu mode, behave as a normal window. (experimental)", NULL, is_term );
@ -2442,6 +2443,10 @@ int main ( int argc, char *argv[] )
xresource_dump ();
exit ( EXIT_SUCCESS );
}
if ( find_arg ( "-dump-xresources-theme" ) >= 0 ) {
print_xresources_theme();
exit ( EXIT_SUCCESS );
}
// Parse the keybindings.
parse_keys_abe ();
TICK_N ( "Parse ABE" );

View file

@ -510,3 +510,21 @@ void print_help_msg ( const char *option, const char *type, const char*text, con
}
}
}
void print_xresources_theme ( void )
{
if( config.color_enabled != TRUE ) {
printf("! Dumping theme only works for the extended color scheme.\n");
return;
}
printf("! ------------------------------------------------------------------------------\n");
printf("! ROFI Color theme\n");
printf("! ------------------------------------------------------------------------------\n");
const char * namePrefix = "rofi";
unsigned int entries = sizeof ( xrmOptions ) / sizeof ( *xrmOptions );
for ( unsigned int i = 0; i < entries; ++i ) {
if ( strncmp(xrmOptions[i].name, "color-",6) == 0){
xresource_dump_entry(namePrefix, &xrmOptions[i]);
}
}
}