Add blog post
continuous-integration/drone Build is failing Details

master
Garrett Mills 1 year ago
parent e56d9f09a4
commit b6102ea7f6

@ -0,0 +1,85 @@
---
title: Down the Rabbit Hole of Linux Terminal Emulators
slug: down-the-rabbit-hole-of-linux-terminal-emulators
date: 2023-04-28 00:20:00
tags:
- linux
---
For years now, I've used an excellent drop-down terminal emulator called [Guake](http://guake-project.org/index.html) -- a GNOME port of Quake. It supported every feature I needed: Wayland (mostly), tabs, custom shortcuts, custom shell, transparency, and a toggle command (`guake -t`) that plays nice w/ custom keybinds in GNOME.
Recently, however, I've found myself wanting something akin to Vim's visual mode in Guake (specifically the ability to copy-paste chunks of output like file names into the command).
While Guake doesn't support this, the [`screen` command](https://www.gnu.org/software/screen/) does:
1. Press `C-a [` to enter copy mode.
2. Move the cursor to the text you want to copy and press space.
3. Highlight the text you want to copy and press space again to copy the selection and return to normal mode.
4. Press `C-a ]` to paste at the cursor.
This is exactly what I wanted. Now, I just need to make `screen fish --login` my default shell in Guake. This presented a couple issues.
First, because I am using a GUI-based terminal emulator, I want to use its scroll-back functionality. By default, `screen` buffers output and provides its own implementation of scroll-back.
Luckily, this was easy enough to change with a line in my `~/.screenrc`:
```text
termcapinfo xterm*|xs|rxvt|terminal ti@:te@
```
The next problem was... not so easy to solve.
<center><br><img src="https://static.garrettmills.dev/assets/blog-images/terminal-1.png"><br>
<small>Guake's preferences dialog.</small><br><br></center>
While Guake allows you to select a custom shell, it does _not_ allow you to specify a custom command. I need to do this because `screen` does not register itself as a shell w/ the system.
Sooooo using Guake is out of the question if I want to use my new Franken-screen shell setup.
## GNOME Terminator
<center><br><img src="https://static.garrettmills.dev/assets/blog-images/terminal-2.png"><br>
<small>GNOME Terminator's preferences dialog.</small><br><br></center>
I tried several other shell emulators, but they all had game-breaking issues or missing functionality for me personally. Most notably, I actually got [GNOME's Terminator](https://gnome-terminator.org/) tiling emulator completely set up to my liking. When I tried to replace my keyboard shortcut for Guake, thought, I discovered that there's no CLI flag to "toggle" the current window to make it behave like a drop-down shell.
## Tilix
<center><br><img src="https://static.garrettmills.dev/assets/blog-images/terminal-3.png"><br>
<small>Tilix's Quake mode, Wayland edition.</small><br><br></center>
I also tried [Tilix](https://gnunn1.github.io/tilix-web/), another tiling emulator. Like Terminator, it had preferences for everything I like to customize in Guake -- it even has a Quake mode that makes it behave as a drop-down shell! Unlike Terminator, it has a CLI flag to show/hide the overhead window.
Unfortunately, Tilix has limited support for Wayland in Quake mode. I was able to get it to work by updating my keyboard shortcut to use the `env GDK_BACKEND=x11` environment.
<center><br><img src="https://static.garrettmills.dev/assets/blog-images/terminal-4.png"><br>
<small>Ah, Wayland, how we love thee.</small><br><br></center>
This too has its own problem. One feature of Guake that I use a lot is the "Open on monitor with cursor" setting. This lets me quickly move Guake between monitors as I'm working.
There is a [well-known limitation](https://www.reddit.com/r/linux/comments/qid50x/does_anyone_else_feel_that_wayland_is_taking_away/) of Wayland where Wayland apps are restricted from accessing certain information about the displays and other running applications. This prevents Tilix from being able to determine which monitor the active cursor is on.
This problem is not unique to Tilix. I use the excellent [Ulauncher](https://ulauncher.io/) tool. On X.org, Ulauncher opens on the monitor where the cursor is. On Wayland, it picks the monitor seemingly at random.
While searching around for this issue, I stumbled upon [a comment](https://github.com/gnunn1/tilix/issues/2049#issuecomment-1140499490) on an issue in the Tilix GitHub which pointed me to a GNOME extension of all things called DDTerm.
## DDTerm
<center><br><img src="https://static.garrettmills.dev/assets/blog-images/terminal-5.png"><br>
<small>DDTerm and its glorious, glorious preference dialog.</small><br><br></center>
[DDTerm](https://github.com/ddterm/gnome-shell-extension-ddterm) is "Another Drop Down Terminal Extension for GNOME Shell" and has managed to be a perfect drop-in replacement for Guake for me. It supports, among other things:
- A custom command to use for new sessions (`screen fish --login`)
- A DBus command to toggle a single instance (`gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/ddterm --method com.github.amezin.ddterm.Extension.Toggle`)
- Transparency
- Customizable keyboard shortcuts/color theme/fonts
Plus, because it's running in GNOME directly, it can access the compositor to correctly determine the monitor where the mouse lives!
## Conclusion
This rabbit hole was probably 2 hours of on-again-off-again tinkering w/ various terminal emulators, but I have landed on:
- Shell: Fish Shell wrapped in GNU Screen
- Emulator: DDTerm
- Custom `.screenrc` to enable literal scrollback
- Custom GNOME keybinding to toggle DDTerm
Loading…
Cancel
Save