diff --git a/CHANGELOG.md b/CHANGELOG.md index 521e9b8..f4468be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index ca7be96..c37da93 100644 --- a/README.md +++ b/README.md @@ -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. - - + + @@ -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" + +#### "-l minimal" + +#### Custom (layouts/procs) + + ## Built With - [gizak/termui](https://github.com/gizak/termui) diff --git a/assets/screenshots/battery.png b/assets/screenshots/battery.png index b70f2ab..4698d1a 100644 Binary files a/assets/screenshots/battery.png and b/assets/screenshots/battery.png differ diff --git a/assets/demos/demo.gif b/assets/screenshots/demo.gif similarity index 100% rename from assets/demos/demo.gif rename to assets/screenshots/demo.gif diff --git a/assets/screenshots/kitchensink.gif b/assets/screenshots/kitchensink.gif new file mode 100644 index 0000000..6061c84 Binary files /dev/null and b/assets/screenshots/kitchensink.gif differ diff --git a/assets/screenshots/minimal.png b/assets/screenshots/minimal.png index efe5cc3..354b60b 100644 Binary files a/assets/screenshots/minimal.png and b/assets/screenshots/minimal.png differ diff --git a/assets/screenshots/procs.png b/assets/screenshots/procs.png new file mode 100644 index 0000000..0e4e7a6 Binary files /dev/null and b/assets/screenshots/procs.png differ diff --git a/build/PKGBUILD b/build/PKGBUILD new file mode 100644 index 0000000..b5e272a --- /dev/null +++ b/build/PKGBUILD @@ -0,0 +1,29 @@ +# Maintainer: Fabio 'Lolix' Loli -> https://github.com/FabioLolix +# Co-maintainer/contributor: Sean E. Russell + +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 +} diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index 5a898f8..7575655 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -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] diff --git a/config.go b/config.go index 2d27299..7fe2d72 100644 --- a/config.go +++ b/config.go @@ -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 diff --git a/layout/layout.go b/layout/layout.go index 3214b97..1dbcaa4 100644 --- a/layout/layout.go +++ b/layout/layout.go @@ -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. diff --git a/widgets/battery.go b/widgets/battery.go index 89620bb..00764c0 100644 --- a/widgets/battery.go +++ b/widgets/battery.go @@ -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) diff --git a/widgets/net.go b/widgets/net.go index c4ac8e8..ba2660d 100644 --- a/widgets/net.go +++ b/widgets/net.go @@ -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{} diff --git a/widgets/temp.go b/widgets/temp.go index 86e6e76..7c0a358 100644 --- a/widgets/temp.go +++ b/widgets/temp.go @@ -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(