Commit 25057e7a authored by Mo Zhou's avatar Mo Zhou

New upstream version 2.0.1

parents
---
name: Bug report
about: Template to report bugs.
---
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Also please test using the latest build to make sure your issue has not already been fixed. -->
Required information:
- gotop version (`gotop -v`):
- The output of `uname -a`:
- Terminal shell (e.g. zsh or bash):
- Terminal emulator (e.g. iTerm or gnome terminal):
- Any relevenat hardware info:
- tmux version if using tmux:
Also please copy or attach the following file if it exists and contains logs:
- Linux: `~/.local/state/gotop/errors.log`
- OSX: `~/Library/Logs/gotop/errors.log`
---
name: Other
about: No template.
---
dist/
gotop*
language: go
go:
- 1.11.x
os:
- linux
- osx
git:
depth: 1
env:
global:
- NAME=gotop
install: true
script:
- ./ci/script.sh
matrix:
include:
# Linux
- env: _GOOS=linux _GOARCH=amd64
os: linux
- env: _GOOS=linux _GOARCH=386
os: linux
- env: _GOOS=linux _GOARCH=arm GOARM=5
os: linux
- env: _GOOS=linux _GOARCH=arm GOARM=6
os: linux
- env: _GOOS=linux _GOARCH=arm GOARM=7
os: linux
- env: _GOOS=linux _GOARCH=arm64
os: linux
# OSX
- env: _GOOS=darwin _GOARCH=amd64
os: osx
deploy:
provider: releases
api_key: $GITHUB_TOKEN
file_glob: true
file: "./dist/*"
skip_cleanup: true
on:
tags: true
notifications:
email:
on_success: never
This diff is collapsed.
<div align="center">
<img src="./assets/logo.png" width="20%" />
<br><br>
Another terminal based graphical activity monitor, inspired by [gtop](https://github.com/aksakalli/gtop) and [vtop](https://github.com/MrRio/vtop), this time written in [Go](https://golang.org/)!
<img src="./assets/demo.gif" />
<img src="./assets/minimal.png" width="96%" />
</div>
## Installation
Working and tested on Linux, FreeBSD and OSX. Windows support is planned.
### Source
```bash
go get github.com/cjbassi/gotop
```
### Prebuilt binaries
**Note**: Doesn't require Go.
Clone the repo and then run [scripts/download.sh](./scripts/download.sh) to download the correct binary for your system from the [releases tab](https://github.com/cjbassi/gotop/releases):
```bash
git clone --depth 1 https://github.com/cjbassi/gotop /tmp/gotop
/tmp/gotop/scripts/download.sh
```
Then move `gotop` into your `$PATH` somewhere.
### Arch Linux
Install `gotop`, `gotop-bin`, or `gotop-git` from the AUR.
### FreeBSD
```
pkg install gotop
```
### Homebrew
```
brew tap cjbassi/gotop
brew install gotop
```
## Usage
### Keybinds
- Quit: `q` or `<C-c>`
- Process navigation
- `k` and `<Up>`: up
- `j` and `<Down`: down
- `<C-u>`: half page up
- `<C-d>`: half page down
- `<C-b>`: full page up
- `<C-f>`: full page down
- `gg` and `<Home>`: jump to top
- `G` and `<End>`: jump to bottom
- Process actions:
- `<Tab>`: toggle process grouping
- `dd`: kill selected process or group of processes
- Process sorting
- `c`: CPU
- `m`: Mem
- `p`: PID
- CPU and Mem graph scaling:
- `h`: scale in
- `l`: scale out
- `?`: toggles keybind help menu
### Mouse
- click to select process
- mouse wheel to scroll through processes
### Colorschemes
gotop ships with a few colorschemes which can be set with the `-c` flag followed by the name of one. You can find all the colorschemes in the [colorschemes folder](./colorschemes).
To make a custom colorscheme, check out the [template](./colorschemes/template.go) for instructions and then use [default.json](./colorschemes/default.json) as a starter. Then put the file at `~/.config/gotop/{name}.json` on Linux or `~/Library/Application Support/gotop/{name}.json` on OSX and load it with `gotop -c {name}`. Colorschemes PR's are welcome!
### CLI Options
`-c`, `--color=NAME` Set a colorscheme.
`-m`, `--minimal` Only show CPU, Mem and Process widgets.
`-r`, `--rate=RATE` Number of times per second to update CPU and Mem widgets [default: 1].
`-v`, `--version` Print version and exit.
`-p`, `--percpu` Show each CPU in the CPU widget.
`-a`, `--averagecpu` Show average CPU in the CPU widget.
`-s`, `--statusbar` Show a statusbar with the time.
`-b`, `--battery` Show battery level widget (`minimal` turns off). [widget preview](./assets/battery.png)
## Credits
- [mdnazmulhasan27771](https://github.com/mdnazmulhasan27771) for the [logo](./assets/logo.png)
- [f1337](https://github.com/f1337) for helping port gotop to OSX
## Built With
- [gizak/termui](https://github.com/gizak/termui)
- [nsf/termbox](https://github.com/nsf/termbox-go)
- [exrook/drawille-go](https://github.com/exrook/drawille-go)
- [shirou/gopsutil](https://github.com/shirou/gopsutil)
- [goreleaser/nfpm](https://github.com/goreleaser/nfpm)
- [distatus/battery](https://github.com/distatus/battery)
## Stargazers over time
[![Stargazers over time](https://starcharts.herokuapp.com/cjbassi/gotop.svg)](https://starcharts.herokuapp.com/cjbassi/gotop)
name: "gotop"
arch: "amd64"
platform: "linux"
version: "v${VERSION}"
section: "default"
priority: "extra"
maintainer: "Caleb Bassi <calebjbassi@gmail.com>"
description: |
A terminal based graphical activity monitor inspired by gtop and vtop
vendor: "Caleb Bassi"
homepage: "https://github.com/cjbassi/gotop"
license: "GNU Affero General Public License v3.0"
bindir: "/usr/local/bin"
files:
/tmp/pkg/gotop: "/usr/local/bin/gotop"
#!/usr/bin/env bash
GOARCH=${_GOARCH}
GOOS=${_GOOS}
if [[ ! ${GOARCH} ]]; then
exit
fi
env GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -o ${NAME}
mkdir -p dist
if [[ ${GOARCH} == "arm64" ]]; then
FILE=${NAME}_${TRAVIS_BRANCH}_${GOOS}_arm8
else
FILE=${NAME}_${TRAVIS_BRANCH}_${GOOS}_${GOARCH}${GOARM}
fi
tar -czf dist/${FILE}.tgz ${NAME}
if [[ ${GOOS} == "linux" && ${GOARCH} == "amd64" ]]; then
VERSION=$(go run main.go -v) # used by nfpm
docker run --rm \
-v $PWD:/tmp/pkg \
-e VERSION=${VERSION} \
goreleaser/nfpm pkg \
--config /tmp/pkg/ci/nfpm.yml \
--target /tmp/pkg/dist/${FILE}.deb
docker run --rm \
-v $PWD:/tmp/pkg \
-e VERSION=${VERSION} \
goreleaser/nfpm pkg \
--config /tmp/pkg/ci/nfpm.yml \
--target /tmp/pkg/dist/${FILE}.rpm
fi
package colorschemes
var Default = Colorscheme{
Fg: 7,
Bg: -1,
BorderLabel: 7,
BorderLine: 6,
CPULines: []int{4, 3, 2, 1, 5, 6, 7, 8},
BattLines: []int{4, 3, 2, 1, 5, 6, 7, 8},
MainMem: 5,
SwapMem: 11,
ProcCursor: 4,
Sparkline: 4,
DiskBar: 7,
TempLow: 2,
TempHigh: 1,
}
// Example json file to put in `~/.config/gotop/{name}.json` and load with
// `gotop -c {name}`. MUST DELETE THESE COMMENTS AND RENAME FILE in order to load.
{
"Fg": 7,
"Bg": -1,
"BorderLabel": 7,
"BorderLine": 6,
"CPULines": [4, 3, 2, 1, 5, 6, 7, 8],
"BattLines": [4, 3, 2, 1, 5, 6, 7, 8],
"MainMem": 5,
"SwapMem": 11,
"ProcCursor": 4,
"Sparkline": 4,
"DiskBar": 7,
"TempLow": 2,
"TempHigh": 1
}
package colorschemes
var DefaultDark = Colorscheme{
Fg: 235,
Bg: -1,
BorderLabel: 235,
BorderLine: 6,
CPULines: []int{4, 3, 2, 1, 5, 6, 7, 8},
BattLines: []int{4, 3, 2, 1, 5, 6, 7, 8},
MainMem: 5,
SwapMem: 3,
ProcCursor: 33,
Sparkline: 4,
DiskBar: 252,
TempLow: 2,
TempHigh: 1,
}
package colorschemes
var Monokai = Colorscheme{
Fg: 249,
Bg: -1,
BorderLabel: 249,
BorderLine: 239,
CPULines: []int{81, 70, 208, 197, 249, 141, 221, 186},
BattLines: []int{81, 70, 208, 197, 249, 141, 221, 186},
MainMem: 208,
SwapMem: 186,
ProcCursor: 197,
Sparkline: 81,
DiskBar: 102,
TempLow: 70,
TempHigh: 208,
}
package colorschemes
var Solarized = Colorscheme{
Fg: 250,
Bg: -1,
BorderLabel: 250,
BorderLine: 37,
CPULines: []int{61, 33, 37, 64, 125, 160, 166, 136},
BattLines: []int{61, 33, 37, 64, 125, 160, 166, 136},
MainMem: 125,
SwapMem: 166,
ProcCursor: 136,
Sparkline: 33,
DiskBar: 245,
TempLow: 64,
TempHigh: 160,
}
package colorschemes
/*
The standard 256 terminal colors are supported.
-1 = clear
You can combine a color with 'Bold', 'Underline', or 'Reverse' by using bitwise OR ('|') and the name of the Color.
For example, to get Bold red Labels, you would do 'Labels: 2 | Bold'.
Once you've created a colorscheme, add an entry for it in the `handleColorscheme` function in 'main.go'.
*/
const (
Bold int = 1 << (iota + 9)
Underline
Reverse
)
type Colorscheme struct {
Name string
Author string
Fg int
Bg int
BorderLabel int
BorderLine int
// should add at least 8 here