summaryrefslogtreecommitdiff
path: root/idle.sh
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-06-03 20:16:16 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-06-03 20:16:16 +0800
commit05199392775329f634d05d049eba212fcc525e53 (patch)
tree23b16e3ad15641f9a084ed6518e90a971c6f9b50 /idle.sh
parente77257e756527f6fe7209ecdf27239d5dd5f6d36 (diff)
printf -> echo
Diffstat (limited to 'idle.sh')
-rwxr-xr-xidle.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/idle.sh b/idle.sh
index a83376d..3dd5dea 100755
--- a/idle.sh
+++ b/idle.sh
@@ -36,7 +36,7 @@ function idle() {
if [[ -f $lockpath/$disablelockfile ]]; then
/sbin/echo "idle: Idle is disabled"
fi
- printf "User is idle(afk) in %s\n" "$(date)"
+ /sbin/echo "User is idle(afk) in $(date)"
/sbin/echo "Creating lock file"
sudo /sbin/touch $lockpath/$lockfile || /sbin/echo "Failed to create lock file at $lockpath/$lockfile"
#if [ $mutev ]; then
@@ -71,7 +71,7 @@ function stopidle() {
if [[ -f $lockpath/$disablelockfile ]]; then
/sbin/echo "stopidle: Idle is disabled"
fi
- printf "User is back from idle(afk) in %s\n", "$(date)"
+ /sbin/echo "User is back from idle(afk) in $(date)"
#if [ $mutev ] && [ $soundlevel ]; then
# amixer set Master $soundlevel
# unset $soundlevel
@@ -100,10 +100,10 @@ function stopidle() {
if [ "$1" ]; then
if [[ "$1" == '-d' || "$1" == '--daemon' ]]; then
if ! pgrep "$0"; then
- /sbin/printf "PID: "
+ /sbin/echo -n "PID: "
/sbin/echo $$ | sudo /sbin/tee $lockpath/$pidfile || echo "PID Grab failed"
else
- /sbin/printf "An instance of this program is dectected, please close that instance in order to launch another\n"
+ /sbin/echo "An instance of this program is dectected, please close that instance in order to launch another"
fi
while true; do
if [[ "$(systemctl is-system-running)" == "running" || "$(systemctl is-system-running)" == "degraded" ]]; then
@@ -139,5 +139,5 @@ if [ "$1" ]; then
fi
fi
-/sbin/printf "Un-recornized option: '$@', Please use options:\n\t-d|--daemon\tTo start daemon(auto idle actions)\n\t--idle|--pause\tTo call \`idle\` function\n\t--continue|--stopidle\tTo call \`stopidle\` function\n"
+/sbin/echo -e "Un-recornized option: '$@', Please use options:\n\t-d|--daemon\tTo start daemon(auto idle actions)\n\t--idle|--pause\tTo call \`idle\` function\n\t--continue|--stopidle\tTo call \`stopidle\` function"
exit 1