mirror of
https://github.com/bvanroll/_dotfiles.git
synced 2025-08-29 12:02:46 +00:00
32 lines
661 B
Bash
Executable File
32 lines
661 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# The service we want to check or toggle (according to systemctl)
|
|
SERVICE=$BLOCK_INSTANCE
|
|
# Colors to display
|
|
INACTIVE_COLOR=#888888
|
|
ACTIVE_COLOR=#22BB22
|
|
# Exact string to display
|
|
ACTIVE="<span foreground=\"$ACTIVE_COLOR\">$SERVICE</span>"
|
|
INACTIVE="<span foreground=\"$INACTIVE_COLOR\"><s>$SERVICE</s></span>"
|
|
|
|
if [ "$( systemctl is-active "$SERVICE" )" != "active" ]
|
|
then
|
|
if [ "$BLOCK_BUTTON" == '1' ]
|
|
then
|
|
if systemctl start "$SERVICE"
|
|
then
|
|
echo "$ACTIVE"
|
|
fi
|
|
fi
|
|
echo "$INACTIVE"
|
|
else
|
|
if [ "$BLOCK_BUTTON" == '1' ]
|
|
then
|
|
if systemctl stop "$SERVICE"
|
|
then
|
|
echo "$INACTIVE"
|
|
fi
|
|
fi
|
|
echo "$ACTIVE"
|
|
fi
|