my_konfig
This commit is contained in:
33
config/waybar/rclone-status.sh
Executable file
33
config/waybar/rclone-status.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Default error state
|
||||
ICON=""
|
||||
TEXT="Unknown"
|
||||
|
||||
# Check for DBUS session
|
||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
||||
TEXT="No D-Bus"
|
||||
else
|
||||
# Check if the service is active (syncing)
|
||||
if systemctl --user is-active --quiet rclone-sync.service; then
|
||||
ICON=""
|
||||
TEXT="Sync..."
|
||||
else
|
||||
# Check if the service file exists/is loaded
|
||||
if ! systemctl --user list-units --all | grep -q "rclone-sync.service"; then
|
||||
TEXT="No Service"
|
||||
else
|
||||
LAST_STATUS=$(systemctl --user show rclone-sync.service -p ExecMainStatus --value)
|
||||
if [ "$LAST_STATUS" == "0" ]; then
|
||||
ICON=""
|
||||
TEXT="OK"
|
||||
else
|
||||
ICON=""
|
||||
TEXT="Fehler"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Output a single line of plain text
|
||||
printf "%s %s\n" "$ICON" "$TEXT"
|
||||
Reference in New Issue
Block a user