Contact

Subscribe via Email

Subscribe via RSS/JSON

Categories

Creative Commons Attribution 4.0 International License
© Rakhesh Sasidharan

Elsewhere

Trying out macOS 11 (Big Sur)

So WWDC 2020 was this past Monday. I didn’t watch the keynote but I downloaded macOS 11.0 soon after that from Beta Profiles. Not sure what I was thinking really, it’s a bit of a silly move downloading a beta version of macOS, especially considering even “stable” versions like 10.5 have been flaky. Anyhoo, too late to think about it now … the only solace is that at least I didn’t install it on my primary Mac, so assuming it doesn’t cause any data corruption like delete my iCloud files or emails I am good. Worst case I will just re-install the older version. 

First impression – the new look took a minute to get used to, but once I did I started liking it. It feels a bit too bright to me, but that’s probably just my eyes. 

I couldn’t try the new colourful wallpaper as it would keep going to the Catalina wallpaper whenever I’d select that. I was able to use the Big Sur mountain wallpaper though – that works. 

Funny this, just earlier that day I was reading a blog post about monitors (yay for the author – good post!) and had turned off font smoothing in the OS. Interestingly, after upgrading the option is no longer available. Has Apple turned off font smoothing for good in macOS 11? That’s good if they have. 

I love the newish Music and Podcasts app. They are new in the sense that they are newer than the version in 10.5. I prefer the new look and I enjoy using these apps now. I also like the new look of the Dock, how it has rounded corners and is slightly lifted from the base (bottom or sides of the screen – wherever it is placed). For some reason with macOS 11 I have moved the Dock to the left side as I find it better there. Somehow the change in look has made me feel like putting it there (when I had put it there with earlier versions of macOS I didn’t like it). 

The upgrade broke a few apps as expected:

  • Bartender is unable to control the menubar items any more.
  • Karabiner Elements is broken (you can follow this issues page for a discussion). I simply turned off Karabiner and stopped using the Microsoft Sculpt keyboard for now (that’s the reason I was using Karabiner Elements) and went back to the Magic Keyboard.
  • Toothfairy works as usual – good!
  • No issues with Alfred 4 either.
  • Contexts works but the theming is broken. Not a big deal.
  • Homebrew broke. Thankfully the fix is simple – download the latest Xcode and CLI tools from Apple. Thanks to the people at this issues page for pointing me in the right direction. 
  • That’s it for now! This is not my primary Mac so I don’t have too many apps there. The only other apps I have are stuff like LastPass, Bitwarden, BBEdit, TextMate, iTerm2 … and all these work fine. 
  • Oh, forgot! Safari Developer Edition doesn’t even launch. Expected I guess. (Update – 26th June – now fixed in an update)
  • The Music app still has this bug wherein when I am listening to a song and I add it to my library it stops playing the song. I’ve had it since macOS 10.15, I just put up with it.

Checkout this WWDC 2020 music playlist from Apple while you are at it. Good stuff!

Converting iTerm2 colours to Windows Terminal colors

I want to convert an iTerm2 colour scheme such as this one (Ubuntu) to the Windows Terminal color scheme. I have no idea how to do this! I have no idea what those iTerm2 colour schemes even mean. It is an XML file with what looks like RGB values in decimal. Moreover, instead of specifying colours it has entries like “Ansi 1 Color” etc. Whatever that means!

Here’s an excerpt of the file:

I want to try and figure out what these mean and how I can convert them to an iTerm2 format. Going to try and do this as I make notes in this blog. Hence some of the steps below might seem obvious or elementary. 

I can download a colour scheme thus:

And quickly view the colour keys thus:

Here’s the output:

Since each <key> element has a <dict> too I can view those thus:

Output:

What does this mean? RGB scales are usually on a 0 – 255 scale, so this confused me. After some Googling I realised you can have them on a 0 – 1 scale too. Thanks to StackOverflow. So a number X on the 0 – 255 scale can be converted to the 0 – 1 scale by dividing it by 255. Therefore a number in the 0 – 1 range above can be converted to 0 – 255 scale by multiplying it by 255. From there it’s an easy step to converting to RGB values in hex. Cool!

At this point I have the following rudimentary script:

If I do $valuesArray[0] I get the first line, and if I do $valuesArray[0].real I get an array of 3 colors – Blue, Green, and Red. 

Ok, so I need something that will convert these to hex. Time to create a function:

Let’s try it out:

Cool! Quick test with my array:

Nice! I can just capture this into a new array:

So at this point I have a $hexColorsArray with the hex values of the colors, and I have a $keysArray with the “Ansi 0 Color” etc. whatever that is. 

Here’s a place where one can find Windows Terminal themes. A sample theme looks like this:

I have no idea how to map the iTerm2 keys to these! Eugh. 

Here’s what the colors section of my iTerm2 looks like:

Ok, so that’s 8 colours (Black – White) along with their bright variants. Hmm, those line up with the colours on this Wikipedia page too. And I have similar entries in Windows Terminals, so what I need is a mapping like this:

That’s not all the colours as I am missing the following from the iTerm2 side:

Hmm, turns out the sample colour scheme I was looking at is not complete. Looking at the official docs here’s a default colour scheme:

So I’ve got four more to add. There’s three entries that I don’t have a mapping for so I’ll make a dummy mapping for these now, and prefix with an exclamation mark to ignore them later. Let’s put this into a function:

I can convert from one to another thus:

So at this point I have $winColorNamesArray and $hexColorsArray array. All I have to do now is output a JSON colour scheme. That’s easy, loop through the arrays, ignore the colours I marked earlier, make a hash-table of the rest, add a name key based on the URL, and put all this into JSON. That sounds big when I say, but is simple in PowerShell:

Awesome. Let’s try this now:

Paste this block of JSON into my Terminals settings fine, assign one of my entries the theme “Ubuntu” (or whatever your theme name is), and voila! here’s my command prompt with this theme. 

I’ve put the final script in my GitHub repo here in case it’s of use to anyone else. 

Update: The script has been updated to also allow one to specify an already downloaded iTerm2 colours file as input. 

Move multiple Safari macOS tabs to a new window

One of the neat things with browsers such as Firefox is that you can select multiple tabs in a window, right click, and move them to a new window. Very useful if you have a lot of tabs and want to split some out. In Safari on macOS however, you can’t do that. You can right click a single tab and move it to a new window, or you can drag a tab each to a new or existing window, but there’s no way to select multiple tabs and move them out. I usually drag tabs one by one, but that’s a hassle as I have to put the new window side by side or next to the existing window and then drag and drop. I don’t like moving my windows around much coz I like the position at which I have organised them. 

Today I discovered a workaround by accident. Either left click a tab and move it all the way to the left, or right click a tab and pin tab. Unlike other browsers, when you pin a tab in Safari it is pinned on all windows (which can sometimes be useful but is usually irritating and confusing – to me at least). This feature is useful in my current scenario however, because now I can open a new window or go to whichever window I wanted to move these tabs into, right click the pinned tab there and unpin it. Yes I have to do it one by one, but at least I don’t have to drag tabs around or move windows. When I unpin the tab on the destination window, it automatically disappears from all other windows. Nice!

[Aside] Demystifying the Windows Firewall

Quick shoutout to this old (but not too old) video by Jessica Payne on the Windows Firewall. The stuff on IPSec was new to me. It’s amazing how you can skip targeting source IPs and simply use IPSec to target computers & users or groups of computers & users. 

Docker Bash completion in macOS

I came across this when trying Docker in Ubuntu. Bash would autocomplete Docker commands. Things like docker im<tab> to complete commands, or even docker logs <tab> to complete container names. 

Googling on this got me to this page, which was for Docker Compose; and also this page, which was for Docker Machine. Somehow I then chanced on the correct page for Docker CLI Bash completion, which is what I was interested in. I forget how I stumbled upon it, it was through some blog post from 2016 or so which took me to an outdated GitHub page from which I came to the correct one – this. After installing bash-completion on macOS, follow the steps on that page and you are set. 

While Googling I also came across this page which I am yet to read fully. Looks useful. 

Madeline Miller interview (and a quote)

Here’s the quote (emphasis mine):

One of the things about Greek mythology that’s so interesting is just how horrible the gods are. The gods are really not exemplars. You might aspire to have the kind of power that they have, but, for the most part, they aren’t virtuous. They’re petty and selfish. The fact that they have achieved this ideal situation of having all the power, eternal life, the ability to fulfil every desire has not made them good people. If anything, it has done the opposite.
 
That was something that I really wanted to explore in Circe: this idea of when you do get everything you want, when you do have absolutely everything, it doesn’t make you a good person, actually. It makes you kind of a terrible person.

Psychological studies have proved that that is, in fact, correct: When human beings are given ultimate privilege and ultimate power, unless they actively fight against it, [their] empathy immediately starts dropping. You start assuming that if I’m way up here, I must have gotten here because I deserve it. And therefore, everybody who’s down there, they don’t deserve it. So I’m better than they are, and therefore I can treat them terribly if I want to.
 
I think it’s so interesting that the human brain goes there and that the Greeks knew that, and they manifested that in their mythology.

Listen to the interview episode here. The interview is by Ezra Klein on his podcast.