This Week I Learned: 2020 W20

MacOS scripting, RubyMine windows, and the HTML spec

Published May 17, 2020

Setting MacOS mic input volume

In my Six Months on a Mac experience report, I mentioned that the flawless Bluetooth audio connections comes at the price of tweaking the left-right balance on my headphones sometimes. It turns out there’s actually a second problem!

Sometimes, when I turn on my headset (a Jabra Evolve 75) and join a Zoom call, I’m essentially inaudible to everyone else on the call. I’m still figuring out the cleanest way to reproduce this, but it happens when I connect with the boom mic up, down, moved after joining, moved before joining, toggled with the mute button, etc.

I can be heard again by going into the MacOS sound settings and sliding the input volume for my headset up to 100% (it’s usually somewhere below 10% when this happens). But this is annoying because I have to wait for sound settings to open and use the mouse to drag the slider.

On Linux, I can set sound settings with a shell command, whether it’s pulseaudio-ctl, pacmd, or the ALSA equivalents I can’t remember. So I looked for a way to do the same thing in MacOS. I found an article about muting which also included instructions for setting to an arbitrary volume.

So now I have this in ~/.local/bin/fix-mic:

1
2
!#/usr/bin/env bash
exec osascript -e 'set volume input volume 100'

I run that whenever I join a call now, just in case.

With that solved, I tried to do the same for the balance problem using this StackExchange answer. However, when I run that, I need to grant iTerm2 permission to modify system settings in general. I’m not comfortable enough with MacOS yet to trust every shell session with that privilege. Putting that in ~/Applications/FixSoundBalance.applescript opened in a script editor rather than executing. I’m sure there’s a real solution here, but I needed to actually get work done that day. The quest continues!

RubyMine tool window modes

When running unit tests in RubyMine, I usually switch between “Dock pinned” when I’m single-screen and “Window” when I have multiple monitors. I never used the other modes, partially because their utility wasn’t obvious to me from their names: “Dock unpinned”, “Undock”, “Float”. The official docs explain the differences. I still don’t use any of the other modes, but at least now I know what they do!

HTML content models

I’ve been helping my brother get into Web development by working on his portfolio website. We’ve been having fun and learning a lot! I’ve told some stories about how it was “back in my day” when dynamic content was in PHP and we had to center our divs uphill in the snow both ways. And he’s shown me how fun it is to fork someone’s CodePen, remix it, and make it your own.

This week, we were debugging some funky flexbox rendering and came across some HTML that Prettier refused to format:

1
2
3
4
5
6
<p>
  Lead-in to an ordered list:
  <ol>
    <li>List item</li>
  </ol>
</p>

It turns out that’s invalid! StackOverflow saves the day as usual: A <p> element can only contain phrasing content. The spec lists every tag that matches, but it roughly consists of elements that my intuition categorizes as “naturally inline”.

Because the official WHATWG spec is so easy to read (I don’t remember it having this much CSS before!), I read up on the other content models. My new favorites: nothing and palpable.

MacOS emoji keyboard

It’s well-known that remote-first work focuses on asynchronous text-based communication, which needs extra attention to tone and emotion. Slack has made it easy to use inline and reaction emojis, which helps a lot! (The custom emojis help express organization-specific emotions.) They’ve become such an integral part of my communication style now that I’ve started using them in places that aren’t even chat, like GitHub pull requests.

MacOS provides an easy way to put an emoji anywhere: Ctrl+Cmd+Space (official docs). Now to get that set up on Linux… 🤔