aboutsummaryrefslogtreecommitdiff
path: root/content/posts
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2022-12-20 20:33:57 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2022-12-20 20:33:57 +0100
commit1ac073cc30a23b68371e819c77422b4906dd4f20 (patch)
tree52469a6067a714dc93fb5a971ab620dd4a1c6c46 /content/posts
parent6342c2d1cc08bf6edb7f0ffdbdb69ce5b8be62dd (diff)
downloadmitjafelicijan.com-1ac073cc30a23b68371e819c77422b4906dd4f20.tar.gz
Move to bare theme.
Diffstat (limited to 'content/posts')
-rwxr-xr-xcontent/posts/2022-10-11-handling-massive-worlds-in-godot.md2
-rw-r--r--content/posts/2022-12-20-trying-to-build-a-new-kind-of-terminal-emulator.md47
2 files changed, 48 insertions, 1 deletions
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
101. [Handling lazy loading in 2D world](#handling-lazy-loading-in-2d-world) 101. [Handling lazy loading in 2D world](#handling-lazy-loading-in-2d-world)
11 1. [Player movement](#player-movement) 11 1. [Player movement](#player-movement)
12 12
13> Because these examples are exported from **Godot to WebAssembly** and the packaging produces **large files**, you will need to **click to lazy load them** 13Because these examples are exported from **Godot to WebAssembly** and the packaging produces **large files**, you will need to **click to lazy load them**
14 14
15I 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. 15I 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.
16 16
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 @@
1---
2title: Trying to build a New kind of terminal emulator
3url: trying-to-build-a-new-kind-of-terminal-emulator.html
4date: 2022-12-20
5draft: true
6---
7
8```c
9// Create the window
10SDL_Window *window = SDL_CreateWindow(
11 WINDOW_TITLE, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
12 WINDOW_WIDTH, WINDOW_HEIGHT,
13 SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
14```
15
16Over 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.
17
18It 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.
19
20So, 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.
21
22- [Wolfram Mathematica](https://www.wolfram.com/mathematica/)
23- [Jupyter notebooks](https://jupyter.org/)
24- [Plan 9 / 9FRONT](http://www.9front.org)
25- [Temple OS](https://templeos.org/)
26- [Emacs](https://www.gnu.org/software/emacs/)
27
28My 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.
29
30So 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.
31
32These modes would for the first version be:
33
34- *Preview mode* (toggle with Ctrl + P)
35 - 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!
36- *Detach mode* (toggle with Ctrl + D)
37 - 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.
38
39The 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.
40
41I 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.
42
43In 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.
44
45At 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.
46
47