mirror of
https://github.com/kuhyx/scripts.git
synced 2026-07-04 16:43:13 +02:00
49 lines
879 B
Bash
Executable File
49 lines
879 B
Bash
Executable File
#!/bin/bash
|
|
# ActivityWatch status script for i3blocks
|
|
# Shows ActivityWatch installation and running status
|
|
|
|
# Check if ActivityWatch is installed
|
|
check_installed() {
|
|
# 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() {
|
|
# 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
|
|
echo "AW uninstalled"
|
|
echo
|
|
echo "#FF0000" # Red
|
|
elif check_running; then
|
|
echo "AW on"
|
|
echo
|
|
echo "#00FF00" # Green
|
|
else
|
|
echo "AW off"
|
|
echo
|
|
echo "#FF0000" # Red
|
|
fi
|