Software Engineer

Category: Mac OS

AirDrop on macOS working unreliably

AirDrop is quite convenient to send files to a colleague or another device without having to send an email or uploading it somewhere. At some point (I forgot with which exact OSX version), AirDrop was updated and required Bluetooth. Since then, it often occurs that the device I want to share a file with does not appear. However, there is this option to “Search for older Macs”. In the past, I’ve only used it to send files to a Mac running an older OSX version.

However, as it turns out, even for newer macOS versions, if this is done on both devices, it works much better and the device appears almost immediately.

Thunderbird Extension: Hide Badge Icon

About two years ago (a few months after switching to Mac OSX) I noticed that the badge on the Thunderbird app icon, which notifies about new and how many emails were received, is quite distracting for me when I work. As soon as it pops up I would notice it and felt an urge to immediately check what the new email is about. Then of course, the current focus and concentration is lost.

I wanted to turn the badge of, as this is generally supported on OSX, but found out that this is not the case with Thunderbird. I didn’t give up easily and went to search the Internet. Unfortunately, no one had attempted this, complained about it or filed a bug report. Also, I could not find any documentation about this on the Thunderbird pages.

I wanted to know more and started digging into the source code of Thunderbird. An advantage of open source software. Because this is a Mac OSX specific thing, searching for files related to OSX seemed logical. Eventually, I found a file nsMessengerOSXIntegration.cpp (it is now nsMessengerOSXIntegration.mm) where the logic for this functionality is implemented. While I did find an interesting piece of code, the revisions also were helpful, which led me to bug report #274688. In this bug report, a hook was introduced, which allows to observe a property called before-unread-count-display. Upon notification, the desired badge label can be modified/adjusted (e.g., making 100+ for all counts greater than 100) before it is displayed. If an empty string is returned, however, the badge will be hidden.

And that was it. I digged into it and found an (unfortunately) undocumented extension feature. This allowed to write an extension with the purpose of hiding the badge in all situations. I have actually used it for more than two years. My intention was always to release it and share it with others, but kind of put it off. Since I was updating my other extension anyway, I finally did it.

To my surprise, it was fully reviewed without any complaints right away. So if you want to work without distractions, you can now use Hide Badge Icon to hide the badge of the Thunderbird app icon.

 

Reducing file size of a PDF on Mac OS

The file size of PDFs can become quite large, especially when scanning documents or documents containing images. Instead of sending large files, it is almost always recommended to reduce the file size. To do that, there are several ways. For example, there is an app called PDF Squeezer in the Mac App Store (€3.59 or $3.99).

The same functionality can be achieved using Quartz filters in the ColorSync Utility. There is already one called “Reduce File Size” but it might lead to a blurry PDF. You can copy this filter and adjust the settings. However, I found custom filters in the Apple Support Community that work quite well.

  • Download the filters and unpack them.
  • Move the filters to ~/Library/Filters
  • Open your PDF with ColorSync Utility
  • In the bottom, choose the appropriate filter. There are several options starting with Reduce to …
  • Click Apply
  • If you are satisfied with the result, save the file under a different file name (File > Save As).

Alternatively, you can place them into /Library/PDF Services/ instead. Besides the fact that the filters will be available to all system users, when exporting PDFs in Preview, you can select a filter directly in the dropdown under Quartz Filters.

If the filters don’t work perfectly for your use, you can adjust the settings within the ColorSync Utility.

The original creator of the filters to be credited seems to be Jerome Colas according to this GitHub repository.

Update December 2017: Uploaded the zip file to my own server, since the original link became unavailable.

LyX: Installing unknown document classes

If you either received a LyX file that uses a document class unknown to your LyX installation or you would like to create a document using one of the options in the settings dialog, you need to install that document class.

This description is for Mac OS based on the latest version of MacTeX (as of May 28th 2012 this is MacTeX-2011), but should work with any version.

First, you should find out where the document class package should be put. In a previous version, I mentioned to put it in /usr/local/texlive/<version>/texmf-dist/tex/latex/ but this approach is not recommended, because it makes it only available for the current version. There are two better options that allow you to install a new version and keep all your custom packages: You can either make it available to all users or just your user.

  • All users: /usr/local/texlive/texmf-local/tex/latex/
  • Just you: Run kpsewhich -var-value=TEXMFHOME in Terminal. This will show you your personal TEXMF home directory (e.g., ~/Library/texmf). In case it doesn’t exist, you need to create it, as well as the sub-directories, to get the path ~/Library/texmf/tex/latex/

Now that you know where to put it, follow these steps:

  1. Download the desired document class package.
  2. Put the folder with the downloaded document class package into the path retrieved above. You can use Finder to do that. In Finder go to Go > Go to Folder and type in the path. You need to authenticate yourself in order to do that.
  3. In Terminal execute the following command: sudo texhash
    You will be required to enter your password.
    In case texhash cannot be found you have to go to /usr/local/texlive/<version>/texmf-dist/bin/ and execute sudo ./texhash
    Note: You can make sure it worked by executing kpsewhich classname.cls which will give you the path to that package class.
  4. In LyX do Reconfigure (in the menu bar LyX > Reconfigure)
  5. Restart LyX and the document class should be available now

On Windows (using MikTeX) this should work quite easy using the MikTeX Package Manager.

Update 28.03.2013: Fixed path to LaTeX packages (Thanks, Mathias!)
Update 05.04.2013: Updated description with better location for custom document classes.

Mac OS: Airport not connecting automatically to Wi-Fi

A few weeks ago I helped a friend with an issue he had on an iMac with the Wi-Fi. After a while AirPort stopped from connecting automatically to the Wi-Fi. Although this can be caused by various different issues I want to describe the one I found. All the other instructions can be easily found on the web with the search engine of your choice.

The Wi-Fi uses a hidden SSID which can cause problems, not in this case though. Although it doesn’t really increase the security (because there are tools you can use that reveal it) it can help on a social basis when people just shouldn’t see that there is a Wi-Fi.

Anyways. As a side note: There were two iMacs set up the same way. One worked fine but the other didn’t so something must have been different. A lot of advices didn’t help but they could help in your case. In this case the problem was caused by the fact that the SystemPreferences application was moved out of it’s original place. After moving it back to the Application directory (/Applications) and restarting it worked fine again. I am assuming this could cause more problems than the one described here.

© 2024 Matthias Schoettle

Theme by Anders NorenUp ↑