summaryrefslogtreecommitdiff
path: root/cal.sh
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-06-15 15:58:59 -0500
committerluxagraf <sng@luxagraf.net>2023-06-15 15:58:59 -0500
commitab987e10f154f5536bb8fd936ae0966e909fa969 (patch)
tree9de5076f38b71ececb1bc94f8d9d19170898d603 /cal.sh
added all my scriptssynced/master
Diffstat (limited to 'cal.sh')
-rwxr-xr-xcal.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/cal.sh b/cal.sh
new file mode 100755
index 0000000..e6a38fb
--- /dev/null
+++ b/cal.sh
@@ -0,0 +1,39 @@
+
+#! /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))
+
+ swaymsg -q "exec gsimplecal \
+ --width=$width --height=$height \
+ --undecorated --fixed \
+ --close-on-unfocus --no-buttons \
+ --posx=$posX --posy=$posY \
+ > /dev/null"
+esac
+date "$datefmt"