mirror of https://github.com/davatorium/rofi.git
Split MENU_QUICK_SWITCH into MENU_CUSTOM_COMMAND/QUICK_SWITCH
This commit is contained in:
parent
96cd34d24f
commit
6a38f88e98
|
@ -77,6 +77,8 @@ typedef enum
|
||||||
MENU_ENTRY_DELETE = 0x00100000,
|
MENU_ENTRY_DELETE = 0x00100000,
|
||||||
/** User wants to jump to another switcher. */
|
/** User wants to jump to another switcher. */
|
||||||
MENU_QUICK_SWITCH = 0x00200000,
|
MENU_QUICK_SWITCH = 0x00200000,
|
||||||
|
/** User wants to jump to custom command. */
|
||||||
|
MENU_CUSTOM_COMMAND= 0x00800000,
|
||||||
/** Go to the previous menu. */
|
/** Go to the previous menu. */
|
||||||
MENU_PREVIOUS = 0x00400000,
|
MENU_PREVIOUS = 0x00400000,
|
||||||
/** Bindings specifics */
|
/** Bindings specifics */
|
||||||
|
|
|
@ -575,14 +575,14 @@ static void dmenu_finalize ( RofiViewState *state )
|
||||||
rofi_view_set_overlay ( state, NULL );
|
rofi_view_set_overlay ( state, NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( ( mretv & ( MENU_OK | MENU_QUICK_SWITCH ) ) && cmd_list[pd->selected_line].entry != NULL ) {
|
else if ( ( mretv & ( MENU_OK | MENU_CUSTOM_COMMAND ) ) && cmd_list[pd->selected_line].entry != NULL ) {
|
||||||
if ( cmd_list[pd->selected_line].nonselectable == TRUE ) {
|
if ( cmd_list[pd->selected_line].nonselectable == TRUE ) {
|
||||||
g_free ( input );
|
g_free ( input );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dmenu_print_results ( pd, input );
|
dmenu_print_results ( pd, input );
|
||||||
retv = TRUE;
|
retv = TRUE;
|
||||||
if ( ( mretv & MENU_QUICK_SWITCH ) ) {
|
if ( ( mretv & MENU_CUSTOM_COMMAND ) ) {
|
||||||
retv = 10 + ( mretv & MENU_LOWER_MASK );
|
retv = 10 + ( mretv & MENU_LOWER_MASK );
|
||||||
}
|
}
|
||||||
g_free ( input );
|
g_free ( input );
|
||||||
|
@ -640,7 +640,7 @@ static void dmenu_finalize ( RofiViewState *state )
|
||||||
retv = TRUE;
|
retv = TRUE;
|
||||||
}
|
}
|
||||||
// Quick switch with entry selected.
|
// Quick switch with entry selected.
|
||||||
else if ( ( mretv & MENU_QUICK_SWITCH ) ) {
|
else if ( ( mretv & MENU_CUSTOM_COMMAND ) ) {
|
||||||
dmenu_print_results ( pd, input );
|
dmenu_print_results ( pd, input );
|
||||||
|
|
||||||
restart = FALSE;
|
restart = FALSE;
|
||||||
|
|
|
@ -278,7 +278,22 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned
|
||||||
DmenuScriptEntry *new_list = NULL;
|
DmenuScriptEntry *new_list = NULL;
|
||||||
unsigned int new_length = 0;
|
unsigned int new_length = 0;
|
||||||
|
|
||||||
if ( ( mretv & MENU_OK ) && rmpd->cmd_list[selected_line].entry != NULL ) {
|
if ( ( mretv & MENU_CUSTOM_COMMAND ) ) {
|
||||||
|
//retv = 1+( mretv & MENU_LOWER_MASK );
|
||||||
|
script_mode_reset_highlight ( sw );
|
||||||
|
if ( selected_line != UINT32_MAX ) {
|
||||||
|
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line].entry, &new_length, 10 + ( mretv & MENU_LOWER_MASK ), &( rmpd->cmd_list[selected_line] ) );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( rmpd->no_custom == FALSE ) {
|
||||||
|
new_list = execute_executor ( sw, *input, &new_length, 10 + ( mretv & MENU_LOWER_MASK ), NULL );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return RELOAD_DIALOG;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( ( mretv & MENU_OK ) && rmpd->cmd_list[selected_line].entry != NULL ) {
|
||||||
if ( rmpd->cmd_list[selected_line].nonselectable ) {
|
if ( rmpd->cmd_list[selected_line].nonselectable ) {
|
||||||
return RELOAD_DIALOG;
|
return RELOAD_DIALOG;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1300,7 +1300,7 @@ static void rofi_view_trigger_global_action ( KeyBindingAction action )
|
||||||
if ( selected < state->filtered_lines ) {
|
if ( selected < state->filtered_lines ) {
|
||||||
( state->selected_line ) = state->line_map[selected];
|
( state->selected_line ) = state->line_map[selected];
|
||||||
}
|
}
|
||||||
state->retv = MENU_QUICK_SWITCH | ( ( action - CUSTOM_1 ) & MENU_LOWER_MASK );
|
state->retv = MENU_CUSTOM_COMMAND | ( ( action - CUSTOM_1 ) & MENU_LOWER_MASK );
|
||||||
state->quit = TRUE;
|
state->quit = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue