summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/dialogs/dmenu.c7
-rw-r--r--source/dialogs/script.c18
-rw-r--r--source/rofi.c76
-rw-r--r--source/view.c5
-rw-r--r--source/widgets/listview.c10
5 files changed, 97 insertions, 19 deletions
diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c
index 6322e3e3..219dc98a 100644
--- a/source/dialogs/dmenu.c
+++ b/source/dialogs/dmenu.c
@@ -664,6 +664,7 @@ int dmenu_switcher_dialog ( void )
find_arg ( "-selected-row" ) >= 0 ) {
async = FALSE;
}
+
// Check if the subsystem is setup for reading, otherwise do not read.
if ( pd->cancel != NULL ) {
if ( async ) {
@@ -732,6 +733,11 @@ int dmenu_switcher_dialog ( void )
}
find_arg_str ( "-p", &( dmenu_mode.display_name ) );
RofiViewState *state = rofi_view_create ( &dmenu_mode, input, menu_flags, dmenu_finalize );
+
+
+ if ( find_arg ( "-keep-right" ) >= 0 ) {
+ rofi_view_ellipsize_start ( state );
+ }
// @TODO we should do this better.
if ( async && ( pd->cancel != NULL ) ) {
rofi_view_set_overlay ( state, "Loading.. " );
@@ -764,4 +770,5 @@ void print_dmenu_options ( void )
print_help_msg ( "-sync", "", "Force dmenu to first read all input data, then show dialog.", NULL, is_term );
print_help_msg ( "-async-pre-read", "[number]", "Read several entries blocking before switching to async mode", "25", is_term );
print_help_msg ( "-w", "windowid", "Position over window with X11 windowid.", NULL, is_term );
+ print_help_msg ( "-keep-right", "", "Set ellipsize to end.", NULL, is_term );
}
diff --git a/source/dialogs/script.c b/source/dialogs/script.c
index 653a5726..c7cc6d70 100644
--- a/source/dialogs/script.c
+++ b/source/dialogs/script.c
@@ -69,6 +69,8 @@ typedef struct
char *prompt;
gboolean do_markup;
char delim;
+ /** no custom */
+ gboolean no_custom;
} ScriptModePrivateData;
/**
@@ -131,6 +133,8 @@ static void parse_header_entry ( Mode *sw, char *line, ssize_t length )
}
else if ( strcasecmp ( line, "delim" ) == 0 ) {
pd->delim = helper_parse_char ( value );
+ } else if ( strcasecmp ( line, "no-custom" ) == 0 ) {
+ pd->no_custom = ( strcasecmp ( value, "true") == 0 );
}
}
}
@@ -272,7 +276,11 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned
if ( selected_line != UINT32_MAX ) {
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line].entry, &new_length,10+( mretv & MENU_LOWER_MASK ) );
} else {
- new_list = execute_executor ( sw, *input, &new_length,10+( mretv & MENU_LOWER_MASK ) );
+ if ( rmpd->no_custom == FALSE ) {
+ new_list = execute_executor ( sw, *input, &new_length,10+( mretv & MENU_LOWER_MASK ) );
+ } else {
+ return RELOAD_DIALOG;
+ }
}
}
else if ( ( mretv & MENU_OK ) && rmpd->cmd_list[selected_line].entry != NULL ) {
@@ -283,8 +291,12 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line].entry, &new_length, 1 );
}
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
- script_mode_reset_highlight ( sw );
- new_list = execute_executor ( sw, *input, &new_length, 2 );
+ if ( rmpd->no_custom == FALSE ) {
+ script_mode_reset_highlight ( sw );
+ new_list = execute_executor ( sw, *input, &new_length, 2 );
+ } else {
+ return RELOAD_DIALOG;
+ }
}
// If a new list was generated, use that an loop around.
diff --git a/source/rofi.c b/source/rofi.c
index 156a9697..adafeb9d 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -299,7 +299,7 @@ static void print_main_application_options ( int is_term )
print_help_msg ( "-show", "[mode]", "Show the mode 'mode' and exit. The mode has to be enabled.", NULL, is_term );
print_help_msg ( "-no-lazy-grab", "", "Disable lazy grab that, when fail to grab keyboard, does not block but retry later.", NULL, is_term );
print_help_msg ( "-no-plugins", "", "Disable loading of external plugins.", NULL, is_term );
- print_help_msg ( "-plugin-path", "", "Directory used to search for rofi plugins.", NULL, is_term );
+ print_help_msg ( "-plugin-path", "", "Directory used to search for rofi plugins. *DEPRECATED*", NULL, is_term );
print_help_msg ( "-dump-config", "", "Dump the current configuration in rasi format and exit.", NULL, is_term );
print_help_msg ( "-upgrade-config", "", "Upgrade the old-style configuration fiel in the new rasi format and exit.", NULL, is_term );
print_help_msg ( "-dump-theme", "", "Dump the current theme in rasi format and exit.", NULL, is_term );
@@ -514,6 +514,7 @@ static gboolean rofi_collect_modi_add ( Mode *mode )
static void rofi_collect_modi_dir ( const char *base_dir )
{
+ g_debug ( "Looking into: %s for plugins", base_dir );
GDir *dir = g_dir_open ( base_dir, 0, NULL );
if ( dir ) {
const char *dn = NULL;
@@ -522,6 +523,7 @@ static void rofi_collect_modi_dir ( const char *base_dir )
continue;
}
char *fn = g_build_filename ( base_dir, dn, NULL );
+ g_debug ( "Trying to open: %s plugin", fn );
GModule *mod = g_module_open ( fn, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL );
if ( mod ) {
Mode *m = NULL;
@@ -573,6 +575,15 @@ static void rofi_collect_modi ( void )
find_arg_str ( "-plugin-path", &( config.plugin_path ) );
g_debug ( "Parse plugin path: %s", config.plugin_path );
rofi_collect_modi_dir ( config.plugin_path );
+ /* ROFI_PLUGIN_PATH */
+ const char *path = g_getenv("ROFI_PLUGIN_PATH");
+ if ( path != NULL ) {
+ gchar ** paths = g_strsplit ( path, ":", -1 );
+ for ( unsigned int i = 0; paths[i]; i++ ) {
+ rofi_collect_modi_dir ( paths[i] );
+ }
+ g_strfreev ( paths );
+ }
}
}
@@ -868,24 +879,55 @@ int main ( int argc, char *argv[] )
TICK_N ( "Setup abe" );
if ( find_arg ( "-no-config" ) < 0 ) {
- gchar *etc = g_build_filename ( SYSCONFDIR, "rofi.rasi", NULL );
- g_debug ( "Testing: %s", etc );
- if ( g_file_test ( etc, G_FILE_TEST_IS_REGULAR ) ) {
- g_debug ( "Parsing: %s", etc );
- rofi_theme_parse_file ( etc );
+ // Load distro default settings
+ gboolean found_system = FALSE;
+ const char * const * dirs = g_get_system_config_dirs();
+ if ( dirs )
+ {
+ for ( unsigned int i =0; !found_system && dirs[i]; i++ ) {
+ /** New format. */
+ gchar *etc = g_build_filename ( dirs[i], "rofi.rasi", NULL );
+ g_debug ( "Look for default config file: %s", etc );
+ if ( g_file_test ( etc, G_FILE_TEST_IS_REGULAR ) ) {
+ g_debug ( "Parsing: %s", etc );
+ rofi_theme_parse_file ( etc );
+ found_system = TRUE;
+ } else {
+ /** Old format. */
+ gchar *xetc = g_build_filename ( dirs[i], "rofi.conf", NULL );
+ g_debug ( "Look for default config file: %s", xetc );
+ if ( g_file_test ( xetc, G_FILE_TEST_IS_REGULAR ) ) {
+ config_parse_xresource_options_file ( xetc );
+ old_config_format = TRUE;
+ found_system = TRUE;
+ }
+ g_free ( xetc );
+ }
+ g_free ( etc );
+ }
}
- else {
- // Load distro default settings
- gchar *xetc = g_build_filename ( SYSCONFDIR, "rofi.conf", NULL );
- if ( g_file_test ( xetc, G_FILE_TEST_IS_REGULAR ) ) {
- config_parse_xresource_options_file ( xetc );
- old_config_format = TRUE;
+ if ( ! found_system ) {
+ /** New format. */
+ gchar *etc = g_build_filename ( SYSCONFDIR, "rofi.rasi", NULL );
+ g_debug ( "Look for default config file: %s", etc );
+ if ( g_file_test ( etc, G_FILE_TEST_IS_REGULAR ) ) {
+ g_debug ( "Look for default config file: %s", etc );
+ rofi_theme_parse_file ( etc );
+ } else {
+ /** Old format. */
+ gchar *xetc = g_build_filename ( SYSCONFDIR, "rofi.conf", NULL );
+ g_debug ( "Look for default config file: %s", xetc );
+ if ( g_file_test ( xetc, G_FILE_TEST_IS_REGULAR ) ) {
+ config_parse_xresource_options_file ( xetc );
+ old_config_format = TRUE;
+ }
+ g_free ( xetc );
}
- g_free ( xetc );
+ g_free ( etc );
}
- g_free ( etc );
// Load in config from X resources.
config_parse_xresource_options ( xcb );
+
if ( config_path_new && g_file_test ( config_path_new, G_FILE_TEST_IS_REGULAR ) ) {
if ( rofi_theme_parse_file ( config_path_new ) ) {
rofi_theme_free ( rofi_theme );
@@ -895,8 +937,10 @@ int main ( int argc, char *argv[] )
else {
g_free ( config_path_new );
config_path_new = NULL;
- config_parse_xresource_options_file ( config_path );
- old_config_format = TRUE;
+ if ( g_file_test ( config_path, G_FILE_TEST_IS_REGULAR ) ) {
+ config_parse_xresource_options_file ( config_path );
+ old_config_format = TRUE;
+ }
}
}
find_arg_str ( "-theme", &( config.theme ) );
diff --git a/source/view.c b/source/view.c
index 6ccb4474..1a808d54 100644
--- a/source/view.c
+++ b/source/view.c
@@ -1999,6 +1999,11 @@ void rofi_view_clear_input ( RofiViewState *state )
}
}
+void rofi_view_ellipsize_start ( RofiViewState *state )
+{
+ listview_set_ellipsize_start ( state->list_view );
+}
+
void rofi_view_switch_mode ( RofiViewState *state, Mode *mode )
{
state->sw = mode;
diff --git a/source/widgets/listview.c b/source/widgets/listview.c
index 8739a846..e77438c0 100644
--- a/source/widgets/listview.c
+++ b/source/widgets/listview.c
@@ -971,6 +971,16 @@ void listview_set_fixed_num_lines ( listview *lv )
}
}
+void listview_set_ellipsize_start ( listview *lv )
+{
+ if ( lv ) {
+ lv->emode = PANGO_ELLIPSIZE_START;
+ for ( unsigned int i = 0; i < lv->cur_elements; i++ ) {
+ textbox_set_ellipsize ( lv->boxes[i].textbox, lv->emode );
+ }
+ }
+}
+
void listview_toggle_ellipsizing ( listview *lv )
{
if ( lv ) {