summaryrefslogtreecommitdiff
path: root/.i3blocks/blocklets/calendar
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-02-16 13:23:56 -0500
committerluxagraf <sng@luxagraf.net>2020-02-16 13:23:56 -0500
commitcd507c92f617d4a8a3f7bb0b43e425491ef7184d (patch)
tree42144ef0f35b91e7955f570c5ecc4bcec3c4d780 /.i3blocks/blocklets/calendar
initial commit of dotfiles
Diffstat (limited to '.i3blocks/blocklets/calendar')
-rwxr-xr-x.i3blocks/blocklets/calendar38
1 files changed, 38 insertions, 0 deletions
diff --git a/.i3blocks/blocklets/calendar b/.i3blocks/blocklets/calendar
new file mode 100755
index 0000000..aceafe6
--- /dev/null
+++ b/.i3blocks/blocklets/calendar
@@ -0,0 +1,38 @@
+#! /bin/sh
+
+width=200
+height=200
+datefmt="+%a %m-%d %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 - $width / 2))
+ posY=$(($BLOCK_Y - $height))
+
+ i3-msg -q "exec gsimplecal \
+ --width=$width --height=$height \
+ --undecorated --fixed \
+ --close-on-unfocus --no-buttons \
+ --posx=$posX --posy=$posY \
+ > /dev/null"
+esac
+date "$datefmt"