• Stars
    star
    692
  • Rank 65,341 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 8 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿˆ Render full tmux windows or individual panes as HTML

tmux2html

tmux2html captures full tmux windows or individual panes then parses their contents into HTML in living color. The output can either be still snapshots, or animated sequences.

With a web server that uses gzip compression, the size over the network is negligible for reasonably sized windows or panes.

Examples

Some of these may be large in dimensions. You'll need to zoom out if you want to see all panes at once. These are not raster graphics!

If you decide to look at the telnet animations yourself and don't know how to exit, use Ctrl-] then type quit. For the Star Wars animation, press Ctrl-]<enter> to get the prompt.

Rationale

This was a weekend project I made for fun and I have no particular use for it beyond annoying my friends about how bad they should feel for not using tmux. I also thought it would be neat to have a render of my sessions that didn't result in an image using some crummy font on a headless server.

I suppose you can use cron to capture screens and display it on your website, or use it to create terminal snippets for your blog. You could also load a pane render in elinks within your coworker's session. The only limit is your imagination, my friend. โœจ

What people think of tmux2html

tmux2html ไพฟๅˆฉใใ†ใ€‚

โ€” @nakamuray

aaaaoooooo

โ€” @l4utert

9:39:46 PM Jef Myers: what the fuckย is tmux?

โ€” Jef Myers

Requirements

  • tmux 1.8
  • Python 2.7 or 3.4 (could be wrong since it's not tested in lower versions)

Installation

pip install tmux2html

Usage

tmux2html 4 -o window_5_in_current_session.html
tmux2html .0 -o first_pane_in_current_window.html
tmux2html other:1.2 -o second_window_third_pane_in_other_session.html

Command Line Options

  • target (positional) - Target window or pane. Uses tmux's target syntax, but always 0-indexed. (e.g. sess:1.2 - Session - sess, Window 2, Pane 3. Default target is window.)
  • -o, --output - Output file. Prints to stdout if omitted.
  • -m, --mode - Output file permissions. Default - 644
  • --light - Light background.
  • --interval - Number of seconds between captures.
  • --duration - Number of seconds to capture. 0 for indefinite recording, -1 to disable.
  • --stream - Continuously renders until stopped and adds a script to auto refresh based on --interval. See the notes below for more info.
  • --fg - Foreground color. Can be a color index or R,G,B
  • --bg - Background color. Can be a color index or R,G,B
  • --full - Renders the full history of a single pane
  • --history - Specifies the maximum number of pane history lines to include (implies --full)

Limitations

  • The cursor is not displayed.
  • Basic colors will not match your terminal's configured colors.
  • Animations aren't perfect with a lot of splits and fast resizing.
  • Animations won't capture scrolling the pane's history (selection mode). Scrolling in the pane's history is now recorded in animations.
  • In animations, a pane is updated with the full pane's content. Only the changed lines are updated on a per-pane basis.
  • Zoomed panes will ruin all the fun.
  • Your imagination ๐ŸŒ 

Notes

  • Still captures are plain HTML and CSS.
  • Animations use Javascript.
  • To keep the size reasonable with animations, pako is used to inflate the gzipped frame contents. Combined with decompression of frame content, the animations will use a fair amount of CPU. So, you shouldn't run animations indefinitely on your low performance or battery operated fun machines.
  • --stream doesn't actually "stream", per se. It keeps writing to the same file and adds a script that reloads the contents. This can be used to have a live feed of a window or pane. However, it's not elegant. If you set the interval to too low, your might unintentionally DDoS your own web server. Caveat Emptor.
  • The font stack includes Powerline and Nerd fonts because I'm pedantic and want to see those fancy glyphs. It falls back to monospace if you don't have any of those fonts installed. The caveat: if you have more than one of those fonts installed, the first one in the font stack might not be your favorite and you'll be forced to set your monitor on fire and buy a new one.

To Do

  • If there's practical use for animations in the future, only lines that are different should be updated to keep the size low.
  • Tell people to follow me on Twitter (@cloudsiphon) if they would like to stay up to date on tmux2html, but don't be pushy about it.

Similar Projects

  • gotty - Share your terminal as a web application
  • asciinema - Terminal session recorder

License

  • tmux2html: MIT
  • pako: MIT

More Repositories

1

braceless.vim

๐Ÿ Text objects, folding, and more for Python and other indented languages.
Vim Script
392
star
2

startuptime.vim

Breakdown Vim's --startuptime output
Vim Script
284
star
3

django-plus.vim

๐ŸŽธ Improvements to the handling of Django related files in Vim
Vim Script
178
star
4

helpful.vim

๐Ÿ““ Display vim version numbers in docs
Vim Script
177
star
5

nmux

A multiplexer for Neovim processes
Objective-C
110
star
6

fzf-filemru

File MRU with fzf.vim
Shell
91
star
7

deoplete-clang2

Python
90
star
8

moult

A utility for finding Python packages that may not be in use.
Python
50
star
9

nvim-python-doctor

๐Ÿš‘ Display diagnostic information about Python installations for Neovim
Shell
45
star
10

impsort.vim

Sort and highlight Python imports in Vim
Vim Script
36
star
11

local-indent.vim

Display a guide for the current line's indent level.
Vim Script
32
star
12

hammerspoon-vimouse

Control the mouse with Hammerspoon in a Vim-ish way
Lua
28
star
13

Developer-Profile

A Google Chrome extension that deletes browser data when all windows in a profile are closed.
HTML
25
star
14

exception.vim

Vim plugin for tracing exceptions thrown by VimL scripts.
Vim Script
24
star
15

gofmt.vim

A Vim plugin that runs gofmt when you save
Vim Script
19
star
16

dootfiles

๐ŸŽต dootfiles beep boop deet doot ๐ŸŽต
Vim Script
18
star
17

spellrotate.vim

Cycles spelling suggestions under the cursor
Vim Script
17
star
18

wstrip.vim

Strip trailing whitespace only on changed lines
Vim Script
16
star
19

nvim-api-viewer

Display Neovim API functions in a buffer for reference.
Vim Script
14
star
20

sshclip

Sever/client clipboard over SSH for Neovim
Shell
13
star
21

dyslexic.vim

๐Ÿ˜ญ Find mistyped text by searching for word permutations
Vim Script
13
star
22

haunted.vim

๐Ÿ‘ป Scripted automation in Vim using ghosts
Vim Script
13
star
23

osx-autoclean

๐Ÿ—‘๏ธ Automatic Directory Cleaning on macOS
Shell
12
star
24

auto_rsync

Automatically rsync a directory watched by fswatch
Shell
11
star
25

anyline.vim

๐Ÿšฅ A highly customizable statusline for Vim
Vim Script
11
star
26

colorpal.vim

Vim theming plugin
Vim Script
10
star
27

hl-goimport.vim

Highlights imported packages in Go
Vim Script
9
star
28

gitbusy.vim

๐Ÿ Stash your Vim session using `git stash` before switching to another branch.
Vim Script
6
star
29

headlines.vim

๐Ÿ“ฐ Quickly edit the top of your source files
Vim Script
5
star
30

luser

Drop-in replacement for os/user in Go
Go
5
star
31

ubuntu-vims

Docker container for builds of Vim from different versions of Ubuntu
5
star
32

nanofish

oh-my-zsh theme
3
star
33

deoplete-server

[WIP] Deoplete server
3
star
34

nvim-checkhealth

:CheckHealth command for older Neovim versions
Vim Script
2
star
35

wstrip-changed.vim

Strip trailing whitespace only on changed lines.
Vim Script
2
star
36

pdfpop

A very simple macOS command line utility for creating PDFs from an existing PDF
Objective-C
2
star
37

zsh-duckduckgo

Get very simple responses from DuckDuckGo in your z-shell
Shell
1
star
38

django-userjs

userjs is a Django application that produces javascript that represents a User object.
Python
1
star
39

shellcolors

Utility for displaying shell colors and finding a close match
Python
1
star