Jelajahi Sumber

added calendar

Phil 7 tahun lalu
induk
melakukan
065308a172
2 mengubah file dengan 42 tambahan dan 3 penghapusan
  1. 3 3
      Readme.md
  2. 39 0
      calendar

+ 3 - 3
Readme.md

@@ -1,4 +1,4 @@
-i3blocks.conf: ~/.i3blocks.conf
-i3conf ~/.config/i3/configuration
-mediaplayer /usr/share/i3blocks/mediaplayer
+*i3blocks.conf: ~/.i3blocks.conf
+*3conf ~/.config/i3/configuration
+*mediaplayer /usr/share/i3blocks/mediaplayer
 

+ 39 - 0
calendar

@@ -0,0 +1,39 @@
+#! /bin/sh
+
+width=200
+height=200
+datefmt="+%a %d.%m.%Y %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 yad --calendar \
+        --width=$width --height=$height \
+	    --undecorated --fixed \
+	    --close-on-unfocus --no-buttons \
+	    --posx=$posX --posy=$posY \
+	    > /dev/null"
+esac
+date "$datefmt"
+