Added uberzug support for image previews

pull/19/head
mananapr 5 years ago
parent 5ba2f4d6af
commit ef77f6f359

@ -109,5 +109,6 @@ a similar UI.
- [x] Add ability to run external scripts
- [x] Remove hardcoded paths
- [x] Use dynamic allocation wherever static arrays are used
- [ ] Update README section about Image previews and add about `Uberzug`
- [ ] Replace `system()` by safer functions
- [ ] Refactor Code

@ -0,0 +1,15 @@
#!/bin/bash
kill -9 `ps aux | grep uberzug | grep -v grep | sort | awk '{print $2}'`
#function ImageLayer {
# ueberzug layer -sp json
#}
#
#function remove_image {
# echo "{\"action\": \"remove\", \"identifier\": \"image\"}";
#}
#
#ImageLayer -< <(
# remove_image
#)

@ -0,0 +1,21 @@
#!/usr/bin/env bash
function ImageLayer {
ueberzug layer -sp json 2> /dev/null
}
# ~/ doesn't work
path_to_image="$5"
x="$1"
y="$(($2-1))"
maxx="$3"
maxy="$(($4-2))"
function add_image {
echo "{\"action\": \"add\", \"identifier\": \"image\", \"x\": $x, \"y\": $y, \"max_width\": $maxx, \"max_height\": $maxy, \"path\": \"$path_to_image\"}";
}
ImageLayer -< <(
add_image
read
)
Loading…
Cancel
Save