Allow alt-1t/m9 be re-bound.

This commit is contained in:
QC 2015-05-05 19:30:43 +02:00
parent 04f39841c9
commit 13eee4571c
4 changed files with 98 additions and 11 deletions

View file

@ -23,6 +23,15 @@ typedef enum _KeyBindingAction
MODE_PREVIOUS,
TOGGLE_CASE_SENSITIVITY,
DELETE_ENTRY,
CUSTOM_1,
CUSTOM_2,
CUSTOM_3,
CUSTOM_4,
CUSTOM_5,
CUSTOM_6,
CUSTOM_7,
CUSTOM_8,
CUSTOM_9,
NUM_ABE
} KeyBindingAction;

View file

@ -203,7 +203,7 @@ int dmenu_switcher_dialog ( char **input )
fflush ( stdout );
restart = FALSE;
retv = 10+ ( mretv & MENU_LOWER_MASK ) ;
retv = 10 + ( mretv & MENU_LOWER_MASK );
}
} while ( restart );

View file

@ -136,7 +136,52 @@ DefaultBinding bindings[NUM_ABE] =
.id = DELETE_ENTRY,
.name = "kb-delete-entry",
.keybinding = "Shift+Delete"
}
},
{
.id = CUSTOM_1,
.name = "kb-custom-1",
.keybinding = "Alt+1"
},
{
.id = CUSTOM_2,
.name = "kb-custom-2",
.keybinding = "Alt+2"
},
{
.id = CUSTOM_3,
.name = "kb-custom-3",
.keybinding = "Alt+3"
},
{
.id = CUSTOM_4,
.name = "kb-custom-4",
.keybinding = "Alt+4"
},
{
.id = CUSTOM_5,
.name = "kb-custom-5",
.keybinding = "Alt+5"
},
{
.id = CUSTOM_6,
.name = "kb-custom-6",
.keybinding = "Alt+6"
},
{
.id = CUSTOM_7,
.name = "kb-custom-7",
.keybinding = "Alt+7"
},
{
.id = CUSTOM_8,
.name = "kb-custom-8",
.keybinding = "Alt+8"
},
{
.id = CUSTOM_9,
.name = "kb-custom-9",
.keybinding = "Alt+9"
},
};

View file

@ -1177,15 +1177,48 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
textbox_hide ( state.case_indicator );
}
}
// Switcher short-cut
else if ( ( ( ev.xkey.state & Mod1Mask ) == Mod1Mask ) &&
key >= XK_1 && key <= XK_9 ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
//*( state.selected_line ) = ( key - XK_1 );
unsigned int data = ( key - XK_1 );
state.retv = MENU_QUICK_SWITCH | ( data & MENU_LOWER_MASK );
else if ( abe_test_action ( CUSTOM_1, ev.xkey.state, key ) ) {
state.retv = MENU_QUICK_SWITCH | ( 0 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_2, ev.xkey.state, key ) ) {
state.retv = MENU_QUICK_SWITCH | ( 1 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_3, ev.xkey.state, key ) ) {
state.retv = MENU_QUICK_SWITCH | ( 2 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_4, ev.xkey.state, key ) ) {
state.retv = MENU_QUICK_SWITCH | ( 3 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_5, ev.xkey.state, key ) ) {
state.retv = MENU_QUICK_SWITCH | ( 4 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_6, ev.xkey.state, key ) ) {
state.retv = MENU_QUICK_SWITCH | ( 5 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_7, ev.xkey.state, key ) ) {
state.retv = MENU_QUICK_SWITCH | ( 6 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_8, ev.xkey.state, key ) ) {
state.retv = MENU_QUICK_SWITCH | ( 7 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_9, ev.xkey.state, key ) ) {
state.retv = MENU_QUICK_SWITCH | ( 8 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}