You are not logged in.

#1 2010-03-16 01:04:14

tjwoosta
Member
Registered: 2008-12-18
Posts: 453

Anyone know a system monitor with vi movement keys?

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

#2 2010-03-16 01:18:06

Anikom15
Banned
From: United States
Registered: 2009-04-30
Posts: 836
Website

Re: Anyone know a system monitor with vi movement keys?

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

#3 2010-03-16 09:06:46

tjwoosta
Member
Registered: 2008-12-18
Posts: 453

Re: Anyone know a system monitor with vi movement keys?

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

#4 2010-03-17 05:35:38

zowki
Member
From: Trapped in The Matrix
Registered: 2008-11-27
Posts: 582
Website

Re: Anyone know a system monitor with vi movement keys?

tjwoosta wrote:

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;

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

#5 2010-03-17 10:46:56

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: Anyone know a system monitor with vi movement keys?

Nice! +1 for AUR.






You're back to Arch already, zowki? tongue

Last edited by JohannesSM64 (2010-03-17 10:49:21)

Offline

#6 2010-03-17 11:02:34

zowki
Member
From: Trapped in The Matrix
Registered: 2008-11-27
Posts: 582
Website

Re: Anyone know a system monitor with vi movement keys?

JohannesSM64 wrote:

Nice! +1 for AUR.






You're back to Arch already, zowki? tongue

I'm dual booting now


How's my programming? Call 1-800-DEV-NULL

Offline

#7 2010-03-18 23:08:06

tjwoosta
Member
Registered: 2008-12-18
Posts: 453

Re: Anyone know a system monitor with vi movement keys?

zowki wrote:

This is great! Perhaps your patched htop could be added to AUR and called htop-vi.

done smile

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

#8 2010-03-18 23:36:29

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: Anyone know a system monitor with vi movement keys?

Bravo @tjwoosta

Offline

#9 2010-03-19 16:28:55

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: Anyone know a system monitor with vi movement keys?

Open source ftw :3 *installing*

Offline

#10 2010-03-19 17:17:05

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Anyone know a system monitor with vi movement keys?

awesome.  well done.

Offline

#11 2010-03-21 21:33:46

steve___
Member
Registered: 2008-02-24
Posts: 452

Re: Anyone know a system monitor with vi movement keys?

@tjwoosta  Do you use rtorrent?  If so, have you found a way to use h,j,k,l with it?

Offline

#12 2010-03-21 21:45:46

tjwoosta
Member
Registered: 2008-12-18
Posts: 453

Re: Anyone know a system monitor with vi movement keys?

Actually I do, and I already packaged it a few days ago. smile

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

Board footer

Powered by FluxBB