Merge branch 'master' into nvidia

This commit is contained in:
Sean E. Russell 2020-02-24 10:03:08 -06:00
commit 1375dce1be
14 changed files with 73 additions and 17 deletions

@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.3.2] - ??
- Fixes #15, crash caused by battery widget when some accessories have batteries
- Fixes #57, colors with dashes in the name not found.
- Also, cjbassi/gotop#127 and cjbassi/gotop#130 were released back in v3.1.0.

@ -9,8 +9,8 @@ Another terminal based graphical activity monitor, inspired by [gtop](https://gi
The original author of gotop has re-implemented the application in Rust, as [ytop](https://github.com/cjbassi/ytop). This is a fork of original gotop project with a new maintainer.
<img src="./assets/demos/demo.gif" />
<img src="./assets/screenshots/minimal.png" width="96%" />
<img src="./assets/screenshots/demo.gif" />
<img src="./assets/screenshots/kitchensink.gif" />
</div>
@ -166,21 +166,30 @@ build massive edifices, you're in for disappointment.
### CLI Options
`-c`, `--color=NAME` Set a colorscheme.
`-m`, `--minimal` Only show CPU, Mem and Process widgets. (DEPRECATED for `-l minimal`)
`-m`, `--minimal` Only show CPU, Mem and Process widgets. (DEPRECATED, use `-l minimal`)
`-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.
`-f`, `--fahrenheit` Show temperatures in fahrenheit.
`-s`, `--statusbar` Show a statusbar with the time.
`-b`, `--battery` Show battery level widget (`minimal` turns off). [preview](./assets/screenshots/battery.png) (DEPRECATED for `-l battery`)
`-i`, `--interface=NAME` Select network interface [default: all].
`-b`, `--battery` Show battery level widget (`minimal` turns off). (DEPRECATED, use `-l battery`)
`-i`, `--interface=NAME` Select network interface [default: all].
`-l`, `--layout=NAME` Choose a layout. gotop searches for a file by NAME in \$XDG_CONFIG_HOME/gotop, then relative to the current path. "-" reads a layout from stdin, allowing for simple, one-off layouts such as `echo net | gotop -l -`
Several interfaces can be defined using comma separated values.
Interfaces can also be ignored using `!`
## More screen shots
#### "-l battery"
<img src="./assets/screenshots/battery.png" />
#### "-l minimal"
<img src="./assets/screenshots/minimal.png" />
#### Custom (layouts/procs)
<img src="./assets/screenshots/procs.png" />
## Built With
- [gizak/termui](https://github.com/gizak/termui)

Binary file not shown.

Before

(image error) Size: 93 KiB

After

(image error) Size: 122 KiB

Before

(image error) Size: 146 KiB

After

(image error) Size: 146 KiB

Binary file not shown.

After

(image error) Size: 230 KiB

Binary file not shown.

Before

(image error) Size: 43 KiB

After

(image error) Size: 87 KiB

Binary file not shown.

After

(image error) Size: 160 KiB

29
build/PKGBUILD Normal file

@ -0,0 +1,29 @@
# Maintainer: Fabio 'Lolix' Loli <lolix@disroot.org> -> https://github.com/FabioLolix
# Co-maintainer/contributor: Sean E. Russell <ser@ser1.net>
pkgname=gotop
pkgver=3.3.1
pkgrel=0
pkgdesc='A terminal based graphical activity monitor inspired by gtop and vtop'
arch=(x86_64 i686 arm armv6h armv7h aarch64 armv5h)
url="https://github.com/xxxserxxx/gotop"
license=(AGPL3)
provides=(gotop)
conflicts=(gotop)
makedepends=("go")
depends=('glibc>=2.31-1')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
sha256sums=('79b261e5d778ddfdf85ded375dc4877b7d508916b771c2d1b7655849776ea66c')
build() {
cd "${srcdir}"/${pkgname}-${pkgver}
go build \
-gcflags "all=-trimpath=${PWD}" \
-asmflags "all=-trimpath=${PWD}" \
-ldflags "-extldflags ${LDFLAGS}" \
./cmd/gotop
}
package() {
install -Dm755 "${srcdir}"/${pkgname}-${pkgver}/gotop "${pkgdir}"/usr/bin/gotop
}

@ -41,6 +41,11 @@ var (
stderrLogger = log.New(os.Stderr, "", 0)
)
// TODO: state:merge #135 linux console font (cmatsuoka/console-font)
// TODO: state:deferred 157 FreeBSD fixes & Nvidia GPU support (kraust/master). Significant CPU use impact for NVidia changes.
// TODO: Virtual devices from Prometeus metrics @feature
// TODO: Export Prometheus metrics @feature
// TODO: state:merge #167 configuration file (jrswab/configFile111)
func parseArgs(conf *gotop.Config) error {
usage := `
Usage: gotop [options]

@ -12,16 +12,7 @@ import (
"github.com/xxxserxxx/gotop/widgets"
)
// TODO: Cross-compiling for darwin, openbsd requiring native procs & temps
// TODO: Merge #184 or #177 degree symbol (BartWillems:master, fleaz:master)
// TODO: Merge #169 % option for network use (jrswab:networkPercentage)
// TODO: Merge #167 configuration file (jrswab:configFile111)
// TODO: Merge #157 FreeBSD fixes & Nvidia GPU support (kraust:master)
// TODO: Merge #156 Added temperatures for NVidia GPUs (azak-azkaran:master)
// TODO: Merge #135 linux console font (cmatsuoka:console-font)
// TODO: Export Prometheus metrics @feature
// TODO: Virtual devices from Prometeus metrics @feature
// TODO test, build, release [#119] [#120] [#121]
// TODO: test, build, release [#119] [#120] [#121]
type Config struct {
ConfigDir string
LogDir string

@ -236,6 +236,7 @@ func countMaxHeight(rs [][]widgetRule) int {
// deepFindProc looks in the UI widget tree for the ProcWidget,
// and returns it if found or nil if not.
func deepFindProc(gs interface{}) *widgets.ProcWidget {
// FIXME: `procs` layout isn't passing down keystrokes
// Recursive function #1. Recursion is OK here because the number
// of UI elements, even in a very complex UI, is going to be
// relatively small.

@ -52,8 +52,25 @@ func (b *BatteryWidget) Scale(i int) {
func (self *BatteryWidget) update() {
batteries, err := battery.GetAll()
if err != nil {
log.Printf("failed to get battery info: %v", err)
return
switch errt := err.(type) {
case battery.ErrFatal:
log.Printf("fatal error fetching battery info: %v", err)
return
case battery.Errors:
batts := make([]*battery.Battery, 0)
for i, e := range errt {
if e == nil {
batts = append(batts, batteries[i])
} else {
log.Printf("recoverable error fetching battery info; skipping battery: %v", e)
}
}
if len(batts) < 1 {
log.Print("no usable batteries found")
return
}
batteries = batts
}
}
for i, battery := range batteries {
id := makeId(i)

@ -27,6 +27,7 @@ type NetWidget struct {
NetInterface []string
}
// TODO: state:merge #169 % option for network use (jrswab/networkPercentage)
func NewNetWidget(netInterface string) *NetWidget {
recvSparkline := ui.NewSparkline()
recvSparkline.Data = []int{}

@ -29,6 +29,7 @@ type TempWidget struct {
TempScale TempScale
}
// TODO: state:deferred 156 Added temperatures for NVidia GPUs (azak-azkaran/master). Crashes on non-nvidia machines.
func NewTempWidget(tempScale TempScale) *TempWidget {
self := &TempWidget{
Block: ui.NewBlock(),
@ -84,6 +85,7 @@ func (self *TempWidget) Draw(buf *ui.Buffer) {
image.Pt(self.Inner.Min.X, self.Inner.Min.Y+y),
)
// TODO: state:merge #184 or #177 degree symbol (BartWillems/master, fleaz/master)
switch self.TempScale {
case Fahrenheit:
buf.SetString(