aboutsummaryrefslogtreecommitdiff
path: root/scripts/image.sh
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2020-12-24 00:06:27 +0530
committerAkshay Nair <phenax5@gmail.com>2020-12-24 00:06:27 +0530
commit865728068c965e066d0f8971c5b5ba26e12e7dce (patch)
treec16195f0a04cf7d004fe5b396255734f4d60bb00 /scripts/image.sh
parent649ef5f225039e498358c3d056dfd7fcbc56f014 (diff)
downloadnixos-config-865728068c965e066d0f8971c5b5ba26e12e7dce.tar.gz
nixos-config-865728068c965e066d0f8971c5b5ba26e12e7dce.zip
Adds scripts and links scripts and wallpapers
Diffstat (limited to 'scripts/image.sh')
-rwxr-xr-xscripts/image.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/image.sh b/scripts/image.sh
new file mode 100755
index 0000000..66031ec
--- /dev/null
+++ b/scripts/image.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+source "`ueberzug library`";
+
+readonly ID_PREVIEW="preview";
+
+#case "$1" in
+ #"clear") ImageLayer 0< <(
+ #ImageLayer::remove [identifier]="$ID_PREVIEW"
+ #) ;;
+ #"draw") ImageLayer 0< <(
+ #ImageLayer::add \
+ #[identifier]="$ID_PREVIEW" \
+ #[x]="$3" [y]="$4" \
+ #[max_width]="$5" [max_height]="$6" \
+ #[path]="$2";
+ #read -ern 1;
+ #) ;;
+ #"*") echo "Unknown command: '$1'" ;;
+#esac
+
+LAST_IMAGE=$([[ -f "$LAST_IMAGE_F" ]] && cat $LAST_IMAGE_F);
+
+clear_img() {
+ echo "" > $FIFO_UEBERZUG;
+
+ if [[ ! -z "$LAST_IMAGE" ]]; then
+ declare -p -A cmd=([action]=remove [identifier]="$LAST_IMAGE") \
+ > "$FIFO_UEBERZUG";
+ fi;
+}
+
+clear_img;
+
+case "$1" in
+ "clear") clear_img ;;
+ "draw")
+ LAST_IMAGE="preview-$2";
+ declare -p -A cmd=([action]=add [identifier]="$LAST_IMAGE" \
+ [x]="$3" [y]="$4" [max_width]="$5" [max_height]="$6" \
+ [path]="$2") > "$FIFO_UEBERZUG";
+ echo -e "$LAST_IMAGE" > $LAST_IMAGE_F;
+ ;;
+ "*") echo "Unknown command: '$1', '$2'" ;;
+esac
+