Brain Drain: Tuesday? This sucks, so have some suckless utils.

I've had one of those soul-sucking days, and not even the fun kind involving a succubus, no, just grocery shopping in this economy. So, for today's post, I'm just going to talk about some of the command-line tools I've written that make my life a little easier.

I've always been a fan of the suckless.org philosophy of simple, focused tools. Inspired by that, I created my own repository of small X11 C utilities called sorta-suckless. The main difference is that my versions tend to have more error checking so I know why something didn't work.

Here are a few of the most useful tools from the collection.


sel: A Better Way to Handle Selections

This tool, inspired by sselp from the suckless suite, is probably the one I use most. It simply prints whatever text is currently highlighted on your screen (the X11 PRIMARY selection) to standard output.

This is incredibly useful for scripting. For instance, if I'm testing Hive API calls, instead of typing out a long JSON object, I can just highlight it in a reference document and pipe it directly into my command:

# Highlight the JSON data and run this command
curl -s --data "$(sel)" https://api.hive.blog

I also use it constantly in Vim/Neovim. I can place my cursor where I want to insert text and just run :$!sel or :'<,'>!sel. The highlighted text from anywhere on my screen is instantly pasted in, without ever touching the system clipboard. (I guess I see why people are still confused by vi 🤣)


lsw: What Windows Are Actually Open?

I see you systray icons!

The lsw utility lists the windows on your display. It's a simple way to get a quick overview of what's running, but I find it especially useful for peeking into things like my system tray to see what might be "hiding" there.


swallow: Seamless Window Replacement

The swallow command is for creating a smoother workflow in a tiling window manager. It temporarily hides the currently focused window (like your terminal) while it runs another application. When you close that application, your original window comes right back. I use it most often for opening documents:

swallow zathura my_document.pdf

This makes the PDF viewer take the terminal's place in my tile layout, and when I'm done reading, my terminal is exactly where I left it.


That's it for today. After that shopping trip, my brain is fried. I'm going to unwind with some PlayStation and my waifus.

As always,
Michael Garcia a.k.a. TheCrazyGM



0
0
0.000
4 comments
avatar

I think I'd go with the succubus over shopping. Those are some nifty tools, and I dig the nomenclature, Sorta Suckless. Oh, and yes, your vi commands confuse me...lol! Recompress well, my friend! 😁 🙏 💚 ✨ 🤙

0
0
0.000