Tag Archives: macOS

macOS log(1): Finding out the previous name of BT device

I got a new mouse yesterday to use it with Mac Mouse Fix, an amazing application that “Makes Your $10 Mouse Better Than an Apple Trackpad!”. I can assure you it does.

The mouse connects via Bluetooth, a short-range wireless technology that even after 25 years, it’s either insecure, unstable or both. Sometimes it’s none, but only when the vendors of both sides are aware of each other.

Anyways. I connected the mouse and renamed it to “Antranig’s Mouse”, now all I need is a cat. An hour later a friend asked me which model was the mouse. I had no idea, but I thought, hey, the original name of the BT device was the model name, right? Maybe I can check that.

Luckily, macOS logs everything, and I mean everything, so I used the log(1) command to see what was the previous name.

Here’s the command to run and what the output looks like

log show --style compact --info --last 12h --predicate 'process == "bluetoothd" && subsystem == "com.apple.bluetooth”' | grep setName
2024-01-06 18:57:38.908 Df bluetoothd[375:8d0c1] [com.apple.bluetooth:CBStackController] setName: device 01903735-1591-7A71-C597-CE40C2ACB232, 'Dell Mouse MS5120W' -> 'Antranig's Mouse'

A simple explanation:

  • style compact: log has styles of output, there’s the default, which is long, and there’s compact, which is short. You can also set it to json.
  • info: type if information, it can also be default or debug.
  • last: time range, can be set to m, h, d for minutes, hours or days.
  • predicate: a macOS predicate, for more information check Predicate Programming Guide.
    • process: a process, in this case bluetoothd.
    • subsystem: a macOS subsystem, in this case com.apple.bluetooth. How did I know that? note sure, but my brains contains a lot of information.
  • grep: Unix grep(1), because we party like its 1969.

I also don’t remember how I knew that I should look for setName, but that’s life for you.

And of course, we get the output, the device was previously named Dell Mouse MS5120W

That’s all folks…

Reply via email.

macOS Sonoma’s Keyboard Layout Switching: When Apple needs actual diversity

I did it, I finally upgraded to macOS Sonoma. To my surprise there’s only a single thing that’s bugging me… Switching the keyboard layout.

Multi-lingual people use multiple keyboard layouts. Most of the time we use custom keyboard layouts because Apple doesn’t like listening to its customers on how keyboard layouts should look like.

Here’s what happens when you switch the keyboard layout on macOS Sonoma

(and here’s the GIF version)

This is really bad, as many people might have multiple layouts which have the same icon. In my case, for example, I use both the Armenian Eastern Alternative layout (custom made, as Apple still ships a very bad Armenian layout) and the Armenian Typewriter layout (custom made, as Apple still… you get the point).

They both have the same “icon” so it’s impossible to know which layout I’m choosing.

Compare this with macOS Ventura where you can see exactly which layout you’re choosing. Here’s a screenshot from Lilith’s computer.

Yes, Lilith uses Armenian Phonetic with English, also a custom layout, as Apple still… didn’t we just do this?

Clearly, Apple lacks diversity. They don’t have people there who use multiple layouts, or custom layouts, or maybe they all just use Emojis to communicate. I really don’t know how this happened, but it was clearly a very bad decision for the majority of the planet.

Dear Apple, if you are reading this, please just email/iMessage/call me, I will show you to to make this better again (just “minify” the old version) and show you the proper Armenian layouts. There are 7 of them. Actually, just have a look at Xorg, the community has published the proper layouts there decades ago.

Thank you.

That’s all folks… 

Reply via email.

macOS Desktops limit?

If you’ve ever wondered how many Desktops you can have on macOS, the answer, based on my 10 second test is 16. I do, however, have two apps in fullscreen mode (OmniFocus and Music.app).

Foo

I wonder if this is per screen. If any of you has an external monitor, please test and let me know!

Fun fact: you cant do “⌘⇪3” (Command+Shift+3) to capture the screen if you’re in Mission Control, instead I ran the following inside a terminal.

sleep 5 && screencapture /tmp/foo.png

If you like to nerd out on Unix-y stuff, here’s a screenshot from the manual page of screencapture(1).

Screenshot 2023 11 02 at 7 52 29 PM

Better documentation is needed, indeed.

That’s all folks…

Reply via email.

Pen and Paper

For the last 6 to 10 months, I’ve been trying to find the proper digital tools to manage my life. Spoiler alert: I keep failing to do that.

In the last 5 years, my main and only job was to do one thing and one thing only, run illuria, Inc., a company that I co-founded with my friends. At some point, specifically when your team has more than three people, you need some kind of task management tool. And I’ll be honest here, I don’t care which one that is, most of them do the same thing anyway. We ended up using Notion, and we like it very much. I like the database feature and my team loves the Kanban boards. Half of the team does development and the other half does development-related things (release engineering, infra) and business-y stuff, such as sales, marketing, what have you, so we never had any issues with Notion.

(To be clear, while I like Notion and any other tool would do the job as well, I have to say that I never liked Jira’s UI/UX. That one is, indeed, enterprise-y, but that’s a story for another day).

But last year I started taking some more responsibilities (kind-of-)outside of work. Co-hosting and producing a podcast, running a community of Armenian hackers, teaching cybersecurity (I actually end up teaching Unix + Networking + how computers work, but turns out that’s what actually 80% of cybersecurity is anyway), contributing more to open-source (specially since we open-sourced our little utility, Jailer) to name a few.

Which meant that I needed a digital tool to manage the non-work part of my life as well.

The obvious choice was to use Notion, since I know it anyway. That ended up being a disaster for a very weird reason: It only works online. Even if you have the desktop app, it’s still just a wrapper around the website with some nice things like desktop notifications and such.

I know, this sounds strange to many people, but I don’t like being online all the time. Sometimes I enable iOS/macOS’s DnD, to get some work done, but sometimes I go completely offline with no distractions at all.

Unlike most other developers, I work completely locally. From my development environment to my infrastructure tools, everything is synced local/prod. This is actually a good reason to not use the fancy features of the cloud, but again, that’s a story for another day.

I have been told, by my friends, that my options are the following:

Go as basic as possible and use Notes.app. Well, I like this option, but I had two issues.

First, it’s Apple only. Yes, you can actually connect the Notes.app to your IMAP account and sync that with other Unix machines using clients like Evolution, but now the features are limited to text only. Not even tables :/

Second, the iCloud sync has some weird issues. not always, but from time to time, I was shouting “WHERE ARE MY NOTES???” just to see them appear minutes later.

Apple Notes.app? tested, liked it overall, but it’s not for me.

My friends’ second option? Go as deep as Obsidian!

I fired up Obsidian and I fell in love immediately. It was like love at first sight. Vi keybindings? it’s there. Plugins? it’s there. Run shell commands on your notes? it’s there!

After couple of days, I had everything ready. I had my folders (please, let’s call them directories!), my notes all migrated, all the plugins I needed for my weekly and daily notes (similar to what we had on Notion at work), etc etc.

And then days passed, and then weeks passed. What happened? I totally forgot that Obsidian even exists. I noticed that my wall had… sticky notes (FreeBSD branded!), my Mac had… sticky notes!

This made me so frustrated for multiple reasons.

Not that I only had two types of sticky notes (analog and digital), I also could not “search” in them!

I ended up turning the analog notes into digital, and tagging them at their title, so I could at least search using the macOS Window API.

And then I saw something awesome. Cortex Podcast released the Sidekick Notepad!

Wait wait wait, are you thinking that I bought the Sidekick Notepad? Nope, I did not 🙂

But what I ended up doing is putting all of our office’s legal pads next to me at home, we were not using them in the office anyway!

Two weeks later and I’m writing everything as needed. I take notes, I write my todo lists. I made my legal pads horizontal, similar to the Sidekick Notepad and woof is was awesome!

For a moment there I started using the Moleskine Classic Notebook, since it was more portable than yellow/white legal pads, but that didn’t work as well. I guess I needed something that can be teardown on the fly and no very-hard cover.

Why am I telling you about all of this? Well, uncle Dexter has asked on Mastodon “500 reMarkable ads later… Is anyone using one? Would you recommend it?”

I have used reMarkable (the first one), and I loved it. Not because it was an awesome technology or such, but because it made me think the same as if I was writing on paper with a pen.

So, if you, like me, have suffered for a long time to find the best “digital time/notes/todo management tool”, then you’re probably an analog person, like me.

Just take a sheet of paper, start writing on it with a pen.

That’s all folks…

P.S. I might actually end up buying the reMarkable 2 and check how that goes, or even the Sidekick Notepad. But with my writing speed, I’d need at least 4 Sidekicks every 3 months. Let’s wait and see 🙂

Reply via email.

More macOS Display Resolutions

I assume that this feature has been around for a while, maybe it came with Ventura, but I noticed it just today.

Turns out, if you have a MacBook Air and you want more resolution in the expense of sharpness, you can go to System SettingsDisplays, Click on Show all resolutions and get more options.

Screenshot 2023 05 15 at 1 04 07 PM

I just moved from 1680×1050 to 2048×1280. While I don’t recommend this for most people, it it useful if you do development in your terminal (like I do) and want to see more context.

Reply via email.

Light & Dark Wallpapers for iOS: Solving a problem that Apple created

One of the best features of macOS is the ability to have Light and Dark, as well as Dynamic Wallpapers. You’d think that Apple has done some Apple-y way to implement that, but not at all.

It’s actually part of the High Efficiency Image File Format that allows sequences which are multiple time-related images.

Here’s an example of Ventura’s default wallpaper.

Ventura graphic

As you can see, it’s multiple images.

So a while back, I thought hey, I can make a Light & Dark wallpaper for myself, which I did.

SCR 20230414 w9m

For some reason, I forgot to use these wallpapers on my iPhone and iPad. Days ago I tried, and oh boy, Apple messed up again.

Here’s how the image looks like on iOS/iPadOS.

Heic

It just loops over the images and if you try to set it as a wallpaper it sets the first one. That’s it…

Anyway, now that I’ve complained about Apple, let me show you how to use “Dynamic” wallpapers. Again, this is just a hack, it would’ve been easier if Apple just tested their own wallpapers on iOS/iPadOS.

Let’s start with iOS first.

Setup two identical wallpapers using the new iOS lock screen customization thingie.

IMG 6553
IMG 6554

After that, setup a Shortcut automation to set the wallpaper based on time. In this case, I use sunset and sunrise.

IMG 6551

The automation itself looks like this.
IMG 6552

Fun fact: Apple messed up again. You know how your iPhone changes appearance automatically between Light and Dark mode based on sunset and sunrise? Well, it doesn’t match with Shortcuts automator! the Shortcut automator will set your wallpaper sooner than iOS changes its appearance. I guess they each have their own “calculation” of when sunset/sunrise is.

Okay, but this wasn’t that hard.

How about iPadOS. Well, that’s more complicated.

First, you need to have a copy of each wallpaper (light and dark), and then you have to put them into an Album.

After that, you need a Shortcut automation that looks for these images and sets them as a wallpaper. Another inconsistency that we really didn’t need between platforms…

Here’s an example.

IMG 0125

Here’s the automation itself

IMG 0127

Fun fact: Sometimes iPadOS will forget to set the wallpaper and you’ll get a notification that says “Missed automation” or something like that. I forgot to screenshot that, but if you have an example, please do send me an image.

Congratulations, now you have Dynamic Wallpapers on iOS/iPadOS.

That’s all folks…

Reply via email.

Antranig Vartanian

March 7, 2023

You’d think that macOS would have a Mission Control shortcut that does “Switch to last used Desktop”, but no, it does not. And this makes macOS very hard to use for people like me, who have 10 Desktops.

Screenshot 2023 03 07 at 2 50 52 PM

On the other hand, WindowMaker, the window manager that “reproduces the elegant look and feel of the NeXTSTEP user interface”, which macOS also was based on, had that shortcut for almost exactly 10 years.

Screenshot 2023 03 07 at 2 50 12 PM

Someone PLEASE add this simple and powerful feature.

Reply via email.

Hardcoded Folder Icons in macOS

I saw this post on Mastodon, and it got me thinking.

Screenshot 2023 02 08 at 4 26 58 AM

Are there any other hardcoded folder names in macOS? Where would I even start looking?

Well, based on what I know, every program on macOS is a directory that ends with .app, which means all I have to do is to find Finder’s location.

That should be pretty easy!

antranigv@zvartnots:~ $ cd /System/
antranigv@zvartnots:/System $ find . -type d -name Finder.app 2>/dev/null
./Library/CoreServices/Finder.app
./Volumes/Data/System/Library/CoreServices/Finder.app

Well, that was easy to find! Don’t worry, /System/Library is the same as /System/Volumes/Data/System/Library, Apple has a weird way of doing mount points, and I’m not here to judge. Well, at least not today!

Next I have to dig into Finder.app’s content, let’s see what we have.

antranigv@zvartnots:/System $ cd Library/CoreServices/Finder.app/
antranigv@zvartnots:/System/Library/CoreServices/Finder.app $ find . -type f -name 'Developer*'

Weird. Nothing at all?

I wonder what type of files we have here? I already know that I wanna see all the file types except Mach-O.

$ find . -type f -print0 | xargs -0 -I% -L 1 file -b "%" | sort -u | grep -v 'Mach-O'
ASCII text, with no line terminators
Apple binary property list
IFF data, AIFF audio
Mac OS X Code Directory version 20100 - 203 bytes
Mac OS X Code Directory version 20100 - 213 bytes
Mac OS X Code Directory version 20100 - 215 bytes
Mac OS X Code Directory version 20100 - 217 bytes
Mac OS X Code Requirement Set - 76 bytes
Mac OS X Code Requirement Set - 84 bytes
Mac OS X Code Requirement Set - 88 bytes
Mac OS X bill of materials (BOM) file
Mac OS X icon, 114423 bytes, "ic13" type
Mac OS X icon, 1162872 bytes, "ic12" type
Mac OS X icon, 23712 bytes, "ic13" type
Mac OS X icon, 30805 bytes, "ic13" type
Mac OS X icon, 37834 bytes, "ic13" type
Mac OS X icon, 72729 bytes, "ic13" type
Mac OS X icon, 76602 bytes, "ic13" type
XML 1.0 document text, ASCII text
XML 1.0 document text, Unicode text, UTF-8 text
data

Okay! we’re getting somewhere!

According to Magic file directory on FreeBSD, the filename is usually .icns

I think the rest will be easy, let’s try this again!

$ find /System/Library -type f -name 'Developer*.icns' 2>/dev/null
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/DeveloperFolderIcon.icns

Bingpot!

What else do we have there?

$ find . -type f -name '*Folder*.icns'
./UsersFolderIcon.icns
./DocumentsFolderIcon.icns
./SidebarHomeFolder.icns
./ApplicationsFolderIcon.icns
./PrivateFolderBadgeIcon.icns
./GenericFolderIcon.icns
./PicturesFolderIcon.icns
./SidebarDesktopFolder.icns
./PublicFolderIcon.icns
./SidebarGenericFolder.icns
./SystemFolderIcon.icns
./ServerApplicationsFolderIcon.icns
./LibraryFolderIcon.icns
./ReadOnlyFolderBadgeIcon.icns
./SidebarBurnFolder.icns
./OpenFolderIcon.icns
./SmartFolderIcon.icns
./BurnableFolderIcon.icns
./SidebarDownloadsFolder.icns
./SidebarMoviesFolder.icns
./SidebarPicturesFolder.icns
./UtilitiesFolder.icns
./SidebarSmartFolder.icns
./HomeFolderIcon.icns
./SidebarApplicationsFolder.icns
./MovieFolderIcon.icns
./SidebarDocumentsFolder.icns
./DropFolderBadgeIcon.icns
./DownloadsFolder.icns
./GroupFolder.icns
./SidebarUtilitiesFolder.icns
./SidebarMusicFolder.icns
./DeveloperFolderIcon.icns
./NewFolderBadgeIcon.icns
./MusicFolderIcon.icns
./DesktopFolderIcon.icns
./SitesFolderIcon.icns
./SidebarDropBoxFolder.icns

These are good! Let’s look at them!

I wrote a script that converts all these .icns files to proper PNGs using the iconutil program.

#!/bin/sh

for icns in *.icns;
do
  iconutil -c iconset "${icns}"
done

for iconset in *.iconset;
do
  cp "${iconset}/icon_512x512@2x.png" "${iconset}-icon_512x512@2x.png" ||
    cp "${iconset}/icon_32x32.png" "${iconset}-icon_32x32.png"
done

Here are the ones that we see basically every day!

Here are some of the exotic ones that we don’t always notice, in an alphabetical order.

The Burnable folder! Still supported even on macOS Ventura!

BurnableFolderIcon iconset icon 512x512 2x

The Developer folder! If you don’t know where you should put your code, this is the right place for it!

DeveloperFolderIcon iconset icon 512x512 2x

The Group folder!

GroupFolder iconset icon 512x512 2x

The Library!

LibraryFolderIcon iconset icon 512x512 2x

The Public folder! Want to share something with your local network? Put it here!

PublicFolderIcon iconset icon 512x512 2x

The Server Applications Folder! Wait, what? I’ve never seen this before. If you know what this is, please leave a reply 🙂

ServerApplicationsFolderIcon iconset icon 512x512 2x

The Sites folder! If you’re new to macOS, this is a kindly reminder that macOS ships with Apache2. Yes, and ~/Sites is the default UserDir, i.e. http://localhost/~yourusername

$ grep '^UserDir' /etc/apache2/extra/httpd-userdir.conf 
UserDir Sites

SitesFolderIcon iconset icon 512x512 2x

The System folder!

SystemFolderIcon iconset icon 512x512 2x

The User folder!

UsersFolderIcon iconset icon 512x512 2x

And finally… the Utilities folder which lives inside the Application folder!

UtilitiesFolder iconset icon 512x512 2x

As sad as it is, these are the old icons, i.e. pre-Ventura (I think). I wish if there was a way to click on a switch and change it back, since it’s all here anyway!

That’s all folks…

Reply via email.

Apple updated macOS’s date(1)!

In 2020 I blogged that

[…] macOS is becoming less Unix-y every year, date(1) is outdated […]

While I was coding, I thought that I’m (SSH’d to) on my FreeBSD machine but I was on macOS, I noticed that the -I flag suddenly works.

I wondered if Apple has updated the date(1) command in macOS Ventura.

Luckily, I have macOS Monterey at home as well.

Here’s the date(1) command on macOS Monterey

Screen Shot 2022 12 29 at 4 14 21 PM

Here it is on macOS Ventura

Screenshot 2022 12 29 at 4 22 45 PM

Ah, so it works!

Did Apple update something? I’m pretty sure it’s mentioned in the history section of the man page.

Here’s the man page of date(1) on macOS Monterey

Screen Shot 2022 12 29 at 4 25 18 PM

Wait, what?

What about the man page on macOS Ventura?

SCR 20221229 mr9

Well… Either someone forgot to update the man page on macOS Ventura, or someone forgot to merge the code properly on macOS Monterey

In either cases, I’m happy that Apple noticed the change and pulled the updated code from FreeBSD!

That’s all folks…

Reply via email.