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

Allow environment var in expand path

This commit is contained in:
Dave Davenport 2016-04-25 08:42:03 +02:00
parent dc4b2943f9
commit ae5a9aff91
3 changed files with 18 additions and 10 deletions

View file

@ -38,15 +38,15 @@ typedef struct
typedef enum
{
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_PASSWORD = 1 << 22,
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_PASSWORD = 1 << 22,
} TextboxFlags;
typedef enum

View file

@ -616,6 +616,13 @@ char *rofi_expand_path ( const char *input )
str[i] = g_strdup ( p->pw_dir );
}
}
else if ( str[i][0] == '$' ) {
const char *v = g_getenv ( &( str[i][1] ) );
if ( v != NULL ) {
g_free ( str[i] );
str[i] = g_strdup ( v );
}
}
else if ( i == 0 ) {
char * s = str[i];
if ( input[0] == G_DIR_SEPARATOR ) {

View file

@ -637,7 +637,8 @@ static void rofi_view_calculate_rows_columns ( RofiViewState *state )
// If it would fit in one column, only use one column.
if ( state->num_lines < state->max_elements ) {
state->columns =
MAX(1, ( state->num_lines + ( state->max_rows - state->num_lines % state->max_rows ) % state->max_rows ) / state->max_rows);
MAX ( 1,
( state->num_lines + ( state->max_rows - state->num_lines % state->max_rows ) % state->max_rows ) / state->max_rows );
state->max_elements = state->menu_lines * state->columns;
}
// Sanitize.