[DMenu] make rofi obey the dmenu -w flag.

- This is a dirty hack that needs to be done better in next release.
This commit is contained in:
Dave Davenport 2017-07-13 08:21:15 +02:00
parent 7b57985203
commit bca01f389d
2 changed files with 14 additions and 1 deletions

View File

@ -656,6 +656,7 @@ int dmenu_switcher_dialog ( void )
MenuFlags menu_flags = MENU_NORMAL;
DmenuModePrivateData *pd = (DmenuModePrivateData *) dmenu_mode.private_data;
int async = TRUE;
// For now these only work in sync mode.
if ( find_arg ( "-sync" ) >= 0 || find_arg ( "-dump" ) >= 0 || find_arg ( "-select" ) >= 0
|| find_arg ( "-no-custom" ) >= 0 || find_arg ( "-only-match" ) >= 0 || config.auto_select ||
@ -757,4 +758,5 @@ void print_dmenu_options ( void )
print_help_msg ( "-input", "[filename]", "Read input from file instead from standard input.", NULL, is_term );
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 );
}

View File

@ -855,6 +855,8 @@ int main ( int argc, char *argv[] )
parse_keys_abe ( bindings );
/** dirty hack for dmenu compatibility */
char *windowid = NULL;
if ( !dmenu_mode ) {
// setup_modi
if ( setup_modi () ) {
@ -863,7 +865,13 @@ int main ( int argc, char *argv[] )
}
TICK_N ( "Setup Modi" );
}
else {
// Hack for dmenu compatibility.
if ( find_arg_str ( "-w", &windowid ) == TRUE ) {
config.monitor = g_strdup_printf ( "wid:%s", windowid );
windowid = config.monitor;
}
}
if ( rofi_theme_is_empty ( ) ) {
if ( rofi_theme_parse_string ( default_theme ) ) {
g_warning ( "Failed to parse default theme. Giving up.." );
@ -951,5 +959,8 @@ int main ( int argc, char *argv[] )
g_main_loop_run ( main_loop );
teardown ( pfd );
cleanup ();
/* dirty hack */
g_free ( windowid );
return return_code;
}