-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for asciinima input display #1
Comments
Display everything including the escaped unicode
These two line are the what makes the feature work: |
Added key mapping and decoding
|
@zachmandeville can you take a look at this and add it to an org file? I think we are getting close! |
I took a look at the ticket description and current work. @abdabTheCreator did great work in that asciinema-keydisplay repo to show the inputs above an embedded cinema cast. I am not certain if that is what the ticket is asking for, though, beecause I am not quite sure what the ticket is asking for in general hahaha. I wrote up an org file to try to capture the current situation, what we're trying to do, and my questions. I pushed it to our org repo, as I don't want discussion org files in this slim config repo. The contents are included in this comment below, too:
IntroductionThere is an open ticket in ii/doom-config titled “display recorded input in an overlay”. It is about using asciicinema with org and tmux to create screencasts. This org file is meant to track current thoughts around the ticket, its purpose, and where it fits into the doom-config. Using asciicinemaasciinema(homepage) is a tool for recording your terminal sessions, with a mechanism for playing back or sharing these sessions when done. It is useful for recording demos or recording help videos displaying the steps to enter into a terminal. The output of running asciicenma is a asciinema.orgyou can upload the cast you made with the command
this returns a private archive.org url with your playback. It ends up looking a bit like youtube, but only with terminal casts. asciinema playerAlternately, you can embed the cast into your own website using asciinema-player. This is a combo of css and javascript that you add to your own page and then display the cast file without having to upload it anywhere else. the css and js can be downloaded from their repo, or you could host them somewhere and then link to them externally. A simple version of the html page would look like so <html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://link.to/asciinema-player.css" />
</head>
<body>
<div id="cast"></div>
</body>
<script src="https://link.to/asciinema-player.min.js"></script>
<script>
AsciinemaPlayer.create('/example.cast', document.getElementById('cast'));
</script>
</html> In the above, you would have asciinema to svgThere is also a cast-to-svg tool you can use so that you can embed the recording without needing additional CSS and javascript. https://github.com/marionebl/svg-term-cli this tool takes a cast file as input and outputs a named svg. Then you’d end up with html like so: <html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<img src='/example-cast.svg' />
</body>
</html> the longer the session, the bigger the file, and so if we are meaning to do incredibly long sessions, or having multiple casts on a page, this may not be the best option, but it could be useful for including asciinema output into an org file’s exported html. For example, you could have an org file with a tmux block of
and then below it as “results” you’d see the terminal session of just this command, showing docker pulling the file and printing out hello. Capturing keyboard input.You can capture your key input during an asciicinema session by passing in the –stdin flag at the start of the session. The resulting file will include a data map with the unicode characters pressed. You can then add some additional javascript to translate that unicode to their correct symbols and then paste it somewhere on that embedded webpage. Abby does a great breakdown of that, with an demo site, in the repo abdabthecreator/asciinema-keydisplay . In the demo site, the keys display above the embedded cast. Overlaying the keys onto the cast, in semi-transparent font, is just a matter of some CSS. Essentially, you’d put both in a wrapper How does this fit into the doom config?To be honest, I am not sure yet! From the start of the ticket, it seemed like we were wanting to incorporate asciinema into tmux blocks. When we run the blocks, we do it inside an asciinema session. This would be handy for saving the resulting work as a playback video of sorts in the end. However, there aren’t really keypresses we need to catpure here. All the work is being piped in from tmux. Some of the examples seemed to imply we’d open up emacs in the tmux session, that is connected to another emacs client, and then use that parent client to pipe in keypresses via tmux to the second client. This seems unecessarily convoluted, and I’m not sure the use case. If we are trying to show a playback of the tmux command being run in some final html, then it feels like we’d want to wrap each tmux command in an asciicinema invocation, with the resulting file name and path being passed in from the src block. We could then just put an img tag beneath each block that has that name, using some elisp triggers and such. Is that what we are trying to achieve here? As it relates to the doom-config, I imagine we’d likely figure out the exact elisp we’d want to run and then add that to our existing ob-tmux library as an additional option to pass in. This seems the cleanest way. Capturing key presses in an emacs org fileThe other intention I can see here is to capture our keypresses in the org file itself. We want to show how you can navigate from code block to code block and hit ctrl-c ctrl-c to trigger that codeblock. The idea being that we can create cooperation templates for learning labs, that come with our emacs and some file you are meant to read through and excute the scripts as you approach them. In this case, the person isn’t trying to use emacs, emacs is more of a executable document viewer. If that is the case, I think it’d be better to record a screencast separate from the org file, since it is intended to show the keypresses for any org file. We could then link to that screencst in our documentation. Alternately, it is possible to present elisp functions as a link. So we could hae a link above each code block that, when clicked, runs the command “excute this code block”. The person reading through the document only needs to know how to scroll and click. At that point, though, it might be more useful to think about a rendered website that has these links as buttons that pass the info to the emacs server which then runs the command. Then, when someone is starting up their lab, they just navigate to a given page, read the instructions, click where they’re meant to, and see the output in a tmux window open on another tab. this is approaching katacode and other online labs connected to VM’s…which is maybe what we want? In either case, this seems like work that would happen outside the doom-config, and wouldn’t require recording keyboard presses in tmux blocks. Current thoughtsAt the moment, I would like to discuss what our hoped-for goal is, and where that work is best done. The ticket is open in doom-config, but this may not be where the work is needed? |
What I would like to add to this repo is It may be that we use a hosted asciinima, or place the files within a certain place in the current folder (probably want both options long term). I think eventually this work will find it's way into the doom-config, as we figure out what changes need to be made as defaults for Another feature later, it to |
Much of this is to create slides or content that others will be able to understand the keystrokes being sent as folks use emacs, shell, and other terminal applications that may be a completely new concept to them.
Not necessarily, some of this is launching sessions of emacs to record the keystrokes so others can scrobble in the player along to learn what keys are pressed.
I suspect the 'left eye' is most cases will not be in a tmux session, but in the broadway gui. Folks will click on the gui version, driving the 'right eye' which is the tmux session (and recorded keystrokes).
Primary use was is left eye / gui emacs, driving right eye / tmux (sometimes emacs, sometimes vi, and others), to help create slides and presentations that others can use to share what they did (including keystrokes). |
Might be useful in some scenarios, but as an additional approach. |
Related: #3 |
I've gotten this pretty close, I'd like @zachmandeville to look at using https://coder.ii.nz/templates/iipod/workspace and invite me to show what's missing or alternatives. |
I checked out the template (in the currently running workspace i ran several tmux blocks, which created a cast file upon completion. I then exported it as a revealjs presentation. I then opened up the exported html file in the browser and could see on each slide the tmux output. For command 4, it opens up emacs in tmux. so I then went to that emacs session aand tried opening a file, writing a line, and deleting the line. I wanted to see if keypresses came through. I found, when looking at the resulting .cast, the coloring was all types of distorted that it made it difficult to tell what was on the screen let alone if the keypresses shown. There are several layers of terminal coloration happening though. We have the terminal itself, then the emacs theme, then I opened an org file with src blocks so there was an additional gray color for each block. This was then converted into an html inside the reveal.js. Somewhere in that block there is a colour disagreement. I think it is really slick to have a tmux session run that then saves a recording of that output. It's something I can see being really helpful too. The recording of an emacs session in the slide had less of an immediate draw, it is meta-recursive in a way that is more confusing to my brain than exciting. Personally, I think recording emac session to teach how to navigate org files and emacs commands, showing the keys pressed as part of a rehearsed/clear session, is useful--but as a separate exercise from this. What I can imagine immediately with this tool is something like: I am writing an org file about setting up a tool (creating a docker contaioner let's say) and i want to show what happens when you invoke |
To reduce the scope here, let's focus on just modifying the command4 block of the https://ii.nz/ii.org file. Just update the html block so that keystrokes are displayed on the command4 slide:
|
https://ii.nz/tmux.org generates https://ii.nz/tmux.html
Adding asciinema
:prologue
and:epilogue
totmux
blocks like this:Will produce a
emacs.cast
file, this can be displayed by putting behind html.Use https://ii.nz/emacs.cast, but follow the instructions here to help me figure out the right way to display the characters we type:
From https://github.com/asciinema/asciinema-player#addeventlistenereventname-handler
The text was updated successfully, but these errors were encountered: