A real-time lyrics display application for Windows that fetches and displays synchronized lyrics for currently playing music. Built with Electron, TypeScript, and WebSocket technology.
- Real-time Lyrics Display - Shows synchronized lyrics for currently playing music
- WebNowPlaying Integration - Seamless integration with WebNowPlaying extension
- Spicetify Support - Works with Spotify via Spicetify customization
- Automatic Lyrics Fetching - Fetches lyrics from configurable API endpoints
- System Tray Integration - Runs in the background with tray icon
- Transparent Window - Clean, minimal lyrics display interface
- Position Synchronization - Tracks song position and highlights current lyrics
- Cross-Platform Ready - Built with Electron for Windows compatibility
- Node.js (v14 or higher)
- npm or yarn
- Windows OS (for .exe build)
- WebNowPlaying extension (for music detection)
-
Clone the repository
git clone <repository-url> cd lyrics_ts
-
Install dependencies
npm install
-
Configure environment variables
cp .env.example .env
Edit
.envfile with your API configuration:LYRICS_API_BASE_URL=https://your-api-endpoint.com/lyrics LYRICS_API_KEY=your_api_key_here WEBSOCKET_PORT=8974 HTTP_PORT=8090
-
Run the application
npm start
-
Setup Music Detection (Optional)
- Install WebNowPlaying extension for your browser or Spicetify
- Configure WebNowPlaying to connect to
ws://localhost:8974 - Start playing music to see lyrics appear automatically
# Run with TypeScript (development)
npm start
# Run with compiled JavaScript
npm run build
npm run electron-start# Build the application as Windows .exe
npm run distThe executable will be created in the dist/ folder.
- Port: 8974 (configurable via
WEBSOCKET_PORT) - Purpose: Receives track information from WebNowPlaying extension
- Protocol: WebSocket
- Integration: Compatible with WebNowPlaying for Spicetify and browser extensions
- Port: 8090 (configurable via
HTTP_PORT) - Purpose: Serves the lyrics display interface
- Endpoints:
/- Main lyrics display page/lyrics- JSON API for lyrics data/position- JSON API for current track position/fonts/*- Font files
- File:
trayIcon.ico(16x16, 32x32, 48x48 pixels recommended) - Actions:
- Left-click: Toggle window visibility
- Right-click: Show context menu
- Show: Display lyrics window
- Quit: Close application completely
lyrics_ts/
βββ main.ts # Main Electron process
βββ lyricsDisplay.html # Lyrics display interface
βββ trayIcon.ico # System tray icon
βββ fonts/ # Custom fonts
βββ package.json # Project configuration
βββ tsconfig.json # TypeScript configuration
βββ README.md # This file
- Endpoint: Configurable via
LYRICS_API_BASE_URLenvironment variable - Parameters:
artistandtitle - API Key: Optional, set via
LYRICS_API_KEYenvironment variable - Response: JSON with synchronized lyrics data
This app is designed to work with WebNowPlaying extension for music detection:
-
Install WebNowPlaying Extension:
- For Spicetify: Install the WebNowPlaying extension
- For Chrome/Firefox: Install WebNowPlaying browser extension
-
Configure WebNowPlaying:
- Set the WebSocket server to:
ws://localhost:8974 - The app automatically listens on port 8974 for track information
- Set the WebSocket server to:
-
Supported Music Platforms:
- Spotify (via Spicetify)
- YouTube Music
- SoundCloud
- And many other web-based music players
The app expects WebSocket messages in the following format:
TITLE:song_titleARTIST:artist_namePOSITION:MM:SSDURATION:MM:SSALBUM:album_name(optional)COVER:cover_url(optional)
npm start- Run in development mode with ts-nodenpm run build- Compile TypeScript to JavaScriptnpm run electron-start- Run compiled JavaScript with Electronnpm run dist- Build Windows executable
node-fetch- HTTP requests for lyrics APIws- WebSocket server functionality
electron- Desktop application frameworkelectron-builder- Application packagingtypescript- TypeScript compilerts-node- TypeScript execution@types/node-fetch- TypeScript definitions@types/ws- TypeScript definitions
Modify lyricsDisplay.html to customize the lyrics display appearance.
Replace fonts in the fonts/ directory and update the CSS in lyricsDisplay.html.
Replace trayIcon.ico with your custom icon (recommended sizes: 16x16, 32x32, 48x48 pixels).
-
"Loading lyrics..." stuck
- Check if the HTTP server is running on port 8090
- Verify WebSocket connection on port 8974
- Check browser console for errors
- Ensure WebNowPlaying is configured to connect to
ws://localhost:8974
-
No music detection
- Install WebNowPlaying extension for your browser or Spicetify
- Configure WebNowPlaying to connect to
ws://localhost:8974 - Check if music is playing on a supported platform
- Verify WebSocket connection in browser DevTools
-
Tray icon not showing
- Ensure
trayIcon.icoexists in the project root - Check if the icon file is valid
- Ensure
-
Build errors
- Ensure all dependencies are installed:
npm install - Check TypeScript compilation:
npm run build
- Ensure all dependencies are installed:
Uncomment the following line in main.ts to open DevTools:
win.webContents.openDevTools();This project is licensed under the MIT License.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For issues and questions, please open an issue on the repository.
Built with β€οΈ using Electron and TypeScript