mirror of
https://github.com/davatorium/rofi.git
synced 2025-02-10 15:44:41 -05:00
Split MENU_QUICK_SWITCH into MENU_CUSTOM_COMMAND/QUICK_SWITCH
This commit is contained in:
parent
96cd34d24f
commit
6a38f88e98
4 changed files with 22 additions and 5 deletions
|
@ -77,6 +77,8 @@ typedef enum
|
|||
MENU_ENTRY_DELETE = 0x00100000,
|
||||
/** User wants to jump to another switcher. */
|
||||
MENU_QUICK_SWITCH = 0x00200000,
|
||||
/** User wants to jump to custom command. */
|
||||
MENU_CUSTOM_COMMAND= 0x00800000,
|
||||
/** Go to the previous menu. */
|
||||
MENU_PREVIOUS = 0x00400000,
|
||||
/** Bindings specifics */
|
||||
|
|
|
@ -575,14 +575,14 @@ static void dmenu_finalize ( RofiViewState *state )
|
|||
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 ) {
|
||||
g_free ( input );
|
||||
return;
|
||||
}
|
||||
dmenu_print_results ( pd, input );
|
||||
retv = TRUE;
|
||||
if ( ( mretv & MENU_QUICK_SWITCH ) ) {
|
||||
if ( ( mretv & MENU_CUSTOM_COMMAND ) ) {
|
||||
retv = 10 + ( mretv & MENU_LOWER_MASK );
|
||||
}
|
||||
g_free ( input );
|
||||
|
@ -640,7 +640,7 @@ static void dmenu_finalize ( RofiViewState *state )
|
|||
retv = TRUE;
|
||||
}
|
||||
// Quick switch with entry selected.
|
||||
else if ( ( mretv & MENU_QUICK_SWITCH ) ) {
|
||||
else if ( ( mretv & MENU_CUSTOM_COMMAND ) ) {
|
||||
dmenu_print_results ( pd, input );
|
||||
|
||||
restart = FALSE;
|
||||
|
|
|
@ -278,7 +278,22 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned
|
|||
DmenuScriptEntry *new_list = NULL;
|
||||
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 ) {
|
||||
return RELOAD_DIALOG;
|
||||
}
|
||||
|
|
|
@ -1300,7 +1300,7 @@ static void rofi_view_trigger_global_action ( KeyBindingAction action )
|
|||
if ( selected < state->filtered_lines ) {
|
||||
( 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;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue