You are not logged in.
Right now I have everything I need set up using the vi movement keys except for a system monitor. I like htop, but it uses those pesky arrow keys. Any ideas?
Offline
I bet there's a way to map the arrow keys themselves to hjkl + shift or something. I don't know though, using dvorak I couldn't really get used to them.
Personally, I'd rather be back in Hobbiton.
Offline
Finally found the settings in Panel.c and htop.c if anyone else is interested.
EDIT: made a patch
h/j/k/l = scroll
? = help
L = list open files with lsof
d = kill
diff -crB htop-0.8.3/htop.c htop-vi-0.8.3/htop.c
*** htop-0.8.3/htop.c 2009-06-23 09:45:09.000000000 -0400
--- htop-vi-0.8.3/htop.c 2010-03-16 05:53:04.000000000 -0400
***************
*** 104,116 ****
mvaddstr(7, 0, "In monochrome, meters are displayed through different chars, in order: |#*@$%&");
}
mvaddstr( 8, 0, " Status: R: running; S: sleeping; T: traced/stopped; Z: zombie; D: disk sleep");
! mvaddstr( 9, 0, " Arrows: scroll process list F5 t: tree view");
mvaddstr(10, 0, " Digits: incremental PID search u: show processes of a single user");
mvaddstr(11, 0, " F3 /: incremental name search H: hide/show user threads");
mvaddstr(12, 0, " K: hide/show kernel threads");
mvaddstr(13, 0, " Space: tag processes F: cursor follows process");
mvaddstr(14, 0, " U: untag all processes");
! mvaddstr(15, 0, " F9 k: kill process/tagged processes P: sort by CPU%");
mvaddstr(16, 0, " - ] F7: higher priority (root only) M: sort by MEM%");
mvaddstr(17, 0, " + [ F8: lower priority (+ nice) T: sort by TIME");
#ifdef HAVE_PLPA
--- 104,116 ----
mvaddstr(7, 0, "In monochrome, meters are displayed through different chars, in order: |#*@$%&");
}
mvaddstr( 8, 0, " Status: R: running; S: sleeping; T: traced/stopped; Z: zombie; D: disk sleep");
! mvaddstr( 9, 0, " h/j/k/l: scroll process list F5 t: tree view");
mvaddstr(10, 0, " Digits: incremental PID search u: show processes of a single user");
mvaddstr(11, 0, " F3 /: incremental name search H: hide/show user threads");
mvaddstr(12, 0, " K: hide/show kernel threads");
mvaddstr(13, 0, " Space: tag processes F: cursor follows process");
mvaddstr(14, 0, " U: untag all processes");
! mvaddstr(15, 0, " F9 d: kill process/tagged processes P: sort by CPU%");
mvaddstr(16, 0, " - ] F7: higher priority (root only) M: sort by MEM%");
mvaddstr(17, 0, " + [ F8: lower priority (+ nice) T: sort by TIME");
#ifdef HAVE_PLPA
***************
*** 120,136 ****
#endif
mvaddstr(18, 0, " F4 I: invert sort order");
mvaddstr(19, 0, " F2 S: setup F6 >: select sort column");
! mvaddstr(20, 0, " F1 h: show this help screen l: list open files with lsof");
mvaddstr(21, 0, " F10 q: quit s: trace syscalls with strace");
attrset(CRT_colors[HELP_BOLD]);
! mvaddstr( 9, 0, " Arrows"); mvaddstr( 9,40, " F5 t");
mvaddstr(10, 0, " Digits"); mvaddstr(10,40, " u");
mvaddstr(11, 0, " F3 /"); mvaddstr(11,40, " H");
mvaddstr(12,40, " K");
mvaddstr(13, 0, " Space"); mvaddstr(13,40, " F");
mvaddstr(14, 0, " U");
! mvaddstr(15, 0, " F9 k"); mvaddstr(15,40, " P");
mvaddstr(16, 0, " + [ F7"); mvaddstr(16,40, " M");
mvaddstr(17, 0, " - ] F8"); mvaddstr(17,40, " T");
mvaddstr(18,40, " F4 I");
--- 120,136 ----
#endif
mvaddstr(18, 0, " F4 I: invert sort order");
mvaddstr(19, 0, " F2 S: setup F6 >: select sort column");
! mvaddstr(20, 0, " F1 ?: show this help screen L: list open files with lsof");
mvaddstr(21, 0, " F10 q: quit s: trace syscalls with strace");
attrset(CRT_colors[HELP_BOLD]);
! mvaddstr( 9, 0, " h/j/k/l"); mvaddstr( 9,40, " F5 t");
mvaddstr(10, 0, " Digits"); mvaddstr(10,40, " u");
mvaddstr(11, 0, " F3 /"); mvaddstr(11,40, " H");
mvaddstr(12,40, " K");
mvaddstr(13, 0, " Space"); mvaddstr(13,40, " F");
mvaddstr(14, 0, " U");
! mvaddstr(15, 0, " F9 d"); mvaddstr(15,40, " P");
mvaddstr(16, 0, " + [ F7"); mvaddstr(16,40, " M");
mvaddstr(17, 0, " - ] F8"); mvaddstr(17,40, " T");
mvaddstr(18,40, " F4 I");
***************
*** 139,145 ****
mvaddstr(18, 0, " a:");
#endif
mvaddstr(19, 0, " F2 S"); mvaddstr(19,40, " F6 >");
! mvaddstr(20, 0, " F1 h"); mvaddstr(20,40, " l");
mvaddstr(21, 0, " F10 q"); mvaddstr(21,40, " s");
attrset(CRT_colors[DEFAULT_COLOR]);
--- 139,145 ----
mvaddstr(18, 0, " a:");
#endif
mvaddstr(19, 0, " F2 S"); mvaddstr(19,40, " F6 >");
! mvaddstr(20, 0, " F1 ?"); mvaddstr(20,40, " L");
mvaddstr(21, 0, " F10 q"); mvaddstr(21,40, " s");
attrset(CRT_colors[DEFAULT_COLOR]);
***************
*** 530,536 ****
break;
}
case KEY_F(1):
! case 'h':
{
showHelp(pl);
FunctionBar_draw(defaultBar, NULL);
--- 530,536 ----
break;
}
case KEY_F(1):
! case '?':
{
showHelp(pl);
FunctionBar_draw(defaultBar, NULL);
***************
*** 562,568 ****
CRT_enableDelay();
break;
}
! case 'l':
{
OpenFilesScreen* ts = OpenFilesScreen_new((Process*) Panel_getSelected(panel));
OpenFilesScreen_run(ts);
--- 562,568 ----
CRT_enableDelay();
break;
}
! case 'L':
{
OpenFilesScreen* ts = OpenFilesScreen_new((Process*) Panel_getSelected(panel));
OpenFilesScreen_run(ts);
***************
*** 613,619 ****
break;
}
case KEY_F(9):
! case 'k':
{
if (!killPanel) {
killPanel = (Panel*) SignalsPanel_new(0, 0, 0, 0);
--- 613,619 ----
break;
}
case KEY_F(9):
! case 'd':
{
if (!killPanel) {
killPanel = (Panel*) SignalsPanel_new(0, 0, 0, 0);
diff -crB htop-0.8.3/Panel.c htop-vi-0.8.3/Panel.c
*** htop-0.8.3/Panel.c 2009-06-02 15:17:57.000000000 -0400
--- htop-vi-0.8.3/Panel.c 2010-03-16 05:52:59.000000000 -0400
***************
*** 329,339 ****
bool Panel_onKey(Panel* this, int key) {
assert (this != NULL);
switch (key) {
! case KEY_DOWN:
if (this->selected + 1 < Vector_size(this->items))
this->selected++;
return true;
! case KEY_UP:
if (this->selected > 0)
this->selected--;
return true;
--- 329,339 ----
bool Panel_onKey(Panel* this, int key) {
assert (this != NULL);
switch (key) {
! case 'j':
if (this->selected + 1 < Vector_size(this->items))
this->selected++;
return true;
! case 'k':
if (this->selected > 0)
this->selected--;
return true;
***************
*** 359,371 ****
}
return true;
#endif
! case KEY_LEFT:
if (this->scrollH > 0) {
this->scrollH -= 5;
this->needsRedraw = true;
}
return true;
! case KEY_RIGHT:
this->scrollH += 5;
this->needsRedraw = true;
return true;
--- 359,371 ----
}
return true;
#endif
! case 'h':
if (this->scrollH > 0) {
this->scrollH -= 5;
this->needsRedraw = true;
}
return true;
! case 'l':
this->scrollH += 5;
this->needsRedraw = true;
return true;
Last edited by tjwoosta (2010-03-16 10:09:17)
Offline
Finally found the settings in Panel.c and htop.c if anyone else is interested.
EDIT: made a patch
h/j/k/l = scroll
? = help
L = list open files with lsof
d = killdiff -crB htop-0.8.3/htop.c htop-vi-0.8.3/htop.c *** htop-0.8.3/htop.c 2009-06-23 09:45:09.000000000 -0400 --- htop-vi-0.8.3/htop.c 2010-03-16 05:53:04.000000000 -0400 *************** *** 104,116 **** mvaddstr(7, 0, "In monochrome, meters are displayed through different chars, in order: |#*@$%&"); } mvaddstr( 8, 0, " Status: R: running; S: sleeping; T: traced/stopped; Z: zombie; D: disk sleep"); ! mvaddstr( 9, 0, " Arrows: scroll process list F5 t: tree view"); mvaddstr(10, 0, " Digits: incremental PID search u: show processes of a single user"); mvaddstr(11, 0, " F3 /: incremental name search H: hide/show user threads"); mvaddstr(12, 0, " K: hide/show kernel threads"); mvaddstr(13, 0, " Space: tag processes F: cursor follows process"); mvaddstr(14, 0, " U: untag all processes"); ! mvaddstr(15, 0, " F9 k: kill process/tagged processes P: sort by CPU%"); mvaddstr(16, 0, " - ] F7: higher priority (root only) M: sort by MEM%"); mvaddstr(17, 0, " + [ F8: lower priority (+ nice) T: sort by TIME"); #ifdef HAVE_PLPA --- 104,116 ---- mvaddstr(7, 0, "In monochrome, meters are displayed through different chars, in order: |#*@$%&"); } mvaddstr( 8, 0, " Status: R: running; S: sleeping; T: traced/stopped; Z: zombie; D: disk sleep"); ! mvaddstr( 9, 0, " h/j/k/l: scroll process list F5 t: tree view"); mvaddstr(10, 0, " Digits: incremental PID search u: show processes of a single user"); mvaddstr(11, 0, " F3 /: incremental name search H: hide/show user threads"); mvaddstr(12, 0, " K: hide/show kernel threads"); mvaddstr(13, 0, " Space: tag processes F: cursor follows process"); mvaddstr(14, 0, " U: untag all processes"); ! mvaddstr(15, 0, " F9 d: kill process/tagged processes P: sort by CPU%"); mvaddstr(16, 0, " - ] F7: higher priority (root only) M: sort by MEM%"); mvaddstr(17, 0, " + [ F8: lower priority (+ nice) T: sort by TIME"); #ifdef HAVE_PLPA *************** *** 120,136 **** #endif mvaddstr(18, 0, " F4 I: invert sort order"); mvaddstr(19, 0, " F2 S: setup F6 >: select sort column"); ! mvaddstr(20, 0, " F1 h: show this help screen l: list open files with lsof"); mvaddstr(21, 0, " F10 q: quit s: trace syscalls with strace"); attrset(CRT_colors[HELP_BOLD]); ! mvaddstr( 9, 0, " Arrows"); mvaddstr( 9,40, " F5 t"); mvaddstr(10, 0, " Digits"); mvaddstr(10,40, " u"); mvaddstr(11, 0, " F3 /"); mvaddstr(11,40, " H"); mvaddstr(12,40, " K"); mvaddstr(13, 0, " Space"); mvaddstr(13,40, " F"); mvaddstr(14, 0, " U"); ! mvaddstr(15, 0, " F9 k"); mvaddstr(15,40, " P"); mvaddstr(16, 0, " + [ F7"); mvaddstr(16,40, " M"); mvaddstr(17, 0, " - ] F8"); mvaddstr(17,40, " T"); mvaddstr(18,40, " F4 I"); --- 120,136 ---- #endif mvaddstr(18, 0, " F4 I: invert sort order"); mvaddstr(19, 0, " F2 S: setup F6 >: select sort column"); ! mvaddstr(20, 0, " F1 ?: show this help screen L: list open files with lsof"); mvaddstr(21, 0, " F10 q: quit s: trace syscalls with strace"); attrset(CRT_colors[HELP_BOLD]); ! mvaddstr( 9, 0, " h/j/k/l"); mvaddstr( 9,40, " F5 t"); mvaddstr(10, 0, " Digits"); mvaddstr(10,40, " u"); mvaddstr(11, 0, " F3 /"); mvaddstr(11,40, " H"); mvaddstr(12,40, " K"); mvaddstr(13, 0, " Space"); mvaddstr(13,40, " F"); mvaddstr(14, 0, " U"); ! mvaddstr(15, 0, " F9 d"); mvaddstr(15,40, " P"); mvaddstr(16, 0, " + [ F7"); mvaddstr(16,40, " M"); mvaddstr(17, 0, " - ] F8"); mvaddstr(17,40, " T"); mvaddstr(18,40, " F4 I"); *************** *** 139,145 **** mvaddstr(18, 0, " a:"); #endif mvaddstr(19, 0, " F2 S"); mvaddstr(19,40, " F6 >"); ! mvaddstr(20, 0, " F1 h"); mvaddstr(20,40, " l"); mvaddstr(21, 0, " F10 q"); mvaddstr(21,40, " s"); attrset(CRT_colors[DEFAULT_COLOR]); --- 139,145 ---- mvaddstr(18, 0, " a:"); #endif mvaddstr(19, 0, " F2 S"); mvaddstr(19,40, " F6 >"); ! mvaddstr(20, 0, " F1 ?"); mvaddstr(20,40, " L"); mvaddstr(21, 0, " F10 q"); mvaddstr(21,40, " s"); attrset(CRT_colors[DEFAULT_COLOR]); *************** *** 530,536 **** break; } case KEY_F(1): ! case 'h': { showHelp(pl); FunctionBar_draw(defaultBar, NULL); --- 530,536 ---- break; } case KEY_F(1): ! case '?': { showHelp(pl); FunctionBar_draw(defaultBar, NULL); *************** *** 562,568 **** CRT_enableDelay(); break; } ! case 'l': { OpenFilesScreen* ts = OpenFilesScreen_new((Process*) Panel_getSelected(panel)); OpenFilesScreen_run(ts); --- 562,568 ---- CRT_enableDelay(); break; } ! case 'L': { OpenFilesScreen* ts = OpenFilesScreen_new((Process*) Panel_getSelected(panel)); OpenFilesScreen_run(ts); *************** *** 613,619 **** break; } case KEY_F(9): ! case 'k': { if (!killPanel) { killPanel = (Panel*) SignalsPanel_new(0, 0, 0, 0); --- 613,619 ---- break; } case KEY_F(9): ! case 'd': { if (!killPanel) { killPanel = (Panel*) SignalsPanel_new(0, 0, 0, 0); diff -crB htop-0.8.3/Panel.c htop-vi-0.8.3/Panel.c *** htop-0.8.3/Panel.c 2009-06-02 15:17:57.000000000 -0400 --- htop-vi-0.8.3/Panel.c 2010-03-16 05:52:59.000000000 -0400 *************** *** 329,339 **** bool Panel_onKey(Panel* this, int key) { assert (this != NULL); switch (key) { ! case KEY_DOWN: if (this->selected + 1 < Vector_size(this->items)) this->selected++; return true; ! case KEY_UP: if (this->selected > 0) this->selected--; return true; --- 329,339 ---- bool Panel_onKey(Panel* this, int key) { assert (this != NULL); switch (key) { ! case 'j': if (this->selected + 1 < Vector_size(this->items)) this->selected++; return true; ! case 'k': if (this->selected > 0) this->selected--; return true; *************** *** 359,371 **** } return true; #endif ! case KEY_LEFT: if (this->scrollH > 0) { this->scrollH -= 5; this->needsRedraw = true; } return true; ! case KEY_RIGHT: this->scrollH += 5; this->needsRedraw = true; return true; --- 359,371 ---- } return true; #endif ! case 'h': if (this->scrollH > 0) { this->scrollH -= 5; this->needsRedraw = true; } return true; ! case 'l': this->scrollH += 5; this->needsRedraw = true; return true;
This is great! Perhaps your patched htop could be added to AUR and called htop-vi.
How's my programming? Call 1-800-DEV-NULL
Offline
Nice! +1 for AUR.
You're back to Arch already, zowki?
Last edited by JohannesSM64 (2010-03-17 10:49:21)
Offline
Nice! +1 for AUR.
You're back to Arch already, zowki?
I'm dual booting now
How's my programming? Call 1-800-DEV-NULL
Offline
This is great! Perhaps your patched htop could be added to AUR and called htop-vi.
done
also updated the patch to use arrows as well as hjkl
http://aur.archlinux.org/packages.php?ID=35620
Last edited by tjwoosta (2010-03-18 23:08:56)
Offline
Bravo @tjwoosta
Offline
@tjwoosta Do you use rtorrent? If so, have you found a way to use h,j,k,l with it?
Offline
Actually I do, and I already packaged it a few days ago.
Heres the link.
http://aur.archlinux.org/packages.php?ID=35642
also I believe the rtorrent-extended package now has an option that you can uncomment in the pkgbuild to allow the vi keys patch.
Offline