From d3bb8a1ecb741723a014da90f5c5798d1da0f62d Mon Sep 17 00:00:00 2001 From: David Luevano <55825613+luevano@users.noreply.github.com> Date: Tue, 11 Feb 2020 00:51:35 -0700 Subject: Add blocklets and py --- .local/bin/blocklets/calendar | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 .local/bin/blocklets/calendar (limited to '.local/bin/blocklets/calendar') diff --git a/.local/bin/blocklets/calendar b/.local/bin/blocklets/calendar new file mode 100755 index 0000000..eb8e210 --- /dev/null +++ b/.local/bin/blocklets/calendar @@ -0,0 +1,41 @@ +#! /bin/sh + +WIDTH=${WIDTH:-200} +HEIGHT=${HEIGHT:-200} +DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"} +SHORTFMT=${SHORTFMT:-"+%H:%M:%S"} + +OPTIND=1 +while getopts ":f:W:H:" opt; do + case $opt in + f) DATEFMT="$OPTARG" ;; + W) WIDTH="$OPTARG" ;; + H) HEIGHT="$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) + + # the position of the upper left corner of the popup + # The size is hardcoded for a 1080p monitor. + posX=$((1899 - $WIDTH)) + posY=$((35)) + + i3-msg -q "exec yad --calendar \ + --width=$WIDTH --height=$HEIGHT \ + --undecorated --fixed \ + --close-on-unfocus --no-buttons \ + --posx=$posX --posy=$posY \ + > /dev/null" +esac +echo "$LABEL$(date "$DATEFMT")" +echo "$LABEL$(date "$SHORTFMT")" -- cgit v1.2.3-54-g00ecf