Retrobatch droplet improvement
January 3, 2025 at 3:31 PM by Dr. Drang
Shortly after I published my CleanShot X/Retrobatch post, Allison Sheridan posted this on Mastodon:
That’s a great use of those tools. I am a big fan of Clean Shot X and Retrobatch but never thought of combining them. My main use of Retrobatch is to make featured images for blog posts that match what most if not all of the social media services will recognize. That droplet thing is money. I keep mine in the toolbar of Finder though since I always have a Finder window open when I’ve made a screenshot.
What’s actually money is Allison’s last sentence. Having the screenshot-trimming droplet sitting on my Desktop was the one thing about it I didn’t like. Putting it in the Finder toolbar is perfect because, like Allison, I always have at least one Finder window open when I’m writing blog posts and making screenshots for them.
So I moved the Trim Screenshot app into the Applications folder and set about adding it to my Finder toolbar. I control-clicked on the Finder window’s toolbar, selected
, and dragged the Trim Screenshot icon into the toolbar, putting it to the right of the folder name. Since I keep a post’s screenshots in the same folder as the Markdown source, I always have that folder open when writing. It’s now a simple matter to drag the screenshot from the Finder window up into the toolbar and drop it on the Trim Screenshot icon.There was one more problem. The icon in the toolbar was the generic Retrobatch droplet icon. A fine icon, to be sure, but what if I come up with another Retrobatch workflow that I want in my Finder toolbar? How would I tell them apart? I refuse to change my toolbar display to
.The solution is to change the icon of the Trim Screenshot app. I opened Acorn and built this image:
It’s started as 1024×1024 image saved as a PNG file and is meant to convey the idea that the droplet reduces the Desktop padding in a window screenshot. I later expanded the size to 1400×1400 by adding transparent padding around the outside. I’ll explain why in a minute.
Then I opened Trim Screenshot’s Get Info window and dragged the PNG file onto the icon spot at the upper left corner.
That changed the icon of the droplet in both the Applications window and, most important, in the Finder toolbar.
You may have noticed that the blue in the icon is much brighter than the blue of my Desktop. That’s because when I used my Desktop blue in the icon it just looked gray when the icon was shrunk down. I had to brighten it up to make it look blue to me in the Finder toolbar.
Also, the icon was distinctly bigger than the others in the toolbar when it was 1024×1024. The transparent padding brought it down to a more reasonable size. It could probably be made even smaller, but I don’t want the arrowheads to get too small to see.
Now I have workflow for trimming screenshots that’s easy to use and keeps my Desktop clean. Thanks, Allison!
CleanShot X and Retrobatch
January 3, 2025 at 8:48 AM by Dr. Drang
As last year wound down and software went on sale, I bought some new apps and updated some others. Included in these gifts to myself were CleanShot X, which is as good as everyone has said it is, and the Acorn/Retrobatch upgrade bundle. Over the past few days, I’ve been using CleanShot X and a Retrobatch workflow to handle the screenshots I post here.
As you may know, I’ve long had a couple of Keyboard Maestro macros for dealing with screenshots: SnapClip and SnapSCP. Because of the limitations of the screencapture
command,1 neither of these macros can put both a drop shadow and a Desktop wallpaper around window screenshots. But CleanShot X can, which is why I’ve started using it. But it needs some help from Retrobatch.
Here are the CleanShot X wallpaper settings with the padding at the lowest value possible:
As you can see, the padding around the window is still pretty big, about 110 pixels. I want to trim it down to a more reasonable size, like this:
I don’t mind that part of the shadow gets cut off.
There are lots of ways to do this trimming, but I decided to make a Retrobatch workflow and turn it into a droplet, an app that sits on my Desktop that I can drag screenshots into to get their padding trimmed. Here’s the three-step workflow, which I call
, showing the details of the step:The -70 adjustment on each edge trims the padding around the window down to about 40 pixels, which is larger than what I use in SnapClip and SnapSCP, but looks fine, maybe even a little better. I’ve been fiddling with this value for a couple of days and may change it again as I make more screenshots.
The
step writes the changes back to the original file (I don’t need both versions hanging around), and the step does what it says—without it, Retrobatch would stay open after the resizing, which would be weird for a droplet.The first time I dropped a file onto
, I got this permissions warning:Because the droplet is an app in its own right, the permissions already given to Retrobatch don’t apply; it needs its own authorization. And as I was experimenting with different amounts of trimming, the newly saved droplet kept needing reauthorization. O timid new world that has such warnings in’t!
Unlike SnapSCP, this workflow doesn’t upload the screenshot to my server, but I haven’t been using SnapSCP much recently. Since I often need to annotate screenshots, and I almost always have Transmit running when writing a blog post with images, automatic uploading isn’t as useful to me as it once was. This CleanShot X/Retrobatch/Transmit system is working pretty efficiently.
Update 3 Jan 2025 3:31 PM
Thanks to Allison Sheridan, I’ve moved the droplet to the Applications folder while still keeping it easy to drop files onto it. The explanation (which is a little too long for an update) is in the next post.
-
Yes, that’s a link to an HTML-formatted man page. There will be a post about that soon. ↩
Return to the planet of man pages
January 1, 2025 at 9:48 PM by Dr. Drang
Inspired by Brett Terpstra’s post today about viewing man pages in iTerm via the x-man-page
handler, I made some changes to the way Terminal on my Mac displays man pages and have been thinking—again—about how I should link to man pages here on the blog.
Let’s start with Terminal. Terminal has a profile for displaying man pages that you can, and should, adjust via its Settings. I say you should adjust it because the default background color is a disgusting yellow that no one should be forced to look at. Also, the font size is too small. Here are some of the changes I made,
and here’s how the man page for tr
looks with those settings,
Because I use the bash shell instead of fish, I wasn’t sure what I’d have to do to get Brett’s xman
function to work for me. Turns out, all I had to do was suppress any shame I might feel for direct theft. Now I have this line in my .bashrc
file,
function xman() { open x-man-page://$@ ; }
which is exactly what you’ll find in Brett’s post. With this, typing
xman tr
will bring up a new Terminal window that looks like that last screenshot.
But will I use this? Probably not. I’m still happy with my bbman
command, which brings up the given man page in a new BBEdit window:
It’s obviously plainer than the Terminal version, but as explained in my bbman
post, I have a AppleScript that allows me to select the name of a command in any BBEdit window (including one that’s showing a man page) and bring up that command’s man page with a simple ⇧⌘M keystroke.
So why mess around with Terminal’s man page profile and add xman
to my .bashrc
? It goes back to a problem I’ve had for several years: the best way to link to a man page here on ANIAT.
In the old days, Apple liked to show off OS X’s Unix heritage and had a full set of man pages available on apple.com, and that’s what I would link to when writing about a command. Apple moved those pages once or twice and eventually got rid of them entirely. So I started linking to either GNU/Linux versions of the man pages—which often have different sets of options—or the OS X/macOS versions on SS64.com—which tend to be out of date and not what you’d see if you opened a local man page.
Recently, I’ve been saving the plain text man pages I get from bbman
to the Leancrew server and linking to them there. For example, in yesterday’s post, I linked to the tr
command. If you click on that link, you’ll be taken to
https://leancrew.com/all-this/macman/tr.1.txt
which is the text of the current tr
man page on Sequoia.
You see where this is going, right? I’m considering doing links like this: tr
command, which will open
x-man-page://tr
If you’re on a Mac, clicking that link will bring up a dialog asking to open the man page in Terminal (unless you’re Brett, in which case it will ask about iTerm); if you allow it, the man page will open locally.
This has some advantages:
- It’ll show the current man page on your computer.
- It’ll show it in a format that you control, or at least can control by fiddling with a Terminal profile.
- It means I don’t have to keep uploading text files to my server whenever I want to link to a man page.
There is one serious, perhaps fatal, disadvantage: It works only if you’re reading the blog on a Mac. I think I could work around this by using JavaScript to send Macs an x-man-page
link and other platforms a text file link. This would, of course, entirely wipe out the third advantage above. But I’d live with that if I thought it would improve the blog.
What do you think? If enough readers want links to local man pages via x-man-page
, I’ll try to set it up. If not, I’ll stick with sending you to text files.1
Update 2 Jan 2025 11:10 PM
Jeff Johnson, maker of StopTheMadness, sent a Mastodon toot with an improved version of the xman
function that allows the user to specify the section number before the command name. This makes xman
more like man
, so you can call
xman 3 printf
to get the man page for the library function, and
xman 1 printf
or just
xman printf
to get the man page for the command.
Because I can’t leave well enough alone, I made a slight change to Jeff’s code. Here’s mine:
function xman() {
if [[ "$#" -lt 2 ]]; then
open x-man-page://"$1"
else
open x-man-page://"$1"/"$2"
fi
}
Looking at Brett’s page, I see he’s updated his xman
to make it more fish-like, and he’s also changed the name to nman
. (Or did he always call it nman
?. It’s hell getting old.)
Cleaning phone numbers
December 31, 2024 at 10:56 AM by Dr. Drang
It’s been a while since I ran into a website that asked for a phone number and didn’t know how to clean it of non-numeric stuff like hyphens, parentheses, etc. But today I did, and I realized that I didn’t have a Keyboard Maestro macro that would clean a telephone number on my clipboad before pasting it. Now I do.
There’s basically nothing to it, and I’m not sure why a macro like this wasn’t already in my KM library. The macro has just one step:
It takes what’s on the clipboard, passes it to the shell command,
tr -dC [:digit:]
and then pastes the output.
The ‘tr’ command is generally used to substitute (translate) one set of characters for another. If the -d
option is given, it deletes the characters given as the argument; but if the -C
option is also given, it deletes the complement of the given characters. The [:digit:]
argument means the given set of characters consists of all the digits, so the command as a whole deletes every character that isn’t a digit.
I was going to trigger this with some keyboard shortcut involving V, since that’s the letter commonly associated with pasting, but I already have enough of those. Instead, I set the trigger to the typed string ;pbn
, which I will try to remember as “pasteboard number.” The idea is to make it similar to the pbcopy
and pbpaste
commands, which I use frequently. We’ll see how that works.
I should mention that I already have a Typinator snippet that enters my phone number (digits only) when I type ;cell
. The ;pbn
macro is for times when the website needs another phone number. Today, for example, I was entering an emergency contact number that I’d copied out of the Contacts app.
Given that most websites are smart enough to clean up telephone numbers on their own, I probably won’t need this macro very often. But if I get in the habit of using it whenever I need to paste in a phone number that isn’t my own, maybe it’ll stick in my head.