diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown index 75aa0789..05666643 100644 --- a/doc/rofi-manpage.markdown +++ b/doc/rofi-manpage.markdown @@ -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. diff --git a/doc/rofi.1 b/doc/rofi.1 index fe0281ab..eb2930ff 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -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 diff --git a/include/xrmoptions.h b/include/xrmoptions.h index ab72bec9..f1d9d3aa 100644 --- a/include/xrmoptions.h +++ b/include/xrmoptions.h @@ -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 diff --git a/source/rofi.c b/source/rofi.c index 5296437e..50becc8b 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -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" ); diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 03cfd301..2d3b5dd2 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -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]); + } + } +}