Skip to content

Instantly share code, notes, and snippets.

@Misko-2083
Last active April 28, 2024 11:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Misko-2083/46108de792972a5d451f to your computer and use it in GitHub Desktop.
Save Misko-2083/46108de792972a5d451f to your computer and use it in GitHub Desktop.
A simple YAD (Yet another Dialog) Time and Date bash script
#!/bin/bash
# Pipe
while true
do
echo "1:#$(date '+%T')"
echo "1:$(date '+%1S')"
echo "2:#$(date '+%D %a')"
echo "2:$((60-$(date '+%1S')))"
sleep 1
done | yad --progress --title="Time" --bar="Time":NORM --bar="Date":NORM
#-------------------------------
# Coprocess
coproc yad --progress --title="Time" --bar="Time":NORM --bar="Date":NORM
exec >&${COPROC[1]}
i=1
while ((i<=11))
do
seconds=$(date '+%1S')
echo "1:#$(date '+%T')"
echo "1:${seconds}"
echo "2:#$(date '+%D %a')"
echo "2:$((60-$seconds))"
sleep 1
((i=i+1))
done
kill $COPROC_PID
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment