Last active
August 29, 2015 13:56
-
-
Save thatmaheshrs/8898642 to your computer and use it in GitHub Desktop.
A shell script that uses Zenity to show current date and time (read more at https://bit.ly/showDateTime).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # COPYRIGHT: That Mahesh RS (https://sites.google.com/site/thatmaheshrs) | |
| # | |
| # This program is free software: you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation, either version 3 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| # GNU General Public License for more details. | |
| # | |
| # You should have received a copy of the GNU General Public License | |
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| # | |
| # ---- README ---- | |
| # install this script in /usr/local/bin | |
| # then chmod +x this script | |
| # then you could add a keyboard shortcut to invoke this script | |
| WEEKDAY=`date +"%A"` | |
| MONTH=`date +"%B"` | |
| DAYOFMONTH=`date +"%d"` | |
| YEAR=`date +"%Y"` | |
| DATE=`date +"%F"` | |
| TIME=`date +"%I:%M %p %Z"` | |
| SHOWDATE="${MONTH} ${DAYOFMONTH}, ${YEAR}" | |
| DATE_TIME_TO_SHOW=" | |
| <span font='22' color='blue'><tt>Day : </tt></span><span font='32' color='brown'>$WEEKDAY\n</span> | |
| <span font='22' color='blue'><tt>Date: </tt></span><span font='32' color='darkgreen'>$SHOWDATE\n</span> | |
| <span font='22' color='blue'><tt>Time: </tt></span><span font='32' color='green'>$TIME\n\n</span> | |
| <span font='10' color='blue'><i>Hit 'ESC' to close this window or wait till progress bar is full.</i></span>" | |
| PROGRESS_COUNT=0 | |
| PROGRESS_COUNT_MAX=110 # in % | |
| PROGRESS_COUNT_INCREMENT=15 # i.e. jump up 15% at a time | |
| while [ ${PROGRESS_COUNT} -lt ${PROGRESS_COUNT_MAX} ] | |
| do | |
| echo ${PROGRESS_COUNT} | |
| sleep 1 | |
| PROGRESS_COUNT=`expr ${PROGRESS_COUNT} + ${PROGRESS_COUNT_INCREMENT}` | |
| done | zenity --progress --auto-close --no-cancel --title="Date and Time" --text="${DATE_TIME_TO_SHOW}" | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code cleanup:
HTH!