From 1ac073cc30a23b68371e819c77422b4906dd4f20 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Tue, 20 Dec 2022 20:33:57 +0100 Subject: Move to bare theme. --- .../2022-10-11-handling-massive-worlds-in-godot.md | 2 +- ...ing-to-build-a-new-kind-of-terminal-emulator.md | 47 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 content/posts/2022-12-20-trying-to-build-a-new-kind-of-terminal-emulator.md (limited to 'content/posts') diff --git a/content/posts/2022-10-11-handling-massive-worlds-in-godot.md b/content/posts/2022-10-11-handling-massive-worlds-in-godot.md index 9603022..ed917c2 100755 --- a/content/posts/2022-10-11-handling-massive-worlds-in-godot.md +++ b/content/posts/2022-10-11-handling-massive-worlds-in-godot.md @@ -10,7 +10,7 @@ draft: true 1. [Handling lazy loading in 2D world](#handling-lazy-loading-in-2d-world) 1. [Player movement](#player-movement) -> Because these examples are exported from **Godot to WebAssembly** and the packaging produces **large files**, you will need to **click to lazy load them** +Because these examples are exported from **Godot to WebAssembly** and the packaging produces **large files**, you will need to **click to lazy load them** I have seen a couple of examples on the net, but never really a comprehensive guide how this would be achieved. My solution is nowhere perfect, but it will get you started. This code is also not optimized, so buyer beware. diff --git a/content/posts/2022-12-20-trying-to-build-a-new-kind-of-terminal-emulator.md b/content/posts/2022-12-20-trying-to-build-a-new-kind-of-terminal-emulator.md new file mode 100644 index 0000000..fd25cdb --- /dev/null +++ b/content/posts/2022-12-20-trying-to-build-a-new-kind-of-terminal-emulator.md @@ -0,0 +1,47 @@ +--- +title: Trying to build a New kind of terminal emulator +url: trying-to-build-a-new-kind-of-terminal-emulator.html +date: 2022-12-20 +draft: true +--- + +```c +// Create the window +SDL_Window *window = SDL_CreateWindow( + WINDOW_TITLE, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, + WINDOW_WIDTH, WINDOW_HEIGHT, + SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN); +``` + +Over the past weeks, I have been really thinking about terminal emulators, how we interact with computers, the separation of text-based programs and GUI ones. To be perfectly honest, I got pissed off one evening when I was cleaning up files on my computer. Normally, I go into console and do `ncdu` and check where the junk is. Then I start deleting stuff. Without any discrimination, usually. But when it comes to screenshots, I have learned that it's good to keep them somewhere near if I need to refer to something that I was doing. I am an avid screenshot taker. So at that point I checked Pictures folder and also did a basic search `find . -type f -name "*.jpg"` for all the JPEG files in my home directory and immediately got pissed off. Why can’t I see thumbnails in my terminal? I know why, but why in the year of 2022 this is still a problem. I am used to traversing my disk via terminal. I am faster and I am more comfortable this way. But when it comes to visualization, I then need to revert to GUI applications and again find the same file to see it. I know that programs like `fex` and `sxiv` are available, but I would just like to see the preview. Like [Jupyter notebook](https://jupyter.org/) or something similar. Just having it inline. Part of a result. + +It also didn’t help that I was spending some time with the [Plan 9](https://plan9.io/plan9/) Operating system. More specifically [9FRONT](http://9front.org/). The way that [ACME editor](http://acme.cat-v.org/) handles text editing is just wonderful. Different and fresh somehow, even though it’s super old. + +So, I went on a lookout for an interesting way of visualizing results of some query. I found these applications to be outstanding examples of how not to be a captive of a predetermined way of doing things. + +- [Wolfram Mathematica](https://www.wolfram.com/mathematica/) +- [Jupyter notebooks](https://jupyter.org/) +- [Plan 9 / 9FRONT](http://www.9front.org) +- [Temple OS](https://templeos.org/) +- [Emacs](https://www.gnu.org/software/emacs/) + +My idea is not as out there as ACME is, but it is a spin on the terminal emulators. I like the modes that Vi/Vim provides you with. I like the way the Emacs does its own `M-x` `M-c`. Furthermore, I really like how Mathematica and Jupyter present the data in a free flowing form. And I love how Temple OS is basically a C interpreter on some level. + +So I started. I knew that I wanted to have the couple of modes, but I didn’t like the repetition of keystrokes, so the only option was to have some sort of toggle and indicate to the user that they are in a special mode. Like Vi does for Normal and Visual mode. + +These modes would for the first version be: + +- *Preview mode* (toggle with Ctrl + P) + - When this mode would be enabled, the `ls` command would try to find images from the results and display thumbnails from them in the terminal itself. No ASCII art. Proper images. In a grid! +- *Detach mode* (toggle with Ctrl + D) + - When this mode would be enabled, every command would open a new window and execute that command in it. This would be useful for starting `htop` in a separate window. + +The reason for having these modes tooglable is to not ask for previews every time. You enable a mode and until you disable it, it behaves that way. Purely out of ergonomic reasons. + +I would like to treat every terminal I open as a session mentally. When I start using the terminal, I start digging deeper into the issue I am trying to resolve. And while I am doing this, I would like to open detached windows etc. A lot of these things can be done easily with something like [i3](https://i3wm.org/), but also that pull you out of the context of what you were doing. I would like to orchestrate everything from one single point. + +In planning for this project, I knew that I would need to use a language like C and a library such as [SDL2](https://www.libsdl.org/) in order to achieve the desired results. I had considered other options, but ultimately determined that [SDL2](https://www.libsdl.org/) was the best fit based on its capabilities and reputation in the programming community. + +At first, I thought the idea of a hardware accelerated terminal was a bit of a joke. It seemed like such a niche and unnecessary feature, especially given the fact that terminal emulators have been around for decades and have always relied on software rendering. But to be fair, [Alacritty](https://alacritty.org/) is doing the same thing. + + -- cgit v1.2.3