A Python script that lets you control Spotify using keyboard shortcuts.
It allows you to play/pause, skip tracks, adjust volume, toggle shuffle or repeat, like songs, mute/unmute โ all without leaving your current app.
There are two versions:
- ๐ช๐ธ
spotify_macropad.pyโ for Spanish keyboard layout. - ๐ฌ๐ง
spotify_macropad_en.pyโ for English keyboard layout.
Spotify MacroPad turns your keyboard into a control panel for Spotify.
When active, it listens for specific keys and sends commands to Spotify via the official Spotify Web API (using Spotipy).
Main features:
โถ๏ธ Play / Pause- โญ๏ธ Next track
- โฎ๏ธ Previous track (or restart if within 3 seconds)
- ๐ Volume up / down
- ๐ Cycle repeat mode
- ๐ Toggle shuffle
- โค๏ธ Like / Unlike current song
- ๐ Mute / Unmute
- ๐ Toggle active state (enable/disable script)
-
Clone the repository or download the files:
git clone https://github.com/yourusername/spotify-macropad.git cd spotify-macropad -
Install dependencies:
pip install spotipy keyboard -
Create an app on the Spotify Developer Dashboard
- Copy your Client ID, Client Secret, and define a Redirect URI (for example, http://localhost:8888/callback).
-
Edit the configuration:
Open spotify_macropad.py (or the English version) and replace:
CLIENT_ID = "YOUR_CLIENT_ID" CLIENT_SECRET = "YOUR_CLIENT_SECRET" REDIRECT_URI = "YOUR_REDIRECT_URI" -
Run the script:
python spotify_macropad.pyThe first time you run it, a browser window will open asking for Spotify authorization.
| Key | Action |
|---|---|
| Re Pag | Toggle active state |
| Av Pag | Play / Pause |
| โ / โ | Volume up / down |
| โ / โ | Previous / Next track |
| Supr | Toggle shuffle |
| Right Shift | Change repeat mode |
| Inicio | Like / Unlike current track |
| ร | Mute / Unmute |
| Key | Action |
|---|---|
| Page Up | Toggle active state |
| Page Down | Play / Pause |
| โ / โ | Volume up / down |
| โ / โ | Previous / Next track |
| Delete | Toggle shuffle |
| Right Shift | Change repeat mode |
| Home | Like / Unlike current track |
| Right Ctrl | Mute / Unmute |
By default, the script creates the following directory in your user folder:
Documents/naarventโs projects/SpotifyMacroPad/
โโโ .spotify_oauth_cache (authentication data)
โโโ track_history.txt (track history)
- Built with Python 3.10+
- Requires Spotify Premium (for playback control via API)
- Uses keyboard for global key detection
- Logs playback history automatically
- Includes fallback logic when playback is inactive