scripts/i3-configuration/i3blocks/activitywatch_status.sh

49 lines
879 B
Bash
Raw Normal View History

#!/bin/bash
# ActivityWatch status script for i3blocks
# Shows ActivityWatch installation and running status
# Check if ActivityWatch is installed
check_installed() {
2025-11-01 15:36:22 +01:00
# Check if activitywatch-bin package is installed
if pacman -Qi activitywatch-bin &> /dev/null; then
return 0
fi
# Check if aw-qt binary exists
if command -v aw-qt &> /dev/null; then
return 0
fi
return 1
}
# Check if ActivityWatch is running
check_running() {
2025-11-01 15:36:22 +01:00
# Check for aw-qt process
if pgrep -f "aw-qt" > /dev/null 2>&1; then
return 0
fi
# Check for aw-server process
if pgrep -f "aw-server" > /dev/null 2>&1; then
return 0
fi
return 1
}
# Main logic
if ! check_installed; then
2025-11-01 15:36:22 +01:00
echo "AW uninstalled"
echo
echo "#FF0000" # Red
elif check_running; then
2025-11-01 15:36:22 +01:00
echo "AW on"
echo
echo "#00FF00" # Green
else
2025-11-01 15:36:22 +01:00
echo "AW off"
echo
echo "#FF0000" # Red
fi