Metadata-Version: 2.5
Name: hookjump
Version: 0.3.1
Summary: A hotkey that jumps to the best part of the song playing in Spotify on macOS: the spot you pinned, or the part you keep going back to.
Project-URL: Repository, https://github.com/turhanGoksu/hookjump
Project-URL: Issues, https://github.com/turhanGoksu/hookjump/issues
Project-URL: Changelog, https://github.com/turhanGoksu/hookjump/blob/main/CHANGELOG.md
Author: turhanGoksu
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: hotkey,macos,menu bar,music,spotify
Classifier: Development Status :: 7 - Inactive
Classifier: Environment :: MacOS X :: Cocoa
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: C
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Multimedia :: Sound/Audio :: Players
Requires-Python: >=3.10
Requires-Dist: pyobjc-core>=12.2; sys_platform == 'darwin'
Requires-Dist: pyobjc-framework-cocoa>=12.2; sys_platform == 'darwin'
Requires-Dist: pyobjc-framework-coretext>=12.2; sys_platform == 'darwin'
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://github.com/turhanGoksu/hookjump/raw/main/docs/hookjump.png" width="112" alt="hookjump's icon: a hook with red bait">
</p>

<h1 align="center">hookjump</h1>

<p align="center">
  Jump to the best part of the song playing in Spotify:<br>
  the spot you pinned, or the part you keep going back to.
</p>

<p align="center">
  <a href="#macos">macOS</a> ·
  <a href="#android">Android</a> ·
  <a href="#windows">Windows</a> ·
  <a href="#privacy">Privacy</a>
</p>

<p align="center">
  <img src="https://github.com/turhanGoksu/hookjump/raw/main/docs/screenshots.png" width="860" alt="One song, The Emptiness Machine by Linkin Park, pinned at 1:07: hookjump's panel on macOS, its screen on Android and its panel on Windows">
</p>

> **Status:** finished. hookjump does what it set out to do on macOS,
> Android and Windows, and is no longer developed: no new features or
> platforms are planned. It is used daily on its author's Mac and Android
> phone; the Windows app was tried for a few days. Each platform's
> compatibility table says what has and has not been tried.

## Get it

| | macOS | Android | Windows |
|---|---|---|---|
| **Latest** | 0.3.1 | 0.2.1 | 0.2.0 |
| **You need** | macOS 13 or later and the Spotify desktop app | Android 8.0 or later and the Spotify app | Windows 11 on x64 and Spotify (Microsoft Store or spotify.com) |
| **Get it from** | PyPI: `pipx install hookjump` | [Releases](https://github.com/turhanGoksu/hookjump/releases): the `.apk` | [Releases](https://github.com/turhanGoksu/hookjump/releases): the `.zip` |
| **Jump · Pin** | ⌃⌥F · ⌃⌥D | buttons in the notification and on the screen; a double press of the side button jumps | Ctrl+Alt+F · Ctrl+Alt+D |
| **Steps** | [Install on macOS](#install-on-macos) | [Install on Android](#install-on-android) | [Install on Windows](#install-on-windows) |

## How it works

hookjump knows two kinds of best part, and it never guesses:

1. **The spot you pin.** While a song plays, press Pin at a part you love (a
   chorus, a verse, a solo), or type a time such as `1:23`. A pin always
   wins.
2. **The part you keep going back to.** hookjump notes where you rewind to
   and where you skip to. Once the same place comes up in two different
   listens, Jump goes there. Listening without touching anything teaches it
   nothing, and its own jumps never count.

A jump lands 1.5 s before the spot, so you hear it begin; a time you type is
kept exactly. When there is nothing to jump to, hookjump says so instead of
jumping somewhere random.

Each device learns on its own: the Mac, the phone and the PC share nothing.

## Privacy

- **Nothing leaves your device.** hookjump makes no network request at all,
  on any platform; the Android app does not even ask for the internet
  permission. There is no account and no usage data.
- **It reads only what Spotify is playing:** the song and where it is.
  macOS lets it control Spotify, with one permission asked in hookjump's own
  name. Android shows it Spotify's media session through notification
  access; it does not read your notifications. Windows shows it through its
  media controls.
- **What it keeps**, in one file on the device:
  - the spots you pin, and your shortcuts;
  - where you rewound or skipped to in each song, for its last 10 listens
    with such a seek, with no dates or times;
  - the raw playback positions it learns from, deleted after 7 days;
  - the title and artist of the songs any of the above is about, and only
    those: a song you only listened to is never named.
- **You can see and remove all of it.** What hookjump Keeps lists every song
  it keeps something about. Pause Learning stops all recording. Forgetting a
  song, or Delete Everything, erases it, and deleted data is overwritten,
  not left readable in the file.

| | Where it keeps it |
|---|---|
| macOS | `~/Library/Application Support/hookjump/hookjump.db` |
| Android | the app's own storage, left out of cloud backups |
| Windows | `%LOCALAPPDATA%\hookjump\hookjump.db` |

The exact format is in [spec/STORAGE.md](spec/STORAGE.md).

## macOS

### Install on macOS

You need:

- macOS 13 or later, and the **Spotify desktop app** (not the web player);
- Python 3.10 or later. The `python3` that comes with macOS is 3.9, too old;
  the steps below get a newer one through Homebrew;
- for `hookjump.app` (open at login, permission in hookjump's own name):
  Apple's Command Line Tools. If you use Homebrew you already have them.

```sh
brew install pipx
pipx ensurepath          # then open a new terminal
pipx install hookjump
hookjump install         # builds ~/Applications/hookjump.app
open ~/Applications/hookjump.app
```

Then choose **Open at Login** in the hook's menu to start hookjump with your
Mac.

<details>
<summary>Other ways to install, and what <code>hookjump install</code> does</summary>

- pipx gives hookjump a Python environment of its own, so nothing it needs
  mixes with your other tools, and `pipx uninstall` removes all of it.
  `uv tool install hookjump` does the same, if you use uv. The version in
  development: `pipx install git+https://github.com/turhanGoksu/hookjump`.
- `hookjump install` compiles a small launcher from its C source on your Mac
  ([launcher.c](src/hookjump/launcher/launcher.c), about 100 lines), so no
  prebuilt binary is ever downloaded.
- Without the Command Line Tools, `hookjump install` says how to get them
  (`xcode-select --install`). Until then, `hookjump run` in a terminal does
  the same, for as long as the terminal stays open.

</details>

### Using it on macOS

A hook sits in the menu bar. It carries bait when hookjump knows a spot in
the playing song, is empty when it does not yet, and fades while learning is
paused.

| Key | What it does |
|---|---|
| ⌃⌥F | jump to the best part |
| ⌃⌥D | pin the spot that is playing |

After a key, a strip of the sea opens under the hook for a few seconds and
shows what happened: the float slides to the hook, a new pin's hook comes
down, or the float shakes and the strip says why there is nowhere to jump.
It never takes the focus, lets clicks through, and does not show over
full-screen apps.

**Click the hook** for the panel: the song as a line through the water,
where you rewound to above it, where you skipped to below it, the hook where
Jump goes, the float where the song is. Click the line to pin that second.
Jump, Pin and the song buttons (previous, play or pause, next) are there
too; Tab, Return and Space work them, and Esc closes it.

**Right-click the hook** (or Control-click it) for the menu:

- **This Song:** pin at a typed time, remove the pin, forget what was
  learned from it or the whole song, or stop learning from it (a pin still
  works);
- **Pause Learning**;
- **What hookjump Keeps:** every song it keeps something about, by name, and
  what: the pin, the spot it learned, or the seeks so far. Songs kept by 0.1
  get their name the next time they play: Spotify names only the playing
  song, and hookjump does not go online to ask;
- **Open at Login**;
- **Shortcuts:** change ⌃⌥F and ⌃⌥D to another letter or digit with ⌃, ⌥
  or ⌘; one that types a character on any of your keyboards, starts an
  accent, or that apps use is refused;
- **Forget Everything Learned…:** where you rewound or skipped to in every
  song; pins stay;
- **Delete Everything…**;
- **Quit hookjump**.

<details>
<summary>Which shortcuts the recorder accepts</summary>

The recorder refuses keys you would miss: ones that type a character on your
keyboard (on a Turkish keyboard ⌥Q is `@`), accent keys, and shortcuts every
app uses, such as ⌘C.

</details>

The same jump and pin work from a terminal, or from any tool that runs
commands, such as a keyboard shortcut made in the Shortcuts app:

```sh
hookjump jump    # Jumped to 1:43: the part you replay most.
hookjump pin     # Pinned 1:12. The jump lands 1.5 s before it.
```

### Permissions on macOS

hookjump asks for one permission: to control Spotify, so it can read which
song is playing and where, and move it. macOS asks the first time, in
hookjump's name. It needs no Accessibility or Input Monitoring permission:
its hotkeys use the same system call as other shortcut apps, which asks for
none.

If hookjump runs from a folder macOS protects (Desktop, Documents,
Downloads), macOS also asks to let it read that folder. Installing with pipx
avoids that.

### Compatibility on macOS

| | |
|---|---|
| macOS 27, Apple Silicon | tried by hand on 27.2: recording, jumps, open at login |
| macOS 26 (Tahoe), Apple Silicon | used daily |
| macOS 15 (Sequoia), Apple Silicon and Intel | automatic tests only |
| macOS 13 and 14 | not tried |
| Python 3.10 to 3.15 | 3.10 and 3.15 tested automatically; 3.15 used daily |
| Spotify 1.3 | used daily |

### Uninstall from macOS

```sh
hookjump uninstall      # removes hookjump.app, its login item and permission
pipx uninstall hookjump
rm -r ~/Library/Application\ Support/hookjump    # what it learned
```

## Android

### Install on Android

You need Android 8.0 or later and the Spotify app.

1. Download `hookjump-android-0.2.1.apk` from
   [Releases](https://github.com/turhanGoksu/hookjump/releases) and open it.
   The first time, Android asks you to allow installing apps from your
   browser or file manager. Samsung phones with Auto Blocker on (Settings ›
   Security and privacy › Auto Blocker) refuse it: turn Auto Blocker off to
   install, and on again afterwards. An update installs over the version
   you have and keeps what it learned; open hookjump once after it.
2. Open hookjump and tap **Allow access**. In the list that opens, turn on
   hookjump. Android warns that such an app can read your notifications;
   what hookjump does with the access is under [Privacy](#privacy).
3. On Android 13 and later the switch may be greyed out, with a "Restricted
   setting" message: Android blocks this access for apps installed from a
   downloaded file. Open Settings › Apps › hookjump, tap ⋮ at the top right,
   choose **Allow restricted settings** and confirm, then go back to step 2.
   The menu entry appears only after you have tried the switch once.
4. On Android 13 and later, allow hookjump's notification when asked: it
   carries the Jump and Pin buttons.

### Using it on Android

- The screen draws the playing song as a fishing line going down into the
  water from 0:00: the float is where the song is, the red hook where Jump
  goes, ticks where you rewound to (right) and skipped to (left). Tap the
  line to pin that second.
- **Jump** and **Pin** are on the screen and in hookjump's notification,
  which works on the lock screen too.
- **hookjump runs from when you open it** until you quit it or restart the
  phone. To have it start with the phone, as Open at Login does on the Mac
  and Windows, tick **Start with the phone** in the logbook.
- **Quit** in the notification stops hookjump, as on the Mac and Windows,
  until you open it again. On the lock screen it asks you to unlock first.
- **Double-press the side button to jump.** Opening hookjump while Spotify
  plays a song with a pin or a learned spot jumps instead of showing the
  screen, so a key that opens hookjump becomes a jump key. With nowhere to
  jump yet, it shows the screen, where you can pin. On Samsung phones: Settings › Advanced features › Side
  button › Double press › Open app › hookjump. Samsung phones ask to unlock
  first; while locked, use the notification's Jump. If hookjump is not
  running yet, the first press opens it and the next one jumps.
- The logbook (top right): pin at a typed time, forget what was learned
  from the song or the whole song, or stop tracking it; pause learning,
  start with the phone, see what hookjump keeps, forget everything learned
  (pins stay), delete everything.
- Some phones stop apps in the background to save battery. If hookjump
  stops seeing songs, opening it once connects it again.

### Compatibility on Android

| | |
|---|---|
| Android 17, Samsung Galaxy S24 FE (One UI 9) | used daily, with Spotify |
| Android 16, Samsung Galaxy A53 (One UI 8) | used daily up to 0.1.0 |
| Android 14 to 17: Galaxy S26 Ultra, Galaxy A16, Pixel 11, Xiaomi 14, OPPO A79, OnePlus 11 | automatic checks on lab phones, with a stand-in for Spotify |
| Android 8 to 17 | automatic checks on emulators, with the same stand-in |

### Uninstall from Android

Touch and hold hookjump's icon and choose **Uninstall**, or use Settings ›
Apps › hookjump › Uninstall. Everything it learned goes with it.

## Windows

### Install on Windows

You need Windows 11 on an x64 PC, and Spotify from the Microsoft Store or
from spotify.com.

1. Download `hookjump-windows-0.2.0-x64.zip` from
   [Releases](https://github.com/turhanGoksu/hookjump/releases) and unzip it
   into a folder of its own that stays where it is, such as
   `%LOCALAPPDATA%\Programs\hookjump`: Open at Login starts it from there.
   Nothing else needs installing; .NET is inside `hookjump.exe`. To update,
   quit hookjump first (right-click the hook, **Quit hookjump**), then unzip
   the new version over the old one in the same folder: what it learned and
   your settings stay.
2. Open `hookjump.exe`. The first time, Windows may say "Windows protected
   your PC", because hookjump is not signed with a paid certificate: choose
   **More info**, then **Run anyway**.
3. The hook appears by the clock (Windows may first put it under ^; drag it
   onto the taskbar to keep it in sight). To start hookjump with Windows,
   right-click the hook and choose **Open at Login**.

<details>
<summary>Check the download</summary>

Compare the zip's SHA-256 with the one in the release notes
(`Get-FileHash hookjump-windows-0.2.0-x64.zip` in PowerShell). GitHub also
attests that it built the zip from this repository; with the GitHub CLI:

```sh
gh attestation verify hookjump-windows-0.2.0-x64.zip --repo turhanGoksu/hookjump
```

</details>

### Using it on Windows

- **Ctrl+Alt+F** jumps and **Ctrl+Alt+D** pins where the song is. For a few
  seconds a strip by the clock, on the screen you work on, shows what
  happened: the float slides to the hook, a new pin's hook comes down, or it
  says why there is nowhere to jump. It never takes the focus and stays away
  from full-screen games, films and presentations.
- If another app holds those keys, or they type a character on one of your
  keyboards (Ctrl+Alt is AltGr), hookjump takes Ctrl+Alt+Shift+F and D and
  says so in its menu.
- **Click the hook** for the panel: the song as a line through the water,
  where you rewound to above it, where you skipped to below it, the hook
  where Jump goes, the float where the song is. Click the line to pin that
  second. Jump, Pin and the song buttons (previous, play or pause, next) are
  there too; Tab, Enter and Space work them, and Esc closes it.
- **Right-click the hook** for the menu: **This Song** (pin at a typed time,
  remove the pin, forget what was learned from it or the whole song, stop
  tracking it), **Pause Learning**, **What hookjump Keeps**, **Shortcuts**
  (change Ctrl+Alt+F and Ctrl+Alt+D; keys that would take something away
  from you are refused, with why), **Open at Login**, **Forget Everything
  Learned…**, **Delete Everything…**, **Quit hookjump**.

### Compatibility on Windows

| | |
|---|---|
| Windows 11 (build 26300), x64, at 125 % and 150 % scale | tried for a few days, with Spotify from the Microsoft Store (1.310) |
| Spotify from spotify.com | tried in Windows Sandbox: reading, pins, jumps |
| More than one screen | not tried |
| A hotkey pressed during a full-screen game or film | not tried |
| Windows on ARM | not tried (it would run the x64 app through emulation) |
| Windows 10 | not supported: hookjump says so and closes |

### Uninstall from Windows

1. Right-click the hook: turn **Open at Login** off, then **Quit hookjump**.
2. Delete hookjump's folder, and `%LOCALAPPDATA%\hookjump` with what it
   learned.

## Known limits

**Everywhere**

- **Spotify only.**
- A pin and what was learned belong to one Spotify track. The single and the
  album release of a song are separate tracks, so neither carries over.

**macOS**

- Spotify playing on another device, such as a phone (Spotify Connect):
  hookjump learns from it and Jump moves it, while the Mac is awake with
  Spotify open. It cannot see what a phone plays offline, and a phone on
  mobile data has not been confirmed.
- A hotkey another app also uses cannot be detected: macOS lets two apps
  register the same one. Change hookjump's under Shortcuts if they clash.

**Android**

- There is no Quit yet: hookjump runs while it has notification access. To
  stop it, turn that access off in Settings.

**Windows**

- Windows gives no song id, so hookjump knows a song by a hash of its title,
  artist, album and track number ([spec/STORAGE.md](spec/STORAGE.md)): a
  song Spotify renames is a new song to hookjump.
- The panel is drawn by hookjump, so screen readers do not see its buttons;
  all they do is also in the menu and on the hotkeys.

## For developers

### Repository layout

| Folder | What is in it |
|---|---|
| `spec/` | the algorithms and the storage format in plain language, with JSON test vectors that every implementation (Python, Kotlin, C#) must pass |
| `src/hookjump/core/` | the platform-independent algorithms in Python: pure functions using only the standard library |
| `src/hookjump/adapters/` | storage (SQLite), the Spotify turntable, hotkeys, the keyboard layout |
| `src/hookjump/` | the booth that joins them, the menu bar app, the commands |
| `android/` | the Android app (Kotlin, Compose), and a test player that stands in for Spotify |
| `windows/` | the Windows app (C#, .NET 10, no UI framework) |
| `eval/` | the best parts of 20 songs, labeled by hand, and the protocol they were labeled under |

### Running the tests

| Part | How |
|---|---|
| Python (macOS app and reference core) | `pip install -r requirements-dev.txt`, then `pytest` |
| Android | in `android/`: `./gradlew :core:test :storage:test :player:test :booth:test` |
| Android on emulators | `python3 android/emulators/check.py 26 30 37.0`; most checks also run on real phones in a device lab, as an instrumentation test in `android/app/src/androidTest/` |
| Windows | in `windows/`, with exactly the .NET SDK that `windows/global.json` names: `dotnet test --solution Hookjump.slnx` |

The automatic tests run on GitHub's machines with fake players: they check
hookjump's own code, not Spotify.

### Releases

| Platform | Tag | How |
|---|---|---|
| macOS | `v0.3.1` | a GitHub release publishes its attached wheel and sdist to PyPI ([publish.yml](.github/workflows/publish.yml)) |
| Android | `android-v0.2.1` | the APK is built from a clean clone and signed by the maintainer |
| Windows | `windows-v0.2.0` | CI builds the zip, the same bytes on any machine ([RELEASING.md](windows/release/RELEASING.md)) |

## License

[Apache-2.0](LICENSE). The macOS, Android and Windows apps include the
Barlow Condensed and IBM Plex Mono fonts, under the SIL Open Font License.
