Tuesday 30 January 2018

Cannot type into Spotlight in macOS

Problem:

I suddenly cannot type anything into Spotlight.

It opens and closes, and even does so with the Command-Space shortcut. I just can't type in it when it's open.

Workaround:

  • Open Terminal
  • Use the following command:
    killall Spotlight
  • If all goes well, the magnifying glass for Spotlight will disappear and reappear, and you'll be able to type into Spotlight again

Notes:

This was tested to work in macOS 10.12.6.

Wednesday 24 January 2018

Seamonkey XPCOMGlueLoad error

Problem:

I updated Seamonkey on Linux Mint and it now won't launch. I am running a 64-bit version of Linux Mint.

In terminal, I tried to run Seamonkey but got an error similar to:

$ /path/to/seamonkey/seamonkey

XPCOMGlueLoad error for file /path/to/seamonkey/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

When checking, I do have GTK 3:

$ locate libgtk-3.so.0

/usr/lib/x86_64-linux-gnu/libgtk-3.so.0
/usr/lib/x86_64-linux-gnu/libgtk-3.so.0.1800.9

Solution:

It may be that you're attempting to run a 32-bit version of Seamonkey on 64-bit Linux Mint. The default Seamonkey download from Mozilla as of Jan 2018 is the 32-bit version.

You can find the 64-bit version in their releases page: http://archive.mozilla.org/pub/seamonkey/releases/

For example, for 2.49.1:

Notes:

This solution worked for Seamonkey 2.49.1 running on 64-bit Linux Mint 18.1 Serena as of Jan 2018. Your mileage may vary with other versions and configurations.

Also for the system tested, the auto-update is not an issue because this browser will only be used on a local network. (You'll see the note from Mozilla when you launch the browser... at least for version 2.49.1). Keep this in mind if your situation is different and you need a browser that reliably auto-updates.

References:

http://archive.mozilla.org/pub/seamonkey/releases/ http://forums.mozillazine.org/viewtopic.php?f=40&t=3005417

Tuesday 16 January 2018

XQuartz move offscreen windows back on-screen in macOS/OS X

Problem:

I have several XQuartz/X11 windows in macOS/OS X that are offscreen. I want to move them on-screen so I can save my work.

Example scenario:

You can create an example of off-screen X11 windows when using macOS/OS X with an external monitor and a screen geometry where one monitor is higher and further left to another (scroll down to see a screenshot example).

In the lower-right monitor, when opening certain windows in programs like Inkscape, those windows will be created at coordinate that you cannot access with your mouse cursor.

Workaround:

Pre:

  • If not already installed, then install xdotool (easiest way is to use Homebrew)

To find out window ids and geometry:

  • In Terminal, you can use:
    xwininfo -tree -root
  • If you want to filter by an application, you can pipe to grep, for example:
    xwininfo -tree -root | grep "inkscape"

To move a window to a visible coordinate:

  • If not already installed, then install xdotool (easiest way is to use Homebrew)
  • Make note of a valid coordinate. Use the output of xwininfo from the above step to find a visible top-left coordinate for your window (e.g. it can be an existing window that you can already see and use with your mouse. In the screenshot below, a visible coordinate is 1070 1102)
  • In Terminal, use the following command and replace [options] [window] [x] [y] with the appropriate values:
    xdotool windowmove [options] [window] [x] [y]

Example:

Consider the following window geometry:

Inkscape has spawned the "document properties" window to a coordinate that is out of desktop 1:

Use xwininfo to find out window IDs, geometry, as well as to to find a set of on-screen coordinates:

Use xdotool to move off-screen window to an on-screen coordinate on desktop 1:

If all goes well, the window should now be visible.

Now would be a good time to save your work.

Also note that there might be some unexpected behaviour for XQuartz windows moved this way (e.g. "show all windows" still shows incorrect placement, etc.)

Where to go from here?

Some ideas:

  • write a script to automatically collect all windows of a certain app into visible coordinates if they're not visible
  • if you're able to and have the time to volunteer, contribute to the XQuartz project a feature to collect or clamp all windows to a given desktop :) (thanks in advance!)

Notes:

This workaround was verified to work with macOS Sierra 10.12.6, XQuartz 2.7.11, xdotool 3.20160805.1. Other versions may have different results.

References:

Monday 15 January 2018

Exit XQuartz Full Screen Mode macOS Sierra

Problem:

How do I exit XQuartz full-screen mode?

Solution:

When in XQuartz:

  • Press the keyboard shortcut Command-, (command + comma)
  • Uncheck full-screen mode in the preferences

References:

Friday 12 January 2018

How to take Touch Bar screenshots on Mac

Problem:

How do I take a screenshot of the Touch Bar on a Mac?

Solution:

To take a Touch Bar screenshot and...

  • ...save as a file on the desktop: Shift-Command-6
  • ...copy to clipboard: Control-Shift-Command-6

Example Screenshot:

Notes:

The shortcuts in the solution above are defaults. They can be configured by going to "System Preferences" -> Keyboard -> Shortcuts -> "Screen Shots", and setting new shortcuts.

The how-to was verified to work in macOS 10.12.6 on a MacBook Pro with a Touch Bar. Your mileage may vary with other OS versions.

References:

Thursday 11 January 2018

USB-to-Serial on OS X/macOS - an Example

Problem:

I have a USB-to-Serial adapter that I need to use on a Mac. How do I configure it, and how do I read/write to it?

I am already partially familiar with using serial ports on Linux and Windows.

Notes:

This post is written as a reminder and contains just enough information to reproduce these steps in the future. It is not thorough. A little Google may be required in order to clarify or expand on some points.

The following steps were verified to work with macOS 10.12.6, with a very specific USB-to-serial adaptor that happened to work fine with Apple's default drivers. Your mileage may vary with other configurations and devices.

Steps Overview:

  1. Before you start, if drivers do not already exist then install them.
  2. Plug USB-to-Serial adaptor into your Mac
  3. Find info in "About this Mac" - More below
  4. Setup null modem and speed using Network Preferences - More below
  5. Find the device's path to access the Linux/POSIX way - More below

Step: Find adapter info:

To find out some basic information about your USB-to-Serial adapter, use the following steps.

  1. Go to "About This Mac" and click "More Info..." or "System Report..." (depending on your OS version)
  2. Find your device in the system report under "USB", and make note of what is there. This will help you identify your device in other steps.

Step: Configure serial communication using Network Preferences

To configure your USB-to-Serial adapter speed, etc., for use with other apps on your Mac, use the following steps.

  1. Open "System Preferences" and open the "Network" preferences pane
  2. Select your USB-to-Serial adapter if it is in the list, or add it then select it
  3. Click "Advanced..."
  4. Configure as null modem with the desired baud rate. The example screenshot below shows the attached device configured to 9600 bps (as well as some other configuration)

Step: Access your usb-to-serial port the Linux/Posix way:

  • to find the path to your serial port, in Terminal type in the following command and find your device:
    ioreg -c IOSerialBSDClient | grep usb
  • in the example screenshot above, the serial port is "/dev/cu.usbserial-FTAN3DQ" and an example of its use in VirtualBox is shown in the screenshot below.
  • (optional) to test your serial port directly, you can use the "screen" command in Terminal. More on this command in Apple's screen man page

    References:

  • How to change Ubuntu timezone to UTC

    Problem:

    How can I change my timezone to UTC in Ubuntu?

    Solution:

    1. In a terminal window type:
      sudo dpkg-reconfigure tzdata
      
    2. Then select "None of the above":
    3. After that, select "UTC":

    If all goes well then the "date" command should show the date and time in UTC.

    References: