36 lines
768 B
Bash
Executable File
36 lines
768 B
Bash
Executable File
#!/bin/bash
|
|
|
|
DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"}
|
|
SHORTFMT=${SHORTFMT:-"+%H:%M:%S"}
|
|
|
|
OPTIND=1
|
|
while getopts ":f:" opt; do
|
|
case $opt in
|
|
f) DATEFMT="$OPTARG" ;;
|
|
\?)
|
|
echo "Invalid option: -$OPTARG" >&2
|
|
exit 1
|
|
;;
|
|
:)
|
|
echo "Option -$OPTARG requires an argument." >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
case "$BLOCK_BUTTON" in
|
|
1|2|3)
|
|
# Try to focus Thunderbird
|
|
i3-msg -q [class="Thunderbird" instance="Mail"] focus
|
|
if [ $? == 2 ]
|
|
then
|
|
# Open Thunderbird if it was not open
|
|
i3-msg -q "exec thunderbird -mail -calendar"
|
|
else
|
|
# Open calendar
|
|
xdotool key --clearmodifiers --delay 5 ctrl+shift+c
|
|
fi
|
|
esac
|
|
echo "$LABEL$(date "$DATEFMT")"
|
|
echo "$LABEL$(date "$SHORTFMT")"
|