This AutoHotkey script is designed to control the Spotify desktop application, providing customizable hotkeys for tasks such as volume control, play/pause, skipping tracks, muting, and toggling window transparency. It is designed to be used with a macropad such as the Printed Pad - hence why all the hotkeys are set to unused F keys.
- AutoHotkey v2.0: The script is written using AutoHotkey v2.0 syntax.
- Spotify Desktop App: This script assumes you're using the desktop version of Spotify (not tested with the microsoft store version)
- UIA Library: The script uses UIA (UI Automation) to interact with the Spotify application.
- nircmd: This script uses
nircmd, a small command-line tool, to control the volume of Spotify.
- Clone this repository onto your local machine by running the following code:
git clone https://github.com/noahbei/Spotify_Hotkeys- Navigate to where you cloned this repository
cd ./Spotify_Hotkeys- UIA is linked to this repo as a submodule, to have access to it run the following command:
git submodule update --init --recursive- Download Auto Hot Key Version 2
- Run the script by executing the file
SpotifyController.ahk - Extra Configure
SpotifyController.ahkto run on startup. Guide linked here
- Volume Control: Use the F13 and F14 keys to decrease or increase Spotify's volume.
- Play/Pause: Press F15 to play or pause the current track.
- Previous/Next Track: Press F16 and F17 to skip to the previous or next track.
- Mute Toggle: Press F18 to mute or unmute Spotify.
- Spotify Open/Close: Press F19 to open or bring Spotify to the front; press F20 minimize Spotify.
- Transparency Toggle: Press F21 to toggle Spotify's window transparency.
- Hide Taskbar Option: If your Spotify window is on the same screen as a full screen application, the taskbar will flash above your current window when using any UIA feature. You can enable this option if you don't want that to happen.
- Note: A side affect of enabling this option is that when you don't have a full screen application on the screen, you can seen the taskbar disappear and reapear.
- Note: A workaround if you don't want to enable this feature is to have your Spotify window on a different monitor than your fullscreen application. This will ensure that the taskbar doesn't change when using UIA features.
-
Spotify Path:
- The script assumes your Spotify installation path is
C:\Users\USERNAME\AppData\Roaming\Spotify\Spotify.exe. If your installation path is different, you will need to adjust the file path in theRunWaitcommands.
- The script assumes your Spotify installation path is
-
Enable/Disable Taskbar Hiding:
- Set
enableHideTaskbar := Trueto enable hiding the taskbar, or set it toFalseto disable this behavior.
- Set
-
Adjust Hotkeys:
- You can change what keys trigger each action by modifying the keys before each function
F13:: { ... }
- You can change what keys trigger each action by modifying the keys before each function
| Hotkey | Action |
|---|---|
| F13 | Decrease Spotify volume by 5% |
| F14 | Increase Spotify volume by 5% |
| F15 | Toggle play/pause of the current track |
| F16 | Skip to the previous track |
| F17 | Skip to the next track |
| F18 | Toggle mute/unmute Spotify |
| F19 | Open or activate Spotify |
| F20 | Close or minimize Spotify |
| F21 | Toggle Spotify window transparency |
- Microsoft Store Version: This script has not been tested with the Microsoft Store version of Spotify. If you use the Store version, the script might not work as expected.
- Full-Screen Applications: If you're using a full-screen app, the taskbar may appear temporarily above the window when Spotify is in focus. Enabling the
enableHideTaskbaroption will prevent this from happening. - Example of hotkeys assigned to the Printed Pad
This script is open-source and free to use. If you make improvements or modifications, feel free to share them. Attribution is appreciated if you distribute or use this script in any public-facing way.
