mirror of
https://github.com/lbonn/rofi
synced 2024-11-27 06:10:30 +00:00
Load theme-str after loading fallback themes.
* If no theme loaded, try converting old theme. * If still no theme loaded, try default theme. * Then load modifications (theme-str option)
This commit is contained in:
parent
d33edaf09d
commit
07076d154a
3 changed files with 25 additions and 19 deletions
|
@ -838,16 +838,10 @@ int main ( int argc, char *argv[] )
|
|||
TICK_N ( "Setup Modi" );
|
||||
}
|
||||
|
||||
const char ** theme_str = find_arg_strv ( "-theme-str" );
|
||||
if ( theme_str ) {
|
||||
for ( int index = 0; theme_str && theme_str[index]; index++ ) {
|
||||
if ( rofi_theme_parse_string ( theme_str[index] ) ) {
|
||||
rofi_theme_free ( rofi_theme );
|
||||
rofi_theme = NULL;
|
||||
}
|
||||
}
|
||||
g_free ( theme_str );
|
||||
if ( rofi_theme_is_empty ( ) ) {
|
||||
rofi_theme_convert_old ();
|
||||
}
|
||||
|
||||
if ( rofi_theme_is_empty ( ) ) {
|
||||
if ( rofi_theme_parse_string ( default_theme ) ) {
|
||||
g_warning ( "Failed to parse default theme. Giving up.." );
|
||||
|
@ -862,7 +856,19 @@ int main ( int argc, char *argv[] )
|
|||
cleanup ();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
rofi_theme_convert_old ();
|
||||
}
|
||||
/**
|
||||
* Make small commandline changes to the current theme.
|
||||
*/
|
||||
const char ** theme_str = find_arg_strv ( "-theme-str" );
|
||||
if ( theme_str ) {
|
||||
for ( int index = 0; theme_str && theme_str[index]; index++ ) {
|
||||
if ( rofi_theme_parse_string ( theme_str[index] ) ) {
|
||||
rofi_theme_free ( rofi_theme );
|
||||
rofi_theme = NULL;
|
||||
}
|
||||
}
|
||||
g_free ( theme_str );
|
||||
}
|
||||
|
||||
if ( find_arg ( "-dump-theme" ) >= 0 ) {
|
||||
|
|
|
@ -164,17 +164,17 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p
|
|||
switch ( p->type )
|
||||
{
|
||||
case P_LIST:
|
||||
printf ("[ ");
|
||||
printf ( "[ " );
|
||||
for ( GList *iter = p->value.list; iter != NULL; iter = g_list_next ( iter ) ) {
|
||||
printf("%s", (char*)(iter->data));
|
||||
printf ( "%s", (char *) ( iter->data ) );
|
||||
if ( iter->next != NULL ) {
|
||||
printf(",");
|
||||
printf ( "," );
|
||||
}
|
||||
}
|
||||
printf (" ];");
|
||||
printf ( " ];" );
|
||||
break;
|
||||
case P_ORIENTATION:
|
||||
printf("%s;", (p->value.i == ROFI_ORIENTATION_HORIZONTAL)? "horizontal":"vertical" );
|
||||
printf ( "%s;", ( p->value.i == ROFI_ORIENTATION_HORIZONTAL ) ? "horizontal" : "vertical" );
|
||||
break;
|
||||
case P_HIGHLIGHT:
|
||||
if ( p->value.highlight.style & ROFI_HL_BOLD ) {
|
||||
|
@ -624,7 +624,7 @@ GList *rofi_theme_get_list ( const widget *widget, const char * property, const
|
|||
Property *p = rofi_theme_find_property ( wid2, P_LIST, property, TRUE );
|
||||
if ( p ) {
|
||||
if ( p->type == P_LIST ) {
|
||||
return g_list_copy_deep ( p->value.list, (GCopyFunc)g_strdup, NULL );
|
||||
return g_list_copy_deep ( p->value.list, (GCopyFunc) g_strdup, NULL );
|
||||
}
|
||||
}
|
||||
char **r = defaults ? g_strsplit ( defaults, ",", 0 ) : NULL;
|
||||
|
|
|
@ -420,7 +420,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
|
|||
int bottom = widget_padding_get_bottom ( WIDGET ( tb ) );
|
||||
top = ( tb->widget.h - bottom - height - top ) * tb->yalign + top;
|
||||
}
|
||||
y+=top;
|
||||
y += top;
|
||||
|
||||
// draw Icon
|
||||
if ( ( tb->flags & TB_ICON ) == TB_ICON && tb->icon != NULL ) {
|
||||
|
@ -447,8 +447,8 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
|
|||
}
|
||||
else if ( tb->flags & TB_CENTER ) {
|
||||
int tw = textbox_get_font_width ( tb );
|
||||
x = ( ( tb->widget.w - tw - widget_padding_get_padding_width ( WIDGET ( tb ) ) - offset ) ) / 2;
|
||||
x += widget_padding_get_left ( WIDGET (tb) ) ;
|
||||
x = ( ( tb->widget.w - tw - widget_padding_get_padding_width ( WIDGET ( tb ) ) - offset ) ) / 2;
|
||||
x += widget_padding_get_left ( WIDGET ( tb ) );
|
||||
}
|
||||
// TODO check if this is still needed after flatning.
|
||||
cairo_set_operator ( draw, CAIRO_OPERATOR_OVER );
|
||||
|
|
Loading…
Reference in a new issue