A Waybar module that displays Islamic prayer times and automatically plays the adhan (call to prayer). Features automatic location detection, timezone handling, and interactive mute controls with real-time status updates.
- ๐ Automatic Location Detection: Uses IP-based geolocation to calculate prayer times (fallback: Makkah)
- โฐ Smart Prayer Times: Displays next prayer and countdown in Waybar tooltip
- ๐ Auto Adhan Playback: Plays call to prayer at correct times with multiple audio backend support
- ๐ Interactive Mute: Click to toggle adhan on/off with instant visual feedback
- ๐จ Customizable: Full control over appearance and prayer calculation methods
- ๐ Auto Refresh: Updates prayer times daily and responds to mute changes immediately
- ๐ Easy Install/Uninstall: Automated scripts with backup/restore capabilities
- โ๏ธ Systemd Integration: Runs as a user service, starts automatically on login
- Waybar (Wayland status bar)
- Python 3.8+
- jq (JSON processor for waybar scripts)
- curl (HTTP requests)
- VLC (python-vlc library + VLC player) โ recommended
- mpv
- ffplay (from ffmpeg)
Install on Arch-based systems:
sudo pacman -S waybar python python-pip jq curl vlc-
Clone the repository:
git clone https://github.com/mehdiz5/PrayerTime-Waybar.git cd PrayerTime-Waybar -
Add your adhan audio file:
# Copy or download your preferred adhan MP3 to the project directory cp /path/to/your/adhan.mp3 ./azan.mp3 # Or download one (example): # wget https://example.com/adhan.mp3 -O azan.mp3
-
Run the installer:
./install.sh
The installer will:
- Create a Python virtual environment
- Install required Python packages
- Prompt for your Waybar config paths (defaults provided)
- Create backups of your Waybar config and style files
- Add the
custom/azanmodule to your Waybar config - Append module styles to your style.css
- Generate and enable a systemd user service
- Start the prayer daemon
-
Restart Waybar (if it doesn't auto-reload):
killall waybar && waybar &
You should now see the prayer module in your Waybar!
The daemon uses pyIslam for prayer time calculations. Edit azan_daemon.py to change the calculation method (line ~53):
def get_prayer_times():
lat, lon, tz_name, offset = get_location_info()
pconf = PrayerConf(lon, lat, offset, 5, 1) # Change the 5 here
# ^
# Method IDAvailable methods: 1 (Karachi), 2 (MWL), 3 (Egypt), 4 (Makkah), 5 (ISNA - default), 6 (France). See pyIslam documentation for details.
By default, the module is added to modules-center. To change position, edit your ~/.config/waybar/config.jsonc:
{
"modules-left": ["..."],
"modules-center": ["clock", "custom/azan"], // Move here if desired
"modules-right": ["..."]
}Customize the module appearance in ~/.config/waybar/style.css:
#custom-azan {
color: #b4befe; /* Icon color */
background: transparent;
font-size: 14px;
padding: 0 10px;
margin: 0 5px;
border-radius: 8px;
}
#custom-azan:hover {
color: #f9e2af; /* Hover color */
background: rgba(180, 190, 254, 0.1);
}Replace azan.mp3 with your preferred audio file:
cp /path/to/new-adhan.mp3 ./azan.mp3
systemctl --user restart prayer-daemon- Click the module: Toggle mute on/off (immediate visual update via signal)
- Hover over module: See all prayer times with next prayer highlighted
# Check service status
systemctl --user status prayer-daemon
# Restart the daemon
systemctl --user restart prayer-daemon
# Stop the daemon
systemctl --user stop prayer-daemon
# View logs
journalctl --user -u prayer-daemon -f
# Check current status via API
curl http://127.0.0.1:4567/status | jq
# Toggle mute via API
curl http://127.0.0.1:4567/mute-
Verify daemon is running:
systemctl --user status prayer-daemon curl http://127.0.0.1:4567/status
-
Check Waybar config was updated:
grep -A 6 '"custom/azan"' ~/.config/waybar/config.jsonc
Should show:
"custom/azan": { "exec": "/full/path/to/scripts/waybar-azan.sh", "return-type": "json", "interval": 20, "on-click": "/full/path/to/scripts/waybar-azan-mute.sh", "signal": 20 }
-
Check module in modules array:
grep "modules-" ~/.config/waybar/config.jsonc | grep azan
-
Verify scripts are executable:
ls -la scripts/waybar-azan*.sh -
Restart Waybar:
killall waybar && waybar &
-
Check service logs:
journalctl --user -u prayer-daemon --no-pager -n 50
-
Verify Python environment:
./env/bin/python --version ./env/bin/pip list | grep -E "vlc|requests|pytz|islam"
-
Test daemon manually:
./env/bin/python azan_daemon.py
-
Check audio file exists:
file azan.mp3 mpv azan.mp3 # Test playback -
Verify VLC/audio player is installed:
which vlc mpv ffplay
-
Check mute status:
curl http://127.0.0.1:4567/status | jq '.muted_status'
-
Test VLC library:
./env/bin/python -c "import vlc; print('VLC OK')"
-
Check detected location:
curl https://ipinfo.io/json | jq -
Verify timezone:
timedatectl
-
Check daemon location info (look at startup logs):
journalctl --user -u prayer-daemon | grep -i location -
Test location detection:
./env/bin/python -c " import requests data = requests.get('https://ipinfo.io/json').json() print(f\"Location: {data['city']}, {data['country']}\") print(f\"Coordinates: {data['loc']}\") print(f\"Timezone: {data['timezone']}\") "
Run the automated uninstaller:
./uninstall.shThe script will:
- Stop and disable the systemd service
- Kill any running daemon processes
- Remove the service file
- Restore your Waybar config and style from backups
- Optionally remove the Python virtual environment
After uninstalling, verify the daemon is no longer running:
# Check for running daemon process
pgrep -f azan_daemon.py
# Try to connect to API (should fail)
curl -f http://127.0.0.1:4567/status 2>/dev/null && echo "Still running!" || echo "Stopped โ"
# Check systemd service status
systemctl --user status prayer-daemonIf the daemon is still running, manually stop it:
# Kill daemon process
pkill -f azan_daemon.py
# Or force kill if needed
pkill -9 -f azan_daemon.pyThen restart Waybar:
killall waybar && waybar &To completely remove the project:
cd ..
rm -rf PrayerTime-WaybarPrayerTime-Waybar/
โโโ azan_daemon.py # Main daemon (HTTP server + adhan scheduler)
โโโ azan.mp3 # Your adhan audio file (not included)
โโโ install.sh # Automated installer
โโโ uninstall.sh # Automated uninstaller
โโโ requirements.txt # Python dependencies
โโโ scripts/
โ โโโ waybar-azan.sh # Status display script (called by Waybar)
โ โโโ waybar-azan-mute.sh # Mute toggle script (on-click handler)
โโโ waybar/
โ โโโ style.css # CSS styles for the module
โโโ env/ # Python virtual environment (created by installer)
The daemon exposes a local HTTP API on 127.0.0.1:4567:
Returns current prayer times and status:
{
"text": "Prayer",
"tooltip": "<b>โ Asr : 15:23</b>\nMaghrib : 17:45\n...",
"next_prayer": "Asr",
"next_time": "15:23",
"muted_status": "No"
}Toggles mute state and returns:
{
"mute": true
}Contributions are welcome! Areas for improvement:
- Add configuration file for easier customization
- Support more prayer calculation methods
- Add notification support (libnotify)
- Configurable adhan files per prayer
- GUI for configuration
- Systemd timer for prayer time updates
- Support for multiple locations/timezones
This project is open source. Feel free to use, modify, and distribute.
- Uses pyIslam for prayer time calculations
- Built for Waybar
- Inspired by the Muslim community's need for prayer time tools on Linux
- Custom adhan for specific prayers
- Prayer reminder notifications
- Multiple audio file support
- Prayer time adjustments
This project is open source under the MIT License.