diff options
Diffstat (limited to 'wavemon.c')
-rw-r--r-- | wavemon.c | 51 |
1 files changed, 41 insertions, 10 deletions
@@ -48,7 +48,7 @@ static const struct { .loop = scr_lhist_loop, .fini = scr_lhist_fini }, - [SCR_APLIST] = { + [SCR_SCAN] = { .key_name = "scan", .init = scr_aplst_init, .loop = scr_aplst_loop, @@ -63,7 +63,7 @@ static const struct { [SCR_EMPTY_F6] = { .key_name = "", }, - [SCR_CONF] = { + [SCR_PREFS] = { .key_name = "prefs", .init = scr_conf_init, .loop = scr_conf_loop, @@ -183,6 +183,7 @@ int main(int argc, char *argv[]) sigaddset(&blockmask, SIGWINCH); for (cur = conf.startup_scr; cur != SCR_QUIT; cur = next) { + int escape = 0; if (sigprocmask(SIG_BLOCK, &blockmask, &oldmask) < 0) err_sys("cannot block SIGWINCH"); @@ -202,24 +203,54 @@ int main(int argc, char *argv[]) if (key <= 0) usleep(5000); + /* + * Translate vt100 PF1..4 escape sequences sent + * by some X terminals (e.g. aterm) into F1..F4. + */ switch (key) { + case 033: + escape = 1; + break; + case 'O': + escape = 2; + break; + case 'P' ... 'S': + if (escape == 2) + key = KEY_F(key - 'P' + 1); + /* fall through */ + default: + escape = 0; + } + + /* Main menu */ + switch (key) { + case 'i': case KEY_F(1): + next = SCR_INFO; + break; + case 'l': case KEY_F(2): + next = SCR_LHIST; + break; + case 's': case KEY_F(3): + next = SCR_SCAN; + break; + case 'p': case KEY_F(7): + next = SCR_PREFS; + break; + case 'h': case KEY_F(8): - case KEY_F(9): - case KEY_F(10): - next = key - KEY_F(1); + next = SCR_HELP; break; - case 'i': - next = SCR_INFO; + case 'a': + case KEY_F(9): + next = SCR_ABOUT; break; case 'q': + case KEY_F(10): next = SCR_QUIT; - break; - default: - continue; } } while (next == cur); } |