Preferences Accessible from the Command-line

Hook 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

Hook 3.3 defaults to background mode. However, you can now run Hook 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 Hook in:

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

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

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

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

There are also new commands, such as:

  • File > Show Hook folder
  • File > Show Notes folder

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

When Hook app is in the foreground, you don’t see Hook’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 Hook’s contextual window to the foreground, with the same commands as before.

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

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

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

Hook 3.3.2 introduced an advance preference to work around a macOS 12 bug that cause Hook to beachball for some users. The preference restricts the scope of Hook’s search when resolving hook://file/ URLs. macOS Monterey users who find that Hook 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

Hook sometimes relies on the Spotlight index to resolve hook://file/ URLs. The hfile.url.search.scope variable controls the Spotlight parameters used by Hook. The default scope value is local (which searches “the whole Mac”, not just “user”). That is the same as was introduced in Hook 3.3. Before Hook 3.3, the value was user (search only “home directory”), which could prevent Hook 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 Hook window is displayed

🖥️ As of Hook 3.4, Hook works better with additional monitors (displays). Without requiring additional configuration, Hook will better remember on which monitor it was positioned and where. Its position is dependent on the window that has the focus. When you invoke Hook, 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 Hook productivity 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 Hook 3.4 too. To be able to manually control on which display Hook 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 – Hook, Hook 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, Hook periodically polls the foreground app to display the number of hooks (or a “?” if Hook 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.