mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
small cleanup
This commit is contained in:
parent
424cb90a18
commit
6bb615f1d1
4 changed files with 15 additions and 8 deletions
|
@ -12,11 +12,12 @@ typedef enum {
|
|||
WINDOW_SWITCHER,
|
||||
RUN_DIALOG,
|
||||
SSH_DIALOG,
|
||||
MODE_EXIT
|
||||
NUM_DIALOGS,
|
||||
MODE_EXIT,
|
||||
NEXT_DIALOG
|
||||
} SwitcherMode;
|
||||
|
||||
|
||||
|
||||
typedef int ( *menu_match_cb )( char **tokens, const char *input, int index, void *data );
|
||||
int menu( char **lines, char **input, char *prompt,
|
||||
int selected, Time *time, int *shift, menu_match_cb mmc, void *mmc_data );
|
||||
|
|
|
@ -256,7 +256,7 @@ SwitcherMode run_switcher_dialog ( char **input )
|
|||
int n = menu( cmd_list, input, "$ ", 0, NULL, &shift,token_match, NULL );
|
||||
|
||||
if ( n == -2 ) {
|
||||
retv = SSH_DIALOG;
|
||||
retv = NEXT_DIALOG;
|
||||
} else if ( n >=0 && cmd_list[n] != NULL ) {
|
||||
exec_cmd( cmd_list[n], shift );
|
||||
} else if ( n == -3 && *input != NULL && *input[0] != '\0' ) {
|
||||
|
|
|
@ -1097,7 +1097,7 @@ SwitcherMode run_switcher_window ( char **input )
|
|||
int n = menu( list, input, "> ", 0, &time, NULL,window_match, ids );
|
||||
|
||||
if ( n == -2 ) {
|
||||
retv = RUN_DIALOG;
|
||||
retv = NEXT_DIALOG;
|
||||
} else if ( n >= 0 && list[n] ) {
|
||||
#ifdef I3
|
||||
|
||||
|
@ -1142,12 +1142,18 @@ void run_switcher( int fmode, SwitcherMode mode )
|
|||
char *input = NULL;
|
||||
|
||||
do {
|
||||
SwitcherMode retv = MODE_EXIT;
|
||||
if ( mode == WINDOW_SWITCHER ) {
|
||||
mode = run_switcher_window( &input );
|
||||
retv = run_switcher_window( &input );
|
||||
} else if ( mode == RUN_DIALOG ) {
|
||||
mode = run_switcher_dialog( &input );
|
||||
retv = run_switcher_dialog( &input );
|
||||
} else if ( mode == SSH_DIALOG ) {
|
||||
mode = ssh_switcher_dialog( &input );
|
||||
retv = ssh_switcher_dialog( &input );
|
||||
}
|
||||
if(retv == NEXT_DIALOG) {
|
||||
mode = (mode+1)%NUM_DIALOGS;
|
||||
} else {
|
||||
mode = retv;
|
||||
}
|
||||
} while ( mode != MODE_EXIT );
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ SwitcherMode ssh_switcher_dialog ( char **input )
|
|||
int n = menu( cmd_list, input, "ssh ", 0, NULL, &shift,token_match, NULL );
|
||||
|
||||
if ( n == -2 ) {
|
||||
retv = WINDOW_SWITCHER;
|
||||
retv = NEXT_DIALOG;
|
||||
} else if ( n >=0 && cmd_list[n] != NULL ) {
|
||||
exec_ssh( cmd_list[n] );
|
||||
} else if ( n == -3 && *input != NULL && *input[0] != '\0' ) {
|
||||
|
|
Loading…
Reference in a new issue