... 8: scroll.js ┃ 9: animation.js ┃ 10: color.py 11: README.md 12: tmux.html ┃ 14: setup.py 16: Makefile 38: kibitaki.py buffers1 #!/usr/bin/env fontforge -lang=py -script | 5082 # -*- coding: utf-8 -*- | 509 ch_pane = changes.get(p.dimensions)3 | 510 for lc in rendered.lines:4 import fontforge | 511 line_str = str_(lc)5 from datetime import date | 512 cl = ch_pane.get(lc.line)6 float | 513 if cl is None or cl != line_str: 7 fight | 514 ch_pane[lc.line] = line_str8 # Source Code Pro の あ る デ ィ レ ク ト リ の パ ス . め ん ど い の で こ の ス ク リ プ ト と 同 じ と こ に お い て く だ さ い .| 515 frame[p.identifier][lc.line] = line_str9 scpro_path = "./" | 51610 | 517 if frame:11 # M+ の あ る デ ィ レ ク ト リ の パ ス | 518 n += (time.time() - n)12 mplus_path = "./mplus" | 519 frames.append({13 | 520 'delay': max(0, n - last_frame),14 # Kibitakiを 生 成 す る デ ィ レ ク ト リ の パ ス | 521 'lines': frame.copy(),15 # 同 じ デ ィ レ ク ト リ に 一 時 フ ァ イ ル も 生 成 さ れ る | 522 })16 kibitaki_path = "./Kibitaki" | 523 last_frame = n17 | 524 time.sleep(interval)18 # .sfd を 出 力 す る デ ィ レ ク ト リ の パ ス | 525 except KeyboardInterrupt: 19 sfd_path ="./Kibitaki" | 526 break20 | 52721 # フ ォ ン ト リ ス ト | 528 # Close the loop22 # Open Sans フ ァ イ ル 名 , M+ フ ァ イ ル 名 , Kibitaki ウ ェ イ ト | 529 if len(frames) > 2:23 font_list = [ | 530 n = time.time()24 ("SourceCodePro-Regular.ttf", "mplus-1mn-regular.ttf", "Regular"), | 531 frames.append({25 ] | 532 'delay': n - last_frame,26 | 533 }) 27 def main(): | 534 frame.clear()28 # 縦 書 き 対 応 | 535 29 ï | 536 str_data = []30 fontforge.setPrefs('CoverageFormatsAllowed', 1) | 53731 | 538 first, frames = frames[:50], frames[50:]32 # バ ー ジ ョ ン を 今 日 の 日 付 か ら 生 成 す る | 539 str_data.append('<script type="text/tmux-data">{}</script>'33 today = date.today() | 540 .format(''.join(utils.compress_data(json.dumps(first)))))34 version = "Kibitaki-{0}".format(today.strftime("%Y%m%d")) | 54135 | 542 for i in range(0, len(frames), 500):36 for (sp, mp, weight) in font_list: | 543 str_data.append(37 sp_path = "{0}/{1}".format(scpro_path, sp) | 544 '<script type="text/tmux-data">{}</script>'38 mp_path = "{0}/{1}".format(mplus_path, mp) | 545 .format(''.join(utils.compress_data(json.dumps(frames[i:i+500])))))39 ki_path = "{0}/Kibitaki-{1}.ttf".format(kibitaki_path, weight) | 54640 sf_path = "{0}/Kibitaki-{1}".format(sfd_path, weight) | 547 return tpl.render('animation.html', panes='', css=self.render_css(),41 generate_kibitaki(sp_path, mp_path, ki_path, sf_path, weight, version) | 548 prefix=classname, data='\n'.join(str_data),42 | 549 fg=self.rgbhex(self.default_fg), 43 def kibitaki_sfnt_names(weight, version): | 550 bg=self.rgbhex(self.default_bg))44 return ( | 55145 ('English (US)', 'Copyright', | 55246 '''\ | 553 def color_type(val):47 Kibitaki: Copylight (c) 2014-2015, lindwurm. | 554 parts = tuple(map(int, val.split(',')))NORMAL ┃ SPELL +0 ~0 -0 animation <py python ┃ tmux2html utf-8 25% 27: 11 E:1 | tmux2html/main.py python ┃ tmux2html utf-8 74% 536: 2113 | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' \ | 1 # tmux2html14 | column -c2 -t -s :)" | 215 | 3 tmux2html captures full tmux windows or individual panes then parses their16 all: ## Build everything | 4 contents into HTML in living  $(HTML) $(STATIC) | 5 The output can either be still snapshots, or animated sequences.18 @: | 619 | 7 With a web server that uses gzip compression, the size over the network is20 watch: ## Grandpa's change monitoring | 8 negligible for reasonably sized windows or panes.21 @while [ 1 ]; do \ | 922 $(MAKE) --no-print-directory all; \ | 1023 sleep 0.5; \ | 11 ## Examples24 done; \ | 1225 true | 13 Some of these may be large in dimensions. You'll need to zoom out if you want26 | 14 to see all panes at once. These are not raster graphics!27 clean: ## Cleanup | 1528 rm -f $(HTML) $(CSS) $(STATIC) | 16 -  `[disk: 134KB, gzip: 11KB]`: https://share.esdf.io/h5lGMPdcZF/full.html31 $(eval V := $(shell echo -n "$$(grep 'version=' setup.py | sed -ne "s/.*='\(.\+\)'\,/\1/p")")) | 19 - Animated `[disk: 638KB, gzip: 262KB]`: https://share.esdf.io/3qdZm2szkN/animated.html32 $(eval NV := $(shell echo -n "$(V)" | awk -F'.' '{print $$1"."$$2"."$$3+1}')) | 20 - Partially Animated (Big) `[disk: 192KB, gzip: 79KB]`: https://share.esdf.io/EJHQXoIQDT/partial33 sed -i -e 's/$(V)/$(NV)/g' setup.py | 21 (Only some panes are animating)34 git add setup.py |+ 22 - "Streaming": https://share.esdf.io/log.html35 git commit -m "Bump" |+ 23 This displays the HTTP log for the links above.36 git tag $(NV) | 2437 | 25 If you decide to look at the telnet animations yourself and don't know how to38 upload: | 26 exit, use `Ctrl-]` then type `quit`. For the Star Wars animation, press39 python setup.py sdist upload -r pypi | 27 `Ctrl-]<enter>` to get the prompt.40 | 2841 $(CSS): assets/base.css | 2942 cat $< | postcss --use autoprefixer --autoprefixer.browsers "last 4 versions" --use cssnano > $| 30 ## Rationale43 | 3144 $(HTML): $(CSS) assets/tmux.html | 32 This was a weekend project I made for fun and I have no particular use for it45 $(HTML):$(TPL_PATH)/%.html:assets/js/%.js | 33 beyond annoying my friends about how bad they should feel for not using tmux.46 mkdir -p $(@D) | 34 I also thought it would be neat to have a render of my sessions that didn't47 cat assets/tmux.html > $@ | 35 result in an image using some crummy font on a headless server.48 browserify -p bundle-collapser/plugin $< | uglifyjs -m -c warnings=false -o .script.js | 3649 sed -i -e '/%CSS%/{ ' -e 'r .styles.css' -e 'd}' $@ | 37 I suppose you can use cron to capture screens and display it on your website,50 sed -i -e '/%JS%/{ ' -e 'r .script.js' -e 'd}' $@ | 38 or use it to create terminal snippets for your blog. You could also load a51 rm .script.js | 39 pane render in elinks within your coworker's session. The only limit is your52 | 40 imagination, my friend. :sparkles:53 $(STATIC): $(CSS) | 4154 $(STATIC): assets/tmux.html | 4255 mkdir -p $(@D) | 43 ## Requirements56 cat $< > $@ | 4457 sed -i -e '/%CSS%/{ ' -e 'r .styles.css' -e 'd}' $@ | 45 - tmux 1.858 sed -i -e '/$$data/d' $@ | 46 - Python 2.7 or 3.4 (could be wrong since it's not tested in lower versions)59 sed -i -e '/<script>/,/<\/script>/d' $@ | 47Makefile make utf-8 66% 39: 38 README.md markdown utf-8 783 words ┃ 12% 17: 42flake8: E302 expected 2 blank lines, found 1