Preferences Accessible from the Command-line

You can configure just about any preference via the command line. But some parameters are only configurable from there. Hookmark has a growing list of preferences that are available only from Terminal app — aka the command line. The Terminal app is developed and described by Apple. You can normally find it in your /Applications/Utilities folder.

Summary

Control Foreground/background mode of operation

Hookmark 3.3 defaults to background mode. However, you can now run Hookmark in foreground mode. This can be achieved by using the command line (/Applications/Utilities/Terminal.app):

defaults write com.cogsciapps.hook background.app.mode 0

In foreground mode, you will see Hookmark in:

  • the App Switcher app (⌘TAB);
  • the Force Quit app; and
  • the Dock (which means you can click on Hookmark’s icon in the Dock to activate Hookmark).

When you bring the Hookmark app to the foreground (i.e., “switch” to it), you will see:

  1. Hookmark’s search tool (which is context agnostic).
  2. Hookmark’s own menu bar.

Many of the gear commands are now available from there, like a traditional (foreground) app: Preferences, About Hookmark.

There are also new commands, such as:

  • File > Show Hookmark folder
  • File > Show Notes folder

We expect to provide significant new commands to Hookmark’s new menu bar 😊 .

When Hookmark app is in the foreground, you don’t see Hookmark’s contextual window. If you use LaunchBar, then you’ll recognize that this setting is quite similar to LaunchBar’s Show Dock Icon preference.

Of course, you can still bring Hookmark’s contextual window to the foreground, with the same commands as before.

Regardless of whether you use foreground or background mode, Hookmark’s contextual window remains the main way of using Hookmark, invoked with a keyboard shortcut or menu bar icon > “Show Hookmark” command.

Control the hook://file/ scope of searches used in (Advanced)

Sometimes Hookmark needs to rely on Spotlight to resolve its file links (hook://file/ URLs). You can control the scope of Hookmark’s Spotlight search.

Hookmark 3.3.2 introduced an advanced preference to work around a macOS 12 bug that caused Hookmark to beachball for some users. The preference restricts the scope of Hookmark’s search when resolving hook://file/ URLs. macOS Monterey users who find that Hookmark hangs can set the variable below to “user” (as opposed to “local” or “network). That should fix the problem.

From Apple’s Terminal app, i.e. /Applications/Utilities/Terminal, you can now set the hook://file/ search scope to user, local, or network with one of the following incantations, respectively:

defaults write com.cogsciapps.hook hfile.url.search.scope user
defaults write com.cogsciapps.hook hfile.url.search.scope local
defaults write com.cogsciapps.hook hfile.url.search.scope network

Hookmark sometimes relies on the Spotlight index to resolve hook://file/ URLs. The hfile.url.search.scope variable controls the Spotlight parameters used by Hookmark. The default scope value is local (which searches “the whole Mac”, not just “user”). That is the same as was introduced in Hookmark 3.3. Before Hookmark 3.3, the value was user (search only “home directory”), which could prevent Hookmark from finding files outside the home directory. The “network” value includes everything in “local”, plus network drives.

This is an advanced preference as most users are unlikely to need it.

Control monitor on which Hookmark window is displayed

🖥️ As of Hookmark 3.4, Hookmark works better with additional monitors (displays). Without requiring additional configuration, Hookmark will better remember on which monitor it was last positioned and where. Its position is dependent on the window that has the focus. When you invoke Hookmark, it will appear on the monitor on which the last window had focus. Change the focus by clicking on a different window, or selecting a different window by other means.

In addition, @Rigorjunky on the Hookmark forum requested:

I would like to be able to pick which screen it appears on (main vs screen with current window).

So we added that to Hookmark 3.4 too. To be able to manually control on which display Hookmark is presented, regardless of what window has the focus, from Terminal.app, write:

defaults write com.cogsciapps.hook hook.window.position.ignore.key-focus 1

Show current item’s number of hooks in menu bar icon

Per “Hooked” indicator in menu bar icon, Hookmark has a new General preference: Show current item's number of hooks in menu bar icon. This can also be configured via a Terminal command:

defaults write com.cogsciapps.hook menubar.icon.status 1

or

defaults write com.cogsciapps.hook menubar.icon.status 0

If enabled, Hookmark periodically polls the foreground app to display the number of hooks (or a “?” if Hookmark can’t asynchronously determine the number of hooks). You can change the polling interval using the Terminal app’s default command. For example, pasting the following in the Terminal would increase the interval to 3 seconds:

defaults write com.cogsciapps.hook menubar.icon.status.interval 3

Currently, only integer values are allowed.

Limit the number of backups of Hookmark’s database

In Hookmark versions 5.0 and later, to limit the number of backup files of Hookmark’s database (normally stored in ~/Library/Application\ Support/com.cogsciapps.hook/), you can run the following command in
Terminal.app where n is the desired number:

defaults write com.cogsciapps.hook database.backup.limit n

This will indirectly limit the amount of memory used by Hookmark’s backups.