Terminal based dashboard.

Doc Status Build Status Sourcegraph Coverage Status Go Report Card License Mentioned in Awesome Go

termdashlogo

Termdash is a cross-platform customizable terminal based dashboard.

termdashdemo

The feature set is inspired by the gizak/termui project, which in turn was inspired by yaronn/blessed-contrib.

This rewrite focuses on code readability, maintainability and testability, see the design goals. It aims to achieve the following requirements. See the high-level design for more details.

Public API and status

The public API surface is documented in the wiki.

Private packages can be identified by the presence of the /private/ directory in their import path. Stability of the private packages isn't guaranteed and changes won't be backward compatible.

There might still be breaking changes to the public API, at least until the project reaches version 1.0.0. Any breaking changes will be published in the changelog.

Current feature set

  • Full support for terminal window resizing throughout the infrastructure.
  • Customizable layout, widget placement, borders, margins, padding, colors, etc.
  • Dynamic layout changes at runtime.
  • Binary tree and Grid forms of setting up the layout.
  • Focusable containers and widgets.
  • Processing of keyboard and mouse events.
  • Periodic and event driven screen redraw.
  • A library of widgets, see below.
  • UTF-8 for all text elements.
  • Drawing primitives (Go functions) for widget development with character and sub-character resolution.

Installation

To install this library, run the following:

go get -u github.com/mum4k/termdash
cd github.com/mum4k/termdash

Usage

The usage of most of these elements is demonstrated in termdashdemo.go. To execute the demo:

go run termdashdemo/termdashdemo.go

Documentation

Please refer to the Termdash wiki for all documentation and resources.

Implemented Widgets

The Button

Allows users to interact with the application, each button press runs a callback function. Run the buttondemo.

go run widgets/button/buttondemo/buttondemo.go

buttondemo

The TextInput

Allows users to interact with the application by entering, editing and submitting text data. Run the textinputdemo.

go run widgets/textinput/textinputdemo/textinputdemo.go

textinputdemo

Can be used to create text input forms that support keyboard navigation:

go run widgets/textinput/formdemo/formdemo.go

formdemo

The Gauge

Displays the progress of an operation. Run the gaugedemo.

go run widgets/gauge/gaugedemo/gaugedemo.go

gaugedemo

The Donut

Visualizes progress of an operation as a partial or a complete donut. Run the donutdemo.

go run widgets/donut/donutdemo/donutdemo.go

donutdemo

The Text

Displays text content, supports trimming and scrolling of content. Run the textdemo.

go run widgets/text/textdemo/textdemo.go

textdemo

The SparkLine

Draws a graph showing a series of values as vertical bars. The bars can have sub-cell height. Run the sparklinedemo.

go run widgets/sparkline/sparklinedemo/sparklinedemo.go

sparklinedemo

The BarChart

Displays multiple bars showing relative ratios of values. Run the barchartdemo.

go run widgets/barchart/barchartdemo/barchartdemo.go

barchartdemo

The LineChart

Displays series of values on a line chart, supports zoom triggered by mouse events. Run the linechartdemo.

go run widgets/linechart/linechartdemo/linechartdemo.go

linechartdemo

The SegmentDisplay

Displays text by simulating a 16-segment display. Run the segmentdisplaydemo.

go run widgets/segmentdisplay/segmentdisplaydemo/segmentdisplaydemo.go

segmentdisplaydemo

Contributing

If you are willing to contribute, improve the infrastructure or develop a widget, first of all Thank You! Your help is appreciated.

Please see the CONTRIBUTING.md file for guidelines related to the Google's CLA, and code review requirements.

As stated above the primary goal of this project is to develop readable, well designed code, the functionality and efficiency come second. This is achieved through detailed code reviews, design discussions and following of the design guidelines. Please familiarize yourself with these before contributing.

If you're developing a new widget, please see the widget development section.

Termdash uses this branching model. When you fork the repository, base your changes off the devel branch and the pull request should merge it back to the devel branch. Commits to the master branch are limited to releases, major bug fixes and documentation updates.

Similar projects in Go

Projects using Termdash

  • datadash: Visualize streaming or tabular data inside the terminal.
  • grafterm: Metrics dashboards visualization on the terminal.
  • perfstat: Analyze and show tips about possible bottlenecks in Linux systems.
  • gex: Cosmos SDK explorer in-terminal.
  • ali: ALI HTTP load testing tool with realtime analysis.

Disclaimer

This is not an official Google product.

Comments
  • Y-axis label formatter for LineChart

    Y-axis label formatter for LineChart

    This PR fixes #187

    Adds the ability to set custom labels on the Y-axis using a value formatter that accepts a numeric value (float64) and returns the corresponding label to this value (string).

    The PR is in WIP state. I'll update the PR accordingly.

    Steps:

    • [x] Set the Linechart Y-axis option with the ValueFormatter.
    • [x] Use the formatter on the Value if is present.
    • [x] Create formatter for most common time units.
    • [x] Create formatter to round values (#95).

    This approach seems to work fine, I put an image of the project that I'm developing (a Grafana for terminal that I'll make it public soon) using this feature.

  • termdash makes debugging panics difficult

    termdash makes debugging panics difficult

    By default, when a termdash program panics, the panic is not printed to the output.

    Is there some way to intercept the panic to print it to a log file?

  • Update tcell to the latest 2.x version

    Update tcell to the latest 2.x version

    Changelog: https://github.com/gdamore/tcell/blob/master/CHANGESv2.adoc

    And while we are at it, we can also consider making tcell the default in all code examples.

  • Font modifier cell options (bold, italic, underline)

    Font modifier cell options (bold, italic, underline)

    It's currently not possible to set text as bold, italic, underline, or strikethrough.

    | Modifier | ANSI | |-|-| | Bold | \e[1m | | Italics | \e[3m | | Underline | \e[4m | | Strikethrough | \e[9m |

  • What are the keyboard shortcuts for changing widget focus?

    What are the keyboard shortcuts for changing widget focus?

    Good day. This wiki article says:

    "Focus can be changed using mouse or keyboard shortcuts." https://github.com/mum4k/termdash/blob/master/doc/hld.md

    I'm working with a terminal without mouse support. What are the shortcuts for changing focus? Thanks.

  • Does not render on Windows Terminal (preview)

    Does not render on Windows Terminal (preview)

    Currently using https://github.com/microsoft/terminal from the window's app store (which is still in preview since it has not officially released yet) on my Windows machine.

    I'm trying to make a cross-platform terminal application but it doesn't seem to work at all through Windows Terminal, regardless of the underlying shell I use (e.g. neither cmd nor powershell work when launched through Windows Terminal).

    I am aware that termbox-go does not work through mintty or cygwin, but I can confirm that termbox-go and termui do work through the new Windows Terminal application.

    Here is an example of a termui application running in windows terminal: image

    However when I try to build the TextInputDemo as an executable and run this through Windows Terminal, it does not show up at all.

    image

    It simply shows a flashing cursor at the top left.

  • Allow the user to request an unscaled X axis on the LineChart

    Allow the user to request an unscaled X axis on the LineChart

    Hello,

    [Category: Question]

    As I mentioned before - fantastic work so far! One thing I found might be missing would be a way to get the width of the lineChart for when you implement scrolling behavior.

    I see some functions under Container which might be helpful, is there a way to return the effective width of the linechart itself (the piece where braille gets drawn to the screen [the canvas])? Right now I use a hacky method where the ui.TerminalDimensions() function is called from the termUI library to take the 85 percent of the total terminal width (because the linechart container takes up 85 percent plus another 15 percent for the text box). I'd like to remove the termUI dependency entirely and somehow find the width of the canvas.

    termWidth, termHeight := ui.TerminalDimensions()
    termWidth = int((float64(termWidth)*float64(0.85)))
    

    Thanks! Keith

  • add font modifier cell options: bold, italic, underline.

    add font modifier cell options: bold, italic, underline.

    This PR adds cell options for the font modifiers bold, italic, and underline.

    tcell was upgraded 1.4.0.

    Strikethrough cell option was added as a no-op until tcell is updated to v2.0.0. I figured it wasn't a good idea to upgrade tcell by a whole major version without testing.

    Closes #251

  • Add Tcell implementation for terminal backend

    Add Tcell implementation for terminal backend

    Adds the option to use https://github.com/gdamore/tcell as the terminal screen. This PR also addresses #223, being that tcell enables proper rendering on Windows devices (including Windows Terminal).

    Fixes #100. Fixes #223.

  • panic: line style LineStyleLight line part linePartHAndUp is a rune ┴ with width 2, all parts must be half-width runes (width of one)

    panic: line style LineStyleLight line part linePartHAndUp is a rune ┴ with width 2, all parts must be half-width runes (width of one)

    Hi, I run the code from https://github.com/mum4k/termdash/blob/master/widgets/gauge/gaugedemo/gaugedemo.go in my Mac, but it panic:

    panic: line style LineStyleLight line part linePartHAndUp is a rune ┴ with width 2, all parts must be half-width runes (width of one)
    
    goroutine 1 [running]:
    github.com/mum4k/termdash/draw.init.0()
    	/Users/pathbox/gowork/src/github.com/mum4k/termdash/draw/line_style.go:76 +0x294
    exit status 2
    

    I don't know the reason

    It can't run in macOS(10.14.3) ?

    I try another demo, the same question is happened,too.

    I find the source code is:

    func init() {
    	for ls, parts := range lineStyleChars {
    		for part, r := range parts {
    			if got := runewidth.RuneWidth(r); got > 1 {
    				panic(fmt.Errorf("line style %v line part %v is a rune %c with width %v, all parts must be half-width runes (width of one)", ls, part, r, got))
    			}
    		}
    	}
    }
    

    It seems that it is about rune width of the hAndUp '┴', I don't know how to solve it

  • Add support for fixed size container splits.

    Add support for fixed size container splits.

    This PR adds support for setting fixed heights to containers that split horizontally.


    Examples: Calling

    container.SplitHorizontal(
    	container.Top(...),
    	container.Bottom(...),
    	container.FixHeight(3, 15)
    )
    

    will set the top container to be 3 in line height and 15 on the bottom container.

    To make the containers fill the rest of the space, you set the args to -1, example:

    container.SplitHorizontal(
    	container.Top(...),
    	container.Bottom(...),
    	container.FixHeight(3, -1)
    )
    

    which will make top container 3 and make the bottom container take up rest of the space that is available.

  • Bump github.com/gdamore/tcell/v2 from 2.5.1 to 2.5.4

    Bump github.com/gdamore/tcell/v2 from 2.5.1 to 2.5.4

    Bumps github.com/gdamore/tcell/v2 from 2.5.1 to 2.5.4.

    Release notes

    Sourced from github.com/gdamore/tcell/v2's releases.

    Version 2.5.4 Bug Fix Release

    Version 2.5.4 fixed quite a few things in the 2.5 release chain. Arguably it could also have been a minor release due to some quasi-feature updates. It is anticipated that this will be the last release for 2.5.x.

    The next minor release (2.6.0) will probably require updating to at least go 1.17 as we move towards updating imports and adopting additional language features.

    Fixes:

    • On Windows (and some other platforms) custom TTYs did not work (#580)
    • Default to using narrow for ambiguous characters in East Asian locales (#578) This affected a lot of folks in East Asian locales, and now tcell applications should work by default for them. If overrides to the RUNEWIDTH_EASTASIAN environment are present they will still be honored.
    • Fix for intermittent screen flashes (#576)
    • Encoding sub package now registers all encodings when imported. (Explicit call to Register is no longer required)
    • Tutorial program improved to demonstrate panic handling (thanks to Eric S. Raymond)
    • Fix for mouse-wheel/click-drag conflation (#574)
    • Hyperlink ID support added (#568) (thanks to Tim Culverhouse)
    • Paste support added to views.Application (#552) (thanks to Chris Bradbury)
    • WidgetWatcher is concurrency-safe (thanks to Tim Culverhouse)
    • Fix for CellView.Size() (#553) (thanks to Chris Bradbury)
    • Fix for tput escape sequence errors (#546)
    • Horizontal, Vertical are now type Orientation (#543) (thanks to Zaim Bakar)

    Version 2.5.3 Bug Fix Release

    Version 2.5.3 only fixed some things related to the documentation.

    Version 2.5.2 Bug Fix & Feature Release

    (Technically this should probably have been a new minor as a new feature was introduced.)

    • Better handling of monochrome terminals
    • Console resizing support (#462) (this new feature allows applications to specify the window size they want.)
    • Minor mouse demo improvements
    • Added support for terminal hyperlinks (#300)
    • Optimize some output (#526)
    • Documentation fixes
    Commits
    • 0fb7c00 Fix status badges (broken by shields.io)
    • dc01b79 fixes #580 tcell custom tty on Windows will not work
    • 2f889d7 Make RUNEWIDTH_EASTASIAN=0 the default.
    • a642547 fixes #576 Intermittent screen flashes
    • 44c298f Encoding package should initialize at import.
    • 916a717 Add example case for registering encodings.
    • e6d83cf Import order fix.
    • 85d85c1 Minor comment fixups.
    • ce3f911 Bump golang.org/x/text from 0.4.0 to 0.5.0
    • 68adf46 update README with gbb repo link
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Gauge threshold

    Gauge threshold

    This PR introduces the option gauge.Threshold which allows you to draw a vertical line on a gauge representing a threshold. If the gauge is drawn with a border the threshold is drawn over the border, otherwise it's only drawn within the gauge itself. The threshold is only drawn if its value is within the gauge (greater than 0 and less than g.total).

    I took the liberty to change the demo to draw a threshold on two of the gauges. image

  • panic: unknown tcell event type: <nil>

    panic: unknown tcell event type:

    I get this error every time I try to quit (by pressing 'q'). It also leaves the terminal window in an unusable state. Where do i start debugging this? The stack trace doesnt even list any of my code.

           quitter := func(k *terminalapi.Keyboard) {
               if k.Key == 'q' || k.Key == 'Q' {
                   term.Close()
               }
           }
    

    Full code is here: https://github.com/kmulvey/text2speech/blob/main/dashboard.go

    panic: unknown tcell event type: <nil>
    
    goroutine 59 [running]:
    github.com/mum4k/termdash.(*termdash).handleError(...)
    	/opt/code/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:252
    github.com/mum4k/termdash.(*termdash).subscribers.func1({0xb61960?, 0xc000118010?})
    	/opt/code/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:215 +0xd2
    github.com/mum4k/termdash/private/event.(*subscriber).callback(0xc00007e2c0, {0xb61960?, 0xc000118010?})
    	/opt/code/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:95 +0x31
    github.com/mum4k/termdash/private/event.(*subscriber).run(0xc00007e2c0, {0xb66b18, 0xc00007e200})
    	/opt/code/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:110 +0x5a
    created by github.com/mum4k/termdash/private/event.newSubscriber
    	/opt/code/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:89 +0x205
    
  • Bump github.com/mattn/go-runewidth from 0.0.13 to 0.0.14

    Bump github.com/mattn/go-runewidth from 0.0.13 to 0.0.14

    Bumps github.com/mattn/go-runewidth from 0.0.13 to 0.0.14.

    Commits
    • 2c6a438 Merge pull request #65 from tty2/feature/trim-prefix
    • 10a3ce9 add spaces == width+chWidth-w
    • 6dff02e change function name to TruncateLeft
    • b18c354 if pos < w: add empty chars
    • 669734a change tests to table-driven approach
    • 8f4e6bc change t.Run names
    • 01f382a change tail to prefix
    • f052c83 trim prefix
    • f9d5553 Merge pull request #62 from itchyny/fix-underscore-names
    • 011b00b Fix underscore names in tests
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • adding text styles has no effect on Windows

    adding text styles has no effect on Windows

    I am on the devel branch of termdash and I passed 4 different styles with text.WriteCellOpts to the text.Write call for testing the result. Except, I found only the blink style to be working, as seen in the attached image.

    image

    Is this an implementation issue at termdash's end or a bug in the upstream lib tcell?

    I also tested the same thing with termdash v0.16.0 which was before merging #329, but had the same outcome.

    image

    Shell: Powershell 7.2.5
    Terminal Emulator: Windows Terminal v1.13.11432.0
    OS: Windows 11
    

    PS: I know that the styling works on my device because golang-based OhMyPosh, which handles ANSI codes differently, works with all the 4 styles.

  • allow non-adaptive custom scale

    allow non-adaptive custom scale

    I've set linechart.YAxisCustomScale(-20, 20) and I want the position of 0 to always stay at the same place.

    Looking at the code, unfortunately the LineChart would still rescale the Y axis if a value is encountered that is outside of the range specified here

    To me it seems adaptive should be an entirely separate option.

    / YAxisCustomScale when provided, the scale of the Y axis will be based on the
    // specified minimum and maximum value instead of determining those from the
    // LineChart series. Useful to visually stabilize the Y axis for LineChart
    // applications that continuously feed values.
    // The default behavior is to continuously determine the minimum and maximum
    // value from the series before drawing the LineChart.
    // Even when this option is provided, the LineChart would still rescale the Y
    // axis if a value is encountered that is outside of the range specified here,
    // i.e. smaller than the minimum or larger than the maximum.
    // Both the minimum and the maximum must be valid numbers and the minimum must
    // be smaller than the maximum.
    //
    // Providing this option also sets YAxisAdaptive.
    func YAxisCustomScale(min, max float64) Option {
    	return option(func(opts *options) {
    		opts.yAxisCustomScale = &customScale{
    			min: min,
    			max: max,
    		}
    		opts.yAxisMode = axes.YScaleModeAdaptive
    	})
    }
    
The personal information dashboard for your terminal
The personal information dashboard for your terminal

WTF (aka 'wtfutil') is the personal information dashboard for your terminal, providing at-a-glance access to your very important but infrequently-need

Dec 31, 2022
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.

Stonks is a terminal based stock visualizer and tracker. Installation Requirements: golang >= 1.13 Manual Clone the repo Run make && make install Pack

Dec 16, 2022
A terminal based typing test.
A terminal based typing test.

What A terminal based typing test. Installation Linux sudo curl -L https://github.com/lemnos/tt/releases/download/v0.4.0/tt-linux -o /usr/local/bin/tt

Dec 28, 2022
Raspberry Pi terminal based activity monitor
Raspberry Pi terminal based activity monitor

pitop Raspberry Pi terminal based activity monitor Yes I know there are plenty of solutions already available, but I wanted to build my own terminal b

Dec 11, 2022
A modern and intuitive terminal-based text editor
A modern and intuitive terminal-based text editor

micro is a terminal-based text editor that aims to be easy to use and intuitive, while also taking advantage of the capabilities of modern terminals

Jan 7, 2023
A collection of terminal-based widgets for richer Golang CLI apps.
A collection of terminal-based widgets for richer Golang CLI apps.

Flinch A collection of terminal-based widgets for richer Golang CLI apps. Ships with a library to build your own widgets/TUIs too. Warning: This modul

Jan 7, 2023
A terminal based graphical activity monitor inspired by gtop and vtop
A terminal based graphical activity monitor inspired by gtop and vtop

NO LONGER MAINTAINED. A maintained fork of gotop exists at https://github.com/xxxserxxx/gotop. Another terminal based graphical activity monitor, insp

Jan 1, 2023
A terminal based file manager
A terminal based file manager

Keep those files organized About The Project A terminal based file manager Built With Go bubbletea bubbles lipgloss Installation go install github.com

Dec 27, 2022
Terminal based presentation tool
Terminal based presentation tool

Terminal based presentation tool

Jan 2, 2023
TScli - a very simple terminal-based client for TSWeb online judge

TScli TScli - a very simple terminal-based client for TSWeb online judge. It supports submitting problems and receiving feedback on them. Installation

Oct 24, 2021
A terminal-based download manager written in Go!

goload-manager About A terminal-based download manager written in Go! This project uses grab for downloading and tcell for the terminal interface. Hea

Oct 7, 2021
basic terminal based chat application written in go
basic terminal based chat application written in go

this app uses websocket protocol to communicate in real time. both the client and the server are written in golang. it uses: gorilla/websocket package

Nov 4, 2021
A go lib based on tcell which builds a simple menu UI in your terminal.

MenuScreen A simple go lib based on github.com/gdamore/tcell/v2,which helps you build a simple menu UI in your terminal. Install go get -u github.com/

Nov 11, 2021
cview - Terminal-based user interface toolkit

cview - Terminal-based user interface toolkit This package is a fork of tview. See FORK.md for more information. Demo ssh cview.rocketnine.space -p 20

Jan 23, 2022
Go-wordle - Terminal based wordle game

Go-wordle - Terminal based wordle game

Feb 25, 2022
Terminal based wordle clone. Uses the amazing charm.sh libraries to render and expose the game over SSH

Terminal based wordle clone. Uses the amazing charm.sh libraries to render and expose the game over SSH

Nov 17, 2022
Small CLI based programs for solving structural engineering design problems based on the book 'Structural Concrete'

Small CLI based programs for solving structural engineering design problems based on the book 'Structural Concrete' written by M. Nadim Hassoun and Akhtem Al-Manaseer (edition-6)

Nov 26, 2021
Terminal client for SimpleNote

GoNote - Terminal client for SimpleNote GoNote is a simple utility for managing notes in your SimpleNote account. It allows basic operations like crea

Nov 22, 2022
gomerge is a tool to quickly bulk merge several pull requests from your terminal.
gomerge is a tool to quickly bulk merge several pull requests from your terminal.

Gomerge is a tool to quickly enable you to bulk merge Github pull requests from your terminal. The intention of this tool is to simplfy, and eventually automate the merging of github pull requests. This tool should be able to run on most systems.

Dec 28, 2022