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

Remove deprecated theme options

* color_window
* color_urgent
* color_active
* color_normal
This commit is contained in:
Dave Davenport 2021-06-08 22:44:15 +02:00
parent 1a9dac80a9
commit dc46457f71
9 changed files with 1 additions and 150 deletions

View file

@ -155,7 +155,6 @@ rofi_CFLAGS=\
-I$(top_builddir)/\ -I$(top_builddir)/\
-Werror=missing-prototypes\ -Werror=missing-prototypes\
-DSYSCONFDIR=\"$(sysconfdir)\"\ -DSYSCONFDIR=\"$(sysconfdir)\"\
-DTHEME_CONVERTER\
-DPLUGIN_PATH=\"${libdir}/rofi\"\ -DPLUGIN_PATH=\"${libdir}/rofi\"\
-DTHEME_DIR=\"$(themedir)\" -DTHEME_DIR=\"$(themedir)\"

View file

@ -140,10 +140,6 @@ Settings config = {
.window_format = "{w} {c} {t}", .window_format = "{w} {c} {t}",
.click_to_exit = TRUE, .click_to_exit = TRUE,
.theme = NULL, .theme = NULL,
.color_normal = NULL,
.color_active = NULL,
.color_urgent = NULL,
.color_window = NULL,
.plugin_path = PLUGIN_PATH, .plugin_path = PLUGIN_PATH,
.max_history_size = 25, .max_history_size = 25,
.combi_hide_mode_prefix = FALSE, .combi_hide_mode_prefix = FALSE,

View file

@ -64,12 +64,6 @@ typedef struct
/** Font string (pango format) */ /** Font string (pango format) */
char * menu_font; char * menu_font;
/** New row colors */
char * color_normal;
char * color_active;
char * color_urgent;
char * color_window;
/** Whether to load and show icons */ /** Whether to load and show icons */
gboolean show_icons; gboolean show_icons;

View file

@ -354,12 +354,6 @@ gboolean rofi_theme_is_empty ( void );
* Reset the current theme. * Reset the current theme.
*/ */
void rofi_theme_reset ( void ); void rofi_theme_reset ( void );
#ifdef THEME_CONVERTER
/**
* Convert old theme colors into default one.
*/
void rofi_theme_convert_old ( void );
#endif
/** /**
* @param file File name passed to option. * @param file File name passed to option.

View file

@ -84,7 +84,6 @@ header_conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
header_conf.set_quoted('PACKAGE_BUGREPORT', 'https://github.com/davatorium/rofi/') header_conf.set_quoted('PACKAGE_BUGREPORT', 'https://github.com/davatorium/rofi/')
header_conf.set_quoted('PACKAGE_URL', 'https://reddit.com/r/qtools/') header_conf.set_quoted('PACKAGE_URL', 'https://reddit.com/r/qtools/')
header_conf.set('THEME_CONVERTER', true)
header_conf.set('_GNU_SOURCE', true) header_conf.set('_GNU_SOURCE', true)
header_conf.set('USE_NK_GIT_VERSION', true) header_conf.set('USE_NK_GIT_VERSION', true)

View file

@ -78,7 +78,7 @@ typedef struct
/** /**
* Shared function between DMENU and Script mode. * Shared function between DMENU and Script mode.
*/ */
void dmenuscript_parse_entry_extras ( G_GNUC_UNUSED Mode *sw, DmenuScriptEntry *entry, char *buffer, size_t length ) void dmenuscript_parse_entry_extras ( G_GNUC_UNUSED Mode *sw, DmenuScriptEntry *entry, char *buffer, G_GNUC_UNUSED size_t length )
{ {
gchar **extras = g_strsplit ( buffer, "\x1f", -1 ); gchar **extras = g_strsplit ( buffer, "\x1f", -1 );
gchar **extra; gchar **extra;

View file

@ -992,7 +992,6 @@ int main ( int argc, char *argv[] )
} }
g_bytes_unref ( theme_data ); g_bytes_unref ( theme_data );
} }
rofi_theme_convert_old ();
} }
/** /**

View file

@ -1086,128 +1086,6 @@ gboolean rofi_theme_is_empty ( void )
return FALSE; return FALSE;
} }
#ifdef THEME_CONVERTER
static char * rofi_theme_convert_color ( char *col )
{
char *r = g_strstrip ( col );
if ( *r == '#' && strlen ( r ) == 9 ) {
char a1 = r[1];
char a2 = r[2];
r[1] = r[3];
r[2] = r[4];
r[3] = r[5];
r[4] = r[6];
r[5] = r[7];
r[6] = r[8];
r[7] = a1;
r[8] = a2;
}
return r;
}
void rofi_theme_convert_old ( void )
{
if ( config.color_window ) {
char **retv = g_strsplit ( config.color_window, ",", -1 );
const char * const conf[] = {
"* { background: %s; }",
"* { border-color: %s; }",
"* { separatorcolor: %s; }"
};
for ( int i = 0; retv && i < 3 && retv[i]; i++ ) {
char *str = g_strdup_printf ( conf[i], rofi_theme_convert_color ( retv[i] ) );
rofi_theme_parse_string ( str );
g_free ( str );
}
g_strfreev ( retv );
}
if ( config.color_normal ) {
char **retv = g_strsplit ( config.color_normal, ",", -1 );
const char * const conf[] = {
"* { normal-background: %s; }",
"* { foreground: %s; normal-foreground: @foreground; alternate-normal-foreground: @foreground; }",
"* { alternate-normal-background: %s; }",
"* { selected-normal-background: %s; }",
"* { selected-normal-foreground: %s; }"
};
for ( int i = 0; retv && retv[i] && i < 5; i++ ) {
char *str = g_strdup_printf ( conf[i], rofi_theme_convert_color ( retv[i] ) );
rofi_theme_parse_string ( str );
g_free ( str );
}
g_strfreev ( retv );
}
if ( config.color_urgent ) {
char **retv = g_strsplit ( config.color_urgent, ",", -1 );
const char * const conf[] = {
"* { urgent-background: %s; }",
"* { urgent-foreground: %s; alternate-urgent-foreground: @urgent-foreground;}",
"* { alternate-urgent-background: %s; }",
"* { selected-urgent-background: %s; }",
"* { selected-urgent-foreground: %s; }"
};
for ( int i = 0; retv && retv[i] && i < 5; i++ ) {
char *str = g_strdup_printf ( conf[i], rofi_theme_convert_color ( retv[i] ) );
rofi_theme_parse_string ( str );
g_free ( str );
}
g_strfreev ( retv );
}
if ( config.color_active ) {
char **retv = g_strsplit ( config.color_active, ",", -1 );
const char * const conf[] = {
"* { active-background: %s; }",
"* { active-foreground: %s; alternate-active-foreground: @active-foreground;}",
"* { alternate-active-background: %s; }",
"* { selected-active-background: %s; }",
"* { selected-active-foreground: %s; }"
};
for ( int i = 0; retv && retv[i] && i < 5; i++ ) {
char *str = g_strdup_printf ( conf[i], rofi_theme_convert_color ( retv[i] ) );
rofi_theme_parse_string ( str );
g_free ( str );
}
g_strfreev ( retv );
}
if ( config.separator_style != NULL ) {
if ( g_strcmp0 ( config.separator_style, "none" ) == 0 ) {
const char *const str = "#listview { border: 0px; }";
rofi_theme_parse_string ( str );
const char *const str2 = "#mode-switcher { border: 0px; }";
rofi_theme_parse_string ( str2 );
const char *const str3 = "#message { border: 0px; }";
rofi_theme_parse_string ( str3 );
}
else if ( g_strcmp0 ( config.separator_style, "solid" ) == 0 ) {
const char *const str = "#listview { border: 2px solid 0px 0px 0px; }";
rofi_theme_parse_string ( str );
const char *const str2 = "#mode-switcher { border: 2px solid 0px 0px 0px; }";
rofi_theme_parse_string ( str2 );
const char *const str3 = "#message { border: 2px solid 0px 0px 0px; }";
rofi_theme_parse_string ( str3 );
} /* dash is default */
}
if ( config.hide_scrollbar ) {
const char *str = "#listview { scrollbar: false; }";
rofi_theme_parse_string ( str );
}
else {
const char *str = "#listview { scrollbar: true; }";
rofi_theme_parse_string ( str );
char *str2 = g_strdup_printf ( "#scrollbar { handle-width: %dpx; }", config.scrollbar_width );
rofi_theme_parse_string ( str2 );
g_free ( str2 );
}
if ( config.fake_transparency ) {
char *str = g_strdup_printf ( "#window { transparency: \"%s\"; }", config.fake_background );
rofi_theme_parse_string ( str );
g_free ( str );
}
}
#endif // THEME_CONVERTER
char * rofi_theme_parse_prepare_file ( const char *file, const char *parent_file ) char * rofi_theme_parse_prepare_file ( const char *file, const char *parent_file )
{ {
char *filename = rofi_expand_path ( file ); char *filename = rofi_expand_path ( file );

View file

@ -192,14 +192,6 @@ static XrmOption xrmOptions[] = {
"Click outside the window to exit", CONFIG_DEFAULT }, "Click outside the window to exit", CONFIG_DEFAULT },
{ xrm_String, "theme", { .str = &config.theme }, NULL, { xrm_String, "theme", { .str = &config.theme }, NULL,
"New style theme file", CONFIG_DEFAULT }, "New style theme file", CONFIG_DEFAULT },
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
"Color scheme for normal row", CONFIG_DEFAULT },
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
"Color scheme for urgent row", CONFIG_DEFAULT },
{ xrm_String, "color-active", { .str = &config.color_active }, NULL,
"Color scheme for active row", CONFIG_DEFAULT },
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
"Color scheme window", CONFIG_DEFAULT },
{ xrm_Number, "max-history-size", { .num = &config.max_history_size }, NULL, { xrm_Number, "max-history-size", { .num = &config.max_history_size }, NULL,
"Max history size (WARNING: can cause slowdowns when set to high).", CONFIG_DEFAULT }, "Max history size (WARNING: can cause slowdowns when set to high).", CONFIG_DEFAULT },
{ xrm_Boolean, "combi-hide-mode-prefix", { .snum = &config.combi_hide_mode_prefix }, NULL, { xrm_Boolean, "combi-hide-mode-prefix", { .snum = &config.combi_hide_mode_prefix }, NULL,