summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-04-25 08:42:03 +0200
committerDave Davenport <qball@gmpclient.org>2016-04-25 08:42:03 +0200
commitae5a9aff917f995e9e05cd82b96f8b6c1dc56276 (patch)
tree6a8f084a7fd9345fb3515267a8e61b4cf978285d
parentdc4b2943f90b24a9507b01623d60c2ca66bd245b (diff)
Allow environment var in expand pathlive_update_view
-rw-r--r--include/textbox.h18
-rw-r--r--source/helper.c7
-rw-r--r--source/view.c3
3 files changed, 18 insertions, 10 deletions
diff --git a/include/textbox.h b/include/textbox.h
index 3d3b8d09..e1d608e1 100644
--- a/include/textbox.h
+++ b/include/textbox.h
@@ -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
diff --git a/source/helper.c b/source/helper.c
index a6767c0d..b307b951 100644
--- a/source/helper.c
+++ b/source/helper.c
@@ -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 ) {
diff --git a/source/view.c b/source/view.c
index df41300e..2bae92e9 100644
--- a/source/view.c
+++ b/source/view.c
@@ -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.