diff options
author | Connor Prussin | 2017-08-15 11:22:46 -0700 |
---|---|---|
committer | Connor Prussin | 2017-08-15 11:33:44 -0700 |
commit | 360842973a45d540c51001963d40d7fd5ef0fa1e (patch) | |
tree | 4757a0635fd609ed10dd7ca4a3e52ebf968ea6cf | |
download | aur-360842973a45d540c51001963d40d7fd5ef0fa1e.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 29 | ||||
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | PKGBUILD | 89 | ||||
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | solarized-colors.patch | 108 | ||||
-rw-r--r-- | vim-keybindings-common.patch | 182 | ||||
-rw-r--r-- | vim-keybindings-d-for-kill.patch | 20 | ||||
-rw-r--r-- | vim-keybindings-x-for-kill.patch | 20 |
8 files changed, 460 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..bf034815dc82 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,29 @@ +pkgbase = htop-vim-solarized + pkgdesc = Interactive process viewer with solarized and vim keybindings patch + pkgver = 2.0.2 + pkgrel = 1 + url = https://github.com/cprussin/htop-vim-solarized + arch = i686 + arch = x86_64 + license = GPL + makedepends = git + makedepends = python2 + depends = ncurses + optdepends = lsof: show files opened by a process + optdepends = strace: attach to a running process + provides = htop + conflicts = htop + options = !emptydirs + source = http://hisham.hm/htop/releases/2.0.2/htop-2.0.2.tar.gz + source = solarized-colors.patch + source = vim-keybindings-common.patch + source = vim-keybindings-d-for-kill.patch + source = vim-keybindings-x-for-kill.patch + sha384sums = 3b64dae53f248dbfb1cf5dafc066e6a27614a264ebc3487357d501f4a00abd149dffcfd3c5548341b1af20312c5d9a84 + sha384sums = ebc4339ff3d5d43606d9f5e398832cb9382bfa175b30e36cfbcaf6112206c33ea0d42e39246e3a73785d3f584cf88214 + sha384sums = 8325ae4f8e7732e9c1c067b94314da13adc86c6cb4747e78cf4332a432c7c4e12d368f7bb50ad1d404f127aa3afdb077 + sha384sums = 353a675f5453b5b1ab503f9cbcb02e45b32bf429797f11e3cea96848fb4ad931129da7afa52b373fd6871c41657d52af + sha384sums = 3b2071d412a6a98bf5d4d3a4bc74f69b205f9464b00063aa21e9947b80df2a008bb82aff7f8168b0dfbac0647bc0cb76 + +pkgname = htop-vim-solarized + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..b5cb1bffc552 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.tar.gz +*.pkg.tar.xz +src/ +pkg/ +htop/ diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..250f92023b6f --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,89 @@ +# Maintainer Connor Prussin <connor at prussin dot net> +# Contributor: icasdri <icasdri at gmail dot com> +# Contributor: Yardena Cohen <yardenack at gmail dot com> +# Contributor: Boohbah <boohbah at gmail.com> +# Contributor: Eric Belanger <eric at archlinux.org> +# Contributor: Daniel J Griffiths <ghost1227 at archlinux.us> +# Contributor: Wesley Merkel <ooesili at gmail.com> + +##### OPTIONS ############################################################### + +# Set the following variable accordingly: +# * x if you would like to use x as the kill-process shortcut in htop +# * d if you would like to use d as the kill-process shortcut in htop +# (we need one of these as htop's default shortcut k conflicts with vim +# movement keys!) + +kill_process_shortcut=x +#kill_process_shortcut=d + +############################################################################# + +_pkgname=htop +pkgname=htop-vim-solarized +pkgver=2.0.2 +pkgrel=1 +pkgdesc="Interactive process viewer with solarized and vim keybindings patch" +arch=('i686' 'x86_64') +url="https://github.com/cprussin/htop-vim-solarized" +license=('GPL') +depends=('ncurses') +makedepends=('git' 'python2') +optdepends=('lsof: show files opened by a process' + 'strace: attach to a running process') +provides=('htop') +conflicts=('htop') +options=('!emptydirs') +source=( + 'http://hisham.hm/htop/releases/2.0.2/htop-2.0.2.tar.gz' + 'solarized-colors.patch' + 'vim-keybindings-common.patch' + 'vim-keybindings-d-for-kill.patch' + 'vim-keybindings-x-for-kill.patch' +) +sha384sums=('3b64dae53f248dbfb1cf5dafc066e6a27614a264ebc3487357d501f4a00abd149dffcfd3c5548341b1af20312c5d9a84' + 'ebc4339ff3d5d43606d9f5e398832cb9382bfa175b30e36cfbcaf6112206c33ea0d42e39246e3a73785d3f584cf88214' + '8325ae4f8e7732e9c1c067b94314da13adc86c6cb4747e78cf4332a432c7c4e12d368f7bb50ad1d404f127aa3afdb077' + '353a675f5453b5b1ab503f9cbcb02e45b32bf429797f11e3cea96848fb4ad931129da7afa52b373fd6871c41657d52af' + '3b2071d412a6a98bf5d4d3a4bc74f69b205f9464b00063aa21e9947b80df2a008bb82aff7f8168b0dfbac0647bc0cb76') + +prepare() { + cd "${srcdir}/${_pkgname}-${pkgver}" + + patch_list=( + 'solarized-colors.patch' + 'vim-keybindings-common.patch' + "vim-keybindings-${kill_process_shortcut}-for-kill.patch" + ) + + msg2 "Using '$kill_process_shortcut' as the kill-process shortcut in htop" + + for _p in "${patch_list[@]}" + do + msg2 "Applying $_p" + patch -p1 -i "../$_p" + done + + ./autogen.sh + + sed -i 's|ncursesw/curses.h|curses.h|' RichString.[ch] configure + sed -i 's|python|python2|' scripts/MakeHeader.py + + ./configure \ + --prefix=/usr \ + --enable-unicode \ + --enable-openvz \ + --enable-vserver \ + --enable-cgroup \ + --enable-oom +} + +build() { + cd "${srcdir}/${_pkgname}-${pkgver}" + make +} + +package() { + cd "${srcdir}/${_pkgname}-${pkgver}" + make DESTDIR="${pkgdir}" install +} diff --git a/README.md b/README.md new file mode 100644 index 000000000000..8a56fe0f93f3 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# htop-vim-solarized + +A simple arch linux package for the latest htop version with vim keybindings and +solarized patches applied. + +This is the work of many contributors. You can see a list of them in the header +of the [PKGBUILD](PKGBUILD) file. diff --git a/solarized-colors.patch b/solarized-colors.patch new file mode 100644 index 000000000000..1140d799f9bd --- /dev/null +++ b/solarized-colors.patch @@ -0,0 +1,108 @@ +--- a/CRT.c ++++ b/CRT.c +@@ -183,7 +183,7 @@ + [LED_COLOR] = ColorPair(Green,Black), + [TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black), + [PROCESS] = A_NORMAL, +- [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black), ++ [PROCESS_SHADOW] = A_BOLD | ColorPair(Green,Black), + [PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black), + [PROCESS_MEGABYTES] = ColorPair(Cyan,Black), + [PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Black), +@@ -195,7 +195,7 @@ + [PROCESS_THREAD] = ColorPair(Green,Black), + [PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green,Black), + [BAR_BORDER] = A_BOLD, +- [BAR_SHADOW] = A_BOLD | ColorPair(Black,Black), ++ [BAR_SHADOW] = A_BOLD | ColorPair(Green,Black), + [SWAP] = ColorPair(Red,Black), + [GRAPH_1] = A_BOLD | ColorPair(Cyan,Black), + [GRAPH_2] = ColorPair(Cyan,Black), +@@ -342,10 +342,10 @@ + [CPU_GUEST] = ColorPair(Cyan,White), + }, + [COLORSCHEME_LIGHTTERMINAL] = { +- [RESET_COLOR] = ColorPair(Black,Black), +- [DEFAULT_COLOR] = ColorPair(Black,Black), ++ [RESET_COLOR] = ColorPair(Green,Black), ++ [DEFAULT_COLOR] = ColorPair(Green,Black), + [FUNCTION_BAR] = ColorPair(Black,Cyan), +- [FUNCTION_KEY] = ColorPair(Black,Black), ++ [FUNCTION_KEY] = ColorPair(Green,Black), + [PANEL_HEADER_FOCUS] = ColorPair(Black,Green), + [PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green), + [PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan), +@@ -356,11 +356,11 @@ + [BATTERY] = ColorPair(Yellow,Black), + [LARGE_NUMBER] = ColorPair(Red,Black), + [METER_TEXT] = ColorPair(Blue,Black), +- [METER_VALUE] = ColorPair(Black,Black), ++ [METER_VALUE] = ColorPair(Green,Black), + [LED_COLOR] = ColorPair(Green,Black), + [TASKS_RUNNING] = ColorPair(Green,Black), +- [PROCESS] = ColorPair(Black,Black), +- [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black), ++ [PROCESS] = ColorPair(Green,Black), ++ [PROCESS_SHADOW] = A_BOLD | ColorPair(Green,Black), + [PROCESS_TAG] = ColorPair(White,Blue), + [PROCESS_MEGABYTES] = ColorPair(Blue,Black), + [PROCESS_BASENAME] = ColorPair(Green,Black), +@@ -372,7 +372,7 @@ + [PROCESS_THREAD] = ColorPair(Blue,Black), + [PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue,Black), + [BAR_BORDER] = ColorPair(Blue,Black), +- [BAR_SHADOW] = ColorPair(Black,Black), ++ [BAR_SHADOW] = ColorPair(Green,Black), + [SWAP] = ColorPair(Red,Black), + [GRAPH_1] = A_BOLD | ColorPair(Cyan,Black), + [GRAPH_2] = ColorPair(Cyan,Black), +@@ -380,15 +380,15 @@ + [MEMORY_BUFFERS] = ColorPair(Cyan,Black), + [MEMORY_BUFFERS_TEXT] = ColorPair(Cyan,Black), + [MEMORY_CACHE] = ColorPair(Yellow,Black), +- [LOAD_AVERAGE_FIFTEEN] = ColorPair(Black,Black), +- [LOAD_AVERAGE_FIVE] = ColorPair(Black,Black), +- [LOAD_AVERAGE_ONE] = ColorPair(Black,Black), ++ [LOAD_AVERAGE_FIFTEEN] = ColorPair(Green,Black), ++ [LOAD_AVERAGE_FIVE] = ColorPair(Green,Black), ++ [LOAD_AVERAGE_ONE] = ColorPair(Green,Black), + [LOAD] = ColorPair(White,Black), + [HELP_BOLD] = ColorPair(Blue,Black), + [CLOCK] = ColorPair(White,Black), + [CHECK_BOX] = ColorPair(Blue,Black), +- [CHECK_MARK] = ColorPair(Black,Black), +- [CHECK_TEXT] = ColorPair(Black,Black), ++ [CHECK_MARK] = ColorPair(Green,Black), ++ [CHECK_TEXT] = ColorPair(Green,Black), + [HOSTNAME] = ColorPair(White,Black), + [CPU_NICE] = ColorPair(Cyan,Black), + [CPU_NICE_TEXT] = ColorPair(Cyan,Black), +@@ -397,8 +397,8 @@ + [CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black), + [CPU_IRQ] = A_BOLD | ColorPair(Blue,Black), + [CPU_SOFTIRQ] = ColorPair(Blue,Black), +- [CPU_STEAL] = ColorPair(Black,Black), +- [CPU_GUEST] = ColorPair(Black,Black), ++ [CPU_STEAL] = ColorPair(Green,Black), ++ [CPU_GUEST] = ColorPair(Green,Black), + }, + [COLORSCHEME_MIDNIGHT] = { + [RESET_COLOR] = ColorPair(White,Blue), +@@ -478,7 +478,7 @@ + [LED_COLOR] = ColorPair(Green,Black), + [TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black), + [PROCESS] = ColorPair(Cyan,Black), +- [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black), ++ [PROCESS_SHADOW] = A_BOLD | ColorPair(Green,Black), + [PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black), + [PROCESS_MEGABYTES] = A_BOLD | ColorPair(Green,Black), + [PROCESS_BASENAME] = A_BOLD | ColorPair(Green,Black), +@@ -555,7 +555,7 @@ + + for (int i = 0; i < LAST_COLORELEMENT; i++) { + unsigned int color = CRT_colorSchemes[COLORSCHEME_DEFAULT][i]; +- CRT_colorSchemes[COLORSCHEME_BROKENGRAY][i] = color == (A_BOLD | ColorPair(Black,Black)) ? ColorPair(White,Black) : color; ++ CRT_colorSchemes[COLORSCHEME_BROKENGRAY][i] = color == (A_BOLD | ColorPair(Green,Black)) ? ColorPair(White,Black) : color; + } + + halfdelay(CRT_delay); diff --git a/vim-keybindings-common.patch b/vim-keybindings-common.patch new file mode 100644 index 000000000000..2ef2ea398e1c --- /dev/null +++ b/vim-keybindings-common.patch @@ -0,0 +1,182 @@ +diff --git a/Action.c b/Action.c +index ee34a4b..effa033 100644 +--- a/Action.c ++++ b/Action.c +@@ -382,7 +382,7 @@ static Htop_Reaction actionRedraw() { + } + + static struct { const char* key; const char* info; } helpLeft[] = { +- { .key = " Arrows: ", .info = "scroll process list" }, ++ { .key = " hjkl: ", .info = "scroll process list" }, + { .key = " Digits: ", .info = "incremental PID search" }, + { .key = " F3 /: ", .info = "incremental name search" }, + { .key = " F4 \\: ",.info = "incremental name filtering" }, +@@ -411,11 +411,11 @@ static struct { const char* key; const char* info; } helpRight[] = { + #endif + { .key = " e: ", .info = "show process environment" }, + { .key = " i: ", .info = "set IO priority" }, +- { .key = " l: ", .info = "list open files with lsof" }, ++ { .key = " L: ", .info = "list open files with lsof" }, + { .key = " s: ", .info = "trace syscalls with strace" }, + { .key = " ", .info = "" }, + { .key = " F2 S: ", .info = "setup" }, +- { .key = " F1 h: ", .info = "show this help screen" }, ++ { .key = " F1 ?: ", .info = "show this help screen" }, + { .key = " F10 q: ", .info = "quit" }, + { .key = NULL, .info = NULL } + }; +@@ -543,6 +543,7 @@ void Action_setBindings(Htop_Action* keys) { + keys['I'] = actionInvertSortOrder; + keys[KEY_F(6)] = actionExpandCollapseOrSortColumn; + keys[KEY_F(18)] = actionExpandCollapseOrSortColumn; ++ keys['o'] = actionExpandCollapseOrSortColumn; + keys['<'] = actionSetSortColumn; + keys[','] = actionSetSortColumn; + keys['>'] = actionSetSortColumn; +@@ -561,12 +562,11 @@ void Action_setBindings(Htop_Action* keys) { + keys['S'] = actionSetup; + keys['C'] = actionSetup; + keys[KEY_F(2)] = actionSetup; +- keys['l'] = actionLsof; ++ keys['L'] = actionLsof; + keys['s'] = actionStrace; + keys[' '] = actionTag; + keys['\014'] = actionRedraw; // Ctrl+L + keys[KEY_F(1)] = actionHelp; +- keys['h'] = actionHelp; + keys['?'] = actionHelp; + keys['U'] = actionUntagAll; + keys['c'] = actionTagAllChildren; +diff --git a/Panel.c b/Panel.c +index 579a82c..c2a854c 100644 +--- a/Panel.c ++++ b/Panel.c +@@ -376,10 +376,12 @@ bool Panel_onKey(Panel* this, int key) { + int size = Vector_size(this->items); + switch (key) { + case KEY_DOWN: ++ case 'j': + case KEY_CTRL('N'): + this->selected++; + break; + case KEY_UP: ++ case 'k': + case KEY_CTRL('P'): + this->selected--; + break; +@@ -394,23 +396,33 @@ bool Panel_onKey(Panel* this, int key) { + break; + #endif + case KEY_LEFT: +- case KEY_CTRL('B'): ++ case 'h': + if (this->scrollH > 0) { + this->scrollH -= MAX(CRT_scrollHAmount, 0); + this->needsRedraw = true; + } + break; + case KEY_RIGHT: +- case KEY_CTRL('F'): ++ case 'l': + this->scrollH += CRT_scrollHAmount; + this->needsRedraw = true; + break; ++ case KEY_CTRL('U'): ++ this->selected -= (this->h - 1) / 2; ++ this->needsRedraw = true; ++ break; ++ case KEY_CTRL('D'): ++ this->selected += (this->h - 1) / 2; ++ this->needsRedraw = true; ++ break; + case KEY_PPAGE: ++ case KEY_CTRL('B'): + this->selected -= (this->h - 1); + this->scrollV -= (this->h - 1); + this->needsRedraw = true; + break; + case KEY_NPAGE: ++ case KEY_CTRL('F'): + this->selected += (this->h - 1); + this->scrollV = MIN(MAX(0, Vector_size(this->items) - this->h), this->selected - this->h); + this->needsRedraw = true; +@@ -454,7 +466,7 @@ bool Panel_onKey(Panel* this, int key) { + if (this->selected < 0 || size == 0) { + this->selected = 0; + this->needsRedraw = true; +- } else if (this->selected >= size) { ++ } else if (this->selected >= size) { + this->selected = size - 1; + this->needsRedraw = true; + } +diff --git a/README b/README +index 1af7377..92a76be 100644 +--- a/README ++++ b/README +@@ -17,6 +17,44 @@ but we also have code for running under FreeBSD and Mac OS X + This software has evolved considerably over the years, + and is reasonably complete, but there is always room for improvement. + ++Vim keybindings ++---------------- ++ ++These are the keybindings added in this fork of htop: ++ ++``` ++ g to the top (gg in vim) ++ ++ <C-b> up 1 page ++ ++ <C-u> up 1/2 page ++ ++ k ++ ++h l one character ++ ++ j ++ ++ <C-d> down 1/2 page ++ ++ <C-f> down 1 page ++ ++ G to the end ++ ++-------------------------------------------------- ++ ++ o Expand/collapse (like in NERDTree) ++``` ++ ++In order to accomodate these keybindings, the following changes ++were made to the original keybindings: ++ ++* Ctrl+F and Ctrt+B can now longer be used to navigate horizontally ++* 'h' can no longer be used to access the help, leaving Ctrl+F1 & '?' ++* 'k' can no longer be used to kill processes, being replaced with 'x' ++* 'l' can no longer be used to list open files, being replaced with 'L' ++ ++ + Comparison between `htop` and classic `top` + ------------------------------------------- + +diff --git a/ScreenManager.c b/ScreenManager.c +index 05e1c02..df2ac4a 100644 +--- a/ScreenManager.c ++++ b/ScreenManager.c +@@ -279,7 +279,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { + continue; + } + case KEY_LEFT: +- case KEY_CTRL('B'): ++ case 'h': + if (this->panelCount < 2) { + goto defaultHandler; + } +@@ -293,7 +293,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { + goto tryLeft; + break; + case KEY_RIGHT: +- case KEY_CTRL('F'): ++ case 'l': + case 9: + if (this->panelCount < 2) { + goto defaultHandler; diff --git a/vim-keybindings-d-for-kill.patch b/vim-keybindings-d-for-kill.patch new file mode 100644 index 000000000000..360d84cf6da6 --- /dev/null +++ b/vim-keybindings-d-for-kill.patch @@ -0,0 +1,20 @@ +--- a/Action.c ++++ b/Action.c +@@ -403,7 +403,7 @@ static struct { const char* key; const char* info; } helpRight[] = { + { .key = " Space: ", .info = "tag process" }, + { .key = " c: ", .info = "tag process and its children" }, + { .key = " U: ", .info = "untag all processes" }, +- { .key = " F9 k: ", .info = "kill process/tagged processes" }, ++ { .key = " F9 d: ", .info = "kill process/tagged processes" }, + { .key = " F7 ]: ", .info = "higher priority (root only)" }, + { .key = " F8 [: ", .info = "lower priority (+ nice)" }, + #if (HAVE_LIBHWLOC || HAVE_LINUX_AFFINITY) +@@ -551,7 +552,7 @@ void Action_setBindings(Htop_Action* keys) { + keys['q'] = actionQuit; + keys['a'] = actionSetAffinity; + keys[KEY_F(9)] = actionKill; +- keys['k'] = actionKill; ++ keys['d'] = actionKill; + keys[KEY_RECLICK] = actionExpandOrCollapse; + keys['+'] = actionExpandOrCollapse; + keys['='] = actionExpandOrCollapse; diff --git a/vim-keybindings-x-for-kill.patch b/vim-keybindings-x-for-kill.patch new file mode 100644 index 000000000000..36dcda10d466 --- /dev/null +++ b/vim-keybindings-x-for-kill.patch @@ -0,0 +1,20 @@ +--- a/Action.c ++++ b/Action.c +@@ -403,7 +403,7 @@ static struct { const char* key; const char* info; } helpRight[] = { + { .key = " Space: ", .info = "tag process" }, + { .key = " c: ", .info = "tag process and its children" }, + { .key = " U: ", .info = "untag all processes" }, +- { .key = " F9 k: ", .info = "kill process/tagged processes" }, ++ { .key = " F9 x: ", .info = "kill process/tagged processes" }, + { .key = " F7 ]: ", .info = "higher priority (root only)" }, + { .key = " F8 [: ", .info = "lower priority (+ nice)" }, + #if (HAVE_LIBHWLOC || HAVE_LINUX_AFFINITY) +@@ -551,7 +552,7 @@ void Action_setBindings(Htop_Action* keys) { + keys['q'] = actionQuit; + keys['a'] = actionSetAffinity; + keys[KEY_F(9)] = actionKill; +- keys['k'] = actionKill; ++ keys['x'] = actionKill; + keys[KEY_RECLICK] = actionExpandOrCollapse; + keys['+'] = actionExpandOrCollapse; + keys['='] = actionExpandOrCollapse; |