aboutsummaryrefslogtreecommitdiff
path: root/configs/i3/i3blocks/scripts/calendar
diff options
context:
space:
mode:
authorbenj <benj@rse8.com>2019-08-19 17:52:11 -0700
committerbenj <benj@rse8.com>2019-08-19 17:52:11 -0700
commitdd8097084fe0d159f0a357f426fca986895e5ef4 (patch)
treed8757c4b6002ec70f5a1acb8c488a29031b54441 /configs/i3/i3blocks/scripts/calendar
parentd35ad4048b33d687d8cec617a3c39a1d362af909 (diff)
downloadsetup-dd8097084fe0d159f0a357f426fca986895e5ef4.tar
setup-dd8097084fe0d159f0a357f426fca986895e5ef4.tar.gz
setup-dd8097084fe0d159f0a357f426fca986895e5ef4.tar.bz2
setup-dd8097084fe0d159f0a357f426fca986895e5ef4.tar.lz
setup-dd8097084fe0d159f0a357f426fca986895e5ef4.tar.xz
setup-dd8097084fe0d159f0a357f426fca986895e5ef4.tar.zst
setup-dd8097084fe0d159f0a357f426fca986895e5ef4.zip
added i3 configs with some dangling refs... :(
Diffstat (limited to '')
-rwxr-xr-xconfigs/i3/i3blocks/scripts/calendar40
1 files changed, 40 insertions, 0 deletions
diff --git a/configs/i3/i3blocks/scripts/calendar b/configs/i3/i3blocks/scripts/calendar
new file mode 100755
index 0000000..7ad0363
--- /dev/null
+++ b/configs/i3/i3blocks/scripts/calendar
@@ -0,0 +1,40 @@
+#! /bin/sh
+
+WIDTH=${WIDTH:-100}
+HEIGHT=${HEIGHT:-100}
+DATEFMT=${DATEFMT:-"+%Y-%M-%d %H:%m"}
+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
+ posX=$(( ( $BLOCK_X - 230 ) - $WIDTH / 2 ))
+ posY=$(( ( $BLOCK_Y - 200 ) - $HEIGHT ))
+
+ 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") "