Blog Posts
Managing Wezterm Keybindings, or Merging with Lua
As I expand my Wezterm usage, I find that either (a) a third-party module will have default keybinding configuration I want to adopt, and/or (b) I want to segregate keybindings related to specific contexts into separate modules to simplify my configuration.
Keybindings are stored as a list of tables (what we call associative arrays in PHP). Simple, right?
Unlike in other languages I use, Lua doesn't have a built-in way to merge lists.
So, I wrote up a re-usable function.
Wezterm GUI Notifications
Wezterm has a utility for raising GUI system notifications, window:toast_notification(), which is a handy way to bring notifications to you that you might otherwise miss if the window is hidden or if a given tab is inactive.
However, on Linux, it's a far from ideal tool, at least under gnome-shell. (I don't know how it does on KDE or other desktop environments.) It raises the notification, but the notification never times out, even if you provide a timeout value (fourth argument to the function). This means that you have to manually dismiss the notification, which can be annoying, particularly if the notifications happen regularly.
So, I worked up my own utility.
Escaping Regex Characters in Lua
Quick little note mainly for myself: Lua regex is different than PCRE. The big place it differs is in where you escape pattern matching characters (e.g. ., ?, +, etc.). In PCRE, you escape these with a leading backslash (e.g., \., \?, \+). However, with Lua, you use the % character: %., %?, %+.
Diagnosing Vivaldi resource usage
I recently noticed my CPU usage was high, and it was due to my open Vivaldi browser. I wasn't sure what tab was causing the issue, so I searched to see if Vivaldi had any tools for reporting this.
It turns out that Shift-Esc will open a task manager, and you can sort on any of:
- Task (a string representing high level things like the browser as a whole, GPU process, worker tabs, and more)
- Memory footprint
- CPU (this was what I was interested in!)
- Network usage
- Process ID
You can select any task to end its process.
I was able to quickly track down the issue to a background worker running for a PWA window I'd closed earlier, and ended the process.
Do you know the preferred Docker compose file name?
I've been using Docker for... a long time now. So having a docker-compose.yml file in a project is pretty natural and common for me.
Today I learned that the preferred file is now compose.yaml (though compose.yml is also allowed), and that the docker-compose naming is only supported for backwards compatibility. (See the Compose file documentation if you don't believe me!)
Funny enough, the compose tooling doesn't call this out, even though it now calls out the fact you don't need to use the version setting any more.
Fixing Generation of wl-clipboard Transient Windows When Used with Neovim
I have been plagued recently with issues stemming from neovim's interaction with the system clipboard. Every time I would copy text in nvim, I'd get a transient wl-clipboard window. Inside nvim, paste would work fine, but outside it, the system clipboard seemed not to get the contents.
I finally tracked it down to how Wezterm is interacting with Wayland.
And the culprit appears to be... the muxer.
Using CloudFlare to Validate DNS For An ACM Certificate
I recently received a notification from AWS indicating that ACM certificates I had in place for some S3 buckets I expose for websites could not renew due to an inability to validate via DNS.
Figuring out how to make it work was non-trivial, so I'm writing it up so I can remember in the future, and maybe save somebody else some trouble, as everything I found had to do with auto-provisioning via Terraform.
Copy A File From A Docker Container to the Host
Occasionally, I want to get a file from a Docker container back to the host system.
First, you need to get the container ID; you can do this using docker ps.
Once you have that, use, docker cp as follows:
docker cp <containerId>:/path/to/file/in/container path/on/host
Miscellaneous Postgres Commands
I switched over from SQLite to Postgres to power my site some months ago, and have found myself having to learn some new usage when interacting with the database. These are likely very old hat for anybody familiar with Postgres, but I find myself having to remind myself what they are.
Wezterm Dropdown in Gnome
In a previous article, I detailed how I use Wezterm.
One goal I had when switching to Wezterm to was to ensure I was able to continue using a dropdown terminal, and in that article, I detailed using the tdrop utility to implement this... but with the caveat that it didn't work well under the Wayland environment.
Well, I've now found a better solution.