summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrabite <rabite@posteo.de>2019-07-17 22:56:30 +0200
committerrabite <rabite@posteo.de>2019-07-17 22:56:30 +0200
commitf38093ad1f5b890d8912aaae1ff883961d44fa01 (patch)
tree2ea72cfa39346069d6fd80bfec602be64ebd2a40
parent3ba311a5bbf07a18eb52c9aee23fc069015c3dfd (diff)
big fat update to graphics mode (performance, features, etc)
-rw-r--r--Cargo.lock195
-rw-r--r--Cargo.toml26
-rw-r--r--README.md10
-rw-r--r--config.tar.gzbin2235 -> 2494 bytes
-rw-r--r--src/config.rs53
-rw-r--r--src/coordinates.rs15
-rw-r--r--src/hunter-media.rs1009
-rw-r--r--src/imgview.rs25
-rw-r--r--src/main.rs10
-rw-r--r--src/mediaview.rs89
-rw-r--r--src/preview.rs83
-rw-r--r--src/term.rs17
-rw-r--r--src/widget.rs5
13 files changed, 989 insertions, 548 deletions
diff --git a/Cargo.lock b/Cargo.lock
index ab33336..840fc80 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -342,118 +342,175 @@ dependencies = [
[[package]]
name = "glib"
-version = "0.5.0"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "glib-sys"
-version = "0.6.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gobject-sys"
-version = "0.6.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer"
-version = "0.11.6"
+version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
- "muldiv 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
+ "muldiv 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-app"
-version = "0.11.2"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer 0.11.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-app-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-base 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-app-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-app-sys"
-version = "0.5.0"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-base"
-version = "0.11.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer 0.11.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-base-sys"
-version = "0.5.0"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-player"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-player-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-video 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-player-sys"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-video-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-sys"
-version = "0.5.0"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-video"
+version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-video-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-video-sys"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -470,8 +527,11 @@ dependencies = [
"dirs-2 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer 0.11.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "gstreamer-app 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-app 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-player 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-video 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -485,7 +545,8 @@ dependencies = [
"rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"signal-notify 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "sixel 0.3.0 (git+https://github.com/rabite0/sixel-rs?tag=v0.3.0)",
+ "sixel 0.3.1 (git+https://github.com/rabite0/sixel-rs?tag=v0.3.1)",
+ "sixel-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"systemstat 0.1.4 (git+https://github.com/myfreeweb/systemstat?tag=v0.1.4)",
"termion 1.5.3 (git+https://github.com/redox-os/termion)",
"tree_magic 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -695,7 +756,7 @@ dependencies = [
[[package]]
name = "muldiv"
-version = "0.1.1"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -775,15 +836,6 @@ dependencies = [
[[package]]
name = "num-rational"
-version = "0.1.42"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "num-rational"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
@@ -1223,8 +1275,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "sixel"
-version = "0.3.0"
-source = "git+https://github.com/rabite0/sixel-rs?tag=v0.3.0#9018082b3b5d094e7a634292d7c3ae09f4fd2cd1"
+version = "0.3.1"
+source = "git+https://github.com/rabite0/sixel-rs?tag=v0.3.1#e94c283d920a6c2e73aadea9635ef9331e00ea8e"
dependencies = [
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"semver-parser 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1297,7 +1349,7 @@ dependencies = [
[[package]]
name = "termion"
version = "1.5.3"
-source = "git+https://github.com/redox-os/termion#11fbe7155681c3c87495a2fa8ee9f822b18e2b2a"
+source = "git+https://github.com/redox-os/termion#c27678efc2ed14576361c7ce6d806a6bb576f1a9"
dependencies = [
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1541,15 +1593,19 @@ dependencies = [
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
"checksum gif 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "86c2f2b597d6e05c86ee5947b2223bda468fe8dad3e88e2a6520869322aaf568"
-"checksum glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e0be1b1432e227bcd1a9b28db9dc1474a7e7fd4227e08e16f35304f32d09b61"
-"checksum glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615bef979b5838526aee99241afc80cfb2e34a8735d4bcb8ec6072598c18a408"
-"checksum gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70409d6405db8b1591602fcd0cbe8af52cd9976dd39194442b4c149ba343f86d"
-"checksum gstreamer 0.11.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6c5a43723784a8b3a308541f3752370ee0ee3b6dc26ed50cdd06e8d9f5399cc"
-"checksum gstreamer-app 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4e68d96a6a86fe4e4796d7ecb5a3cacd6b4680277da6daea7934612fa8c5c2bf"
-"checksum gstreamer-app-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a224d33c7780957c30f9280b1256b3882792dda6916f75b54bb30b5b71ed505a"
-"checksum gstreamer-base 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05ec7a84b4160b61c72ea27ccf3f46eb9c8f996c5991746623e69e3e532e3cb5"
-"checksum gstreamer-base-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "501a7add44f256aab6cb5b65ef121c449197cf55087d6a7586846c8d1e42e88b"
-"checksum gstreamer-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b2f51e25a6f97dd4bfd640cba96f192f8759b8766afd66d6d9ea0f82ca14a37"
+"checksum glib 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d70d737019da0473a7cd6d9240571cf58c6897dcb10edf32b90774f4ba237c1b"
+"checksum glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b86a9169fbc9cf9a0ef315039c2304b09d5c575c5fde7defba3576a0311b863"
+"checksum gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61d55bc9202447ca776f6ad0048c36e3312010f66f82ab478e97513e93f3604b"
+"checksum gstreamer 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4fa1bf3aa35e465a976a28b3f32df88b773d8707a1c40cd8a6d5d29f4384256c"
+"checksum gstreamer-app 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a85485c2db4149ccb24d0b3c6598725743dec254bf757ac7a3684e62b9822c27"
+"checksum gstreamer-app-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41c85ef44d827b9292833203f6623cf6592d5eda06ad1eeefa63bca0cc38ce71"
+"checksum gstreamer-base 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f9e72a0456c51e9cf3a21c96539bed9be3f38c85ea49eee6d87a4d61db0cc2b0"
+"checksum gstreamer-base-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ba1955ea091323c17fdf8ff54fd7cf3dfed1a6035193ba08f85eb76bf549056"
+"checksum gstreamer-player 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "78395f87de2b954ca3e33a594a4eb85e68246f5f41a70bf0ab52187aacb4d3a9"
+"checksum gstreamer-player-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c3608d3e96c8977f31b9b8db7da0b8d0e96758b060e3f05fc3ee9626d75ab1c5"
+"checksum gstreamer-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bdfc2f6cc9b6a1f5159bfd500310fe431cfb0b74b3af17ce3fdf8353cf586975"
+"checksum gstreamer-video 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44868f3390bec7cad142f5fc3e39bb1782d1453d07889efd2ac69a50b0656d1f"
+"checksum gstreamer-video-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b8fcb1e577de93d1ad1e5117234ce64d40f215143d752140719923651608983"
"checksum image 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)" = "99198e595d012efccf12abf4abc08da2d97be0b0355a2b08d101347527476ba4"
"checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff"
"checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718"
@@ -1574,7 +1630,7 @@ dependencies = [
"checksum mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "83f51996a3ed004ef184e16818edc51fadffe8e7ca68be67f9dee67d84d0ff23"
"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40"
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
-"checksum muldiv 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1cbef5aa2e8cd82a18cc20e26434cc9843e1ef46e55bfabe5bddb022236c5b3e"
+"checksum muldiv 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "451a9a05d2a32c566c897835e0ea95cf79ed2fdfe957924045a1721a36c9980f"
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
"checksum nom 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf51a729ecf40266a2368ad335a5fdde43471f545a967109cd62146ecf8b66ff"
@@ -1583,7 +1639,6 @@ dependencies = [
"checksum num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2"
"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e"
-"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e"
"checksum num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2885278d5fe2adc2f75ced642d52d879bffaceb5a2e0b1d4309ffdfb239b454"
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
@@ -1636,7 +1691,7 @@ dependencies = [
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum signal-notify 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "847fbedad7c2e6fbb6077befa1fa61a6336658eaae2d9fe66cb94a0024742f4e"
"checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac"
-"checksum sixel 0.3.0 (git+https://github.com/rabite0/sixel-rs?tag=v0.3.0)" = "<none>"
+"checksum sixel 0.3.1 (git+https://github.com/rabite0/sixel-rs?tag=v0.3.1)" = "<none>"
"checksum sixel-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fb46e0cd5569bf910390844174a5a99d52dd40681fff92228d221d9f8bf87dea"
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
diff --git a/Cargo.toml b/Cargo.toml
index 407a351..b32ec48 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -40,13 +40,22 @@ osstrtools = "0.1.9"
pathbuftools = "0.1"
clap = "2.33"
mime = "0.3.13"
-# Updated to work with recent sixel-sys
-sixel = { git = "https://github.com/rabite0/sixel-rs", tag="v0.3.0" }
-base64 = { version = "0.10.1" }
+base64 = "0.10.1"
+#glib = "*"
image = { version = "0.21.1", optional = true }
-gstreamer = { version = "0.11.2", optional = true }
-gstreamer-app = { version = "0.11.2", optional = true }
+gstreamer = { version = "0.14", optional = true }
+gstreamer-app = { version = "0.14", optional = true }
+gstreamer-player = { version = "0.14", optional = true }
+gstreamer-video = { version = "0.14", optional = true }
+gstreamer-base = { version = "0.14", optional = true }
+sixel-sys = { version="0.3.1" , optional = true }
+
+[dependencies.sixel-rs]
+package = "sixel"
+git = "https://github.com/rabite0/sixel-rs"
+tag="v0.3.1"
+optional = true
[build-dependencies]
# Added terminal_size_pixels recently
@@ -54,9 +63,10 @@ termion = { git = "https://github.com/redox-os/termion" }
rustc_version = "0.2.3"
[features]
-default = ["img", "video"]
-video = ["gstreamer", "gstreamer-app"]
+default = ["img", "video", "sixel"]
+video = ["gstreamer", "gstreamer-app", "gstreamer-player","gstreamer-video", "gstreamer-base"]
img = ["image"]
+sixel = ["sixel-rs", "sixel-sys"]
[[bin]]
name = "hunter"
@@ -65,7 +75,7 @@ path = "src/main.rs"
[[bin]]
name = "hunter-media"
path = "src/hunter-media.rs"
-required-features = ["img"]
+required-features = ["img", "sixel"]
diff --git a/README.md b/README.md
index 7b22307..e182a48 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,7 @@ hunter
NEW
+- [Graphics] High quality support for graphics using SIXEL/kitty protocols
- [QuickActions] Added quick action creator/customizer
- [Previews] New and improved preview customization
- [**[IRC channel](https://webchat.freenode.net/?channels=hunter)**] Problems? Bugs? Praise? Chat with us: [#hunter @ Freenode](https://webchat.freenode.net/?channels=hunter)!
@@ -41,7 +42,7 @@ A big thanks to ranger and its developers. Without its inspiration this wouldn't
* Exit and cd into last directory and put selected files into shell variables
* Slide up animation for previews for a smoother experience (configurable)
* Can show icons with the [right fonts](https://github.com/ryanoasis/nerd-fonts)
-* Optional support for previews of image/video/audio files using Unicode half-block drawing
+* Optional support for previews of image(+pdf)/video/audio files using Unicode half-block drawing and SIXEL, or kitty's graphics protocol
@@ -67,7 +68,7 @@ hunter comes with definitions to enable previewing certain file typse. To use th
* bat / highlight for syntax highlighting
* 7z for archives
* w3m / links / elinks / lynx for html
-* pdftotext / mutool for pdf
+* pdftotext / mutool for pdf or pdftoppm in graphics mode
### Debian/Ubuntu
@@ -122,8 +123,11 @@ show_hidden=off
select_cmd=find -type f | fzf -m
cd_cmd=find -type d | fzf
icons=off
+ratios=20,30,49
media_autostart=off
media_mute=off
+media_previewer=hunter-media
+graphics_mode=auto
```
## Previews
@@ -137,6 +141,8 @@ and create a symlink to it in
with the extension of the file type you want to preview. Make sure the script is executable. That's it.
+A graphical previewer can be created by appending ```.g``` to the name of the symlink. It should print the path to the generated image file. If you want the file deleted after display, create it in the ```/tmp/hunter-preview``` directory.
+
## Quick Actions
These are executables you can run by pressing ```a```. Which actions you can see depends on the MIME type of the files you have selected. If you have multiple files selected, hunter will try to use the most specific MIME type possible. For example, if you have selected a bunch of images with different types you will see actions for "image/". You can see the computed MIME type in the header bar.
diff --git a/config.tar.gz b/config.tar.gz
index c81b374..91fdb29 100644
--- a/config.tar.gz
+++ b/config.tar.gz
Binary files differ
diff --git a/src/config.rs b/src/config.rs
index 1893935..864248d 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -14,7 +14,7 @@ struct ArgvConfig {
animation: Option<bool>,
show_hidden: Option<bool>,
icons: Option<bool>,
- sixel: Option<bool>,
+ graphics: Option<String>,
}
impl ArgvConfig {
@@ -23,7 +23,7 @@ impl ArgvConfig {
animation: None,
show_hidden: None,
icons: None,
- sixel: None
+ graphics: None
}
}
}
@@ -37,7 +37,6 @@ pub fn set_argv_config(args: clap::ArgMatches) -> HResult<()> {
let animation = args.is_present("animation-off");
let show_hidden = args.is_present("show-hidden");
let icons = args.is_present("icons");
- let sixel = args.is_present("sixel");
let mut config = ArgvConfig::new();
@@ -53,8 +52,12 @@ pub fn set_argv_config(args: clap::ArgMatches) -> HResult<()> {
config.icons = Some(true)
}
- if sixel == true {
- config.sixel = Some(true)
+ if let Some(mode) = args.value_of("graphics") {
+ if mode == "auto" {
+ config.graphics = Some(detect_g_mode());
+ } else {
+ config.graphics = Some(String::from(mode));
+ }
}
*ARGV_CONFIG.write()? = config;
@@ -71,7 +74,7 @@ fn infuse_argv_config(mut config: Config) -> Config {
argv_config.animation.map(|val| config.animation = val);
argv_config.show_hidden.map(|val| config.show_hidden = val);
argv_config.icons.map(|val| config.icons = val);
- argv_config.sixel.map(|val| config.sixel = val);
+ argv_config.graphics.map(|val| config.graphics = val);
config
}
@@ -88,7 +91,7 @@ pub struct Config {
pub media_mute: bool,
pub media_previewer: String,
pub ratios: Vec::<usize>,
- pub sixel: bool,
+ pub graphics: String,
}
@@ -111,7 +114,7 @@ impl Config {
media_mute: false,
media_previewer: "hunter-media".to_string(),
ratios: vec![20,30,49],
- sixel: false
+ graphics: detect_g_mode(),
}
}
@@ -126,16 +129,16 @@ impl Config {
let config = config_string.lines().fold(Config::new(), |mut config, line| {
match Config::prep_line(line) {
- Ok(("animation", "on")) => { config.animation = true; },
- Ok(("animation", "off")) => { config.animation = false; },
+ Ok(("animation", "on")) => config.animation = true,
+ Ok(("animation", "off")) => config.animation = false,
Ok(("animation_refresh_frequency", frequency)) => {
match frequency.parse::<usize>() {
Ok(parsed_freq) => config.animation_refresh_frequency = parsed_freq,
_ => HError::config_error::<Config>(line.to_string()).log()
}
}
- Ok(("show_hidden", "on")) => { config.show_hidden = true; },
- Ok(("show_hidden", "off")) => { config.show_hidden = false; },
+ Ok(("show_hidden", "on")) => config.show_hidden = true,
+ Ok(("show_hidden", "off")) => config.show_hidden = false,
Ok(("icons", "on")) => config.icons = true,
Ok(("icons", "off")) => config.icons = false,
Ok(("select_cmd", cmd)) => {
@@ -146,10 +149,10 @@ impl Config {
let cmd = cmd.to_string();
config.cd_cmd = cmd;
}
- Ok(("media_autoplay", "on")) => { config.media_autoplay = true; },
- Ok(("media_autoplay", "off")) => { config.media_autoplay = false; },
- Ok(("media_mute", "on")) => { config.media_mute = true; },
- Ok(("media_mute", "off")) => { config.media_mute = false; },
+ Ok(("media_autoplay", "on")) => config.media_autoplay = true,
+ Ok(("media_autoplay", "off")) => config.media_autoplay = false,
+ Ok(("media_mute", "on")) => config.media_mute = true,
+ Ok(("media_mute", "off")) => config.media_mute = false,
Ok(("media_previewer", cmd)) => {
let cmd = cmd.to_string();
config.media_previewer = cmd;
@@ -167,7 +170,13 @@ impl Config {
}
}
}
- Ok(("sixel", "on")) => { config.sixel = true; }
+ #[cfg(feature = "sixel")]
+ Ok(("graphics",
+ "sixel")) => config.graphics = "sixel".to_string(),
+ Ok(("graphics",
+ "kitty")) => config.graphics = "kitty".to_string(),
+ Ok(("graphics",
+ "auto")) => config.graphics = detect_g_mode(),
_ => { HError::config_error::<Config>(line.to_string()).log(); }
}
config
@@ -196,3 +205,13 @@ impl Config {
self.show_hidden
}
}
+
+fn detect_g_mode() -> String {
+ let term = std::env::var("TERM").unwrap_or(String::new());
+ match term.as_str() {
+ "xterm-kitty" => "kitty",
+ #[cfg(feature = "sixel")]
+ "xterm" => "sixel",
+ _ => "unicode"
+ }.to_string()
+}
diff --git a/src/coordinates.rs b/src/coordinates.rs
index 0bd2ff7..ac969ea 100644
--- a/src/coordinates.rs
+++ b/src/coordinates.rs
@@ -1,3 +1,5 @@
+use crate::fail::HResult;
+
#[derive(Debug, Clone, PartialEq)]
pub struct Size(pub (u16, u16));
#[derive(Debug, Clone, PartialEq)]
@@ -110,6 +112,19 @@ impl Coordinates {
((xsize-1) as usize, (ysize-1) as usize)
}
+ pub fn size_pixels(&self) -> HResult<(usize, usize)> {
+ let (xsize, ysize) = self.size_u();
+ let (cols, rows) = crate::term::size()?;
+ let (xpix, ypix) = crate::term::size_pixels()?;
+ // Cell dimensions
+ let (xpix, ypix) = (xpix/cols, ypix/rows);
+ // Frame dimensions
+ let (xpix, ypix) = (xpix * (xsize + 1),
+ ypix * (ysize + 1));
+
+ Ok((xpix as usize, ypix as usize))
+ }
+
pub fn top(&self) -> Position {
self.position().clone()
}
diff --git a/src/hunter-media.rs b/src/hunter-media.rs
index cc1de41..585f3d8 100644
--- a/src/hunter-media.rs
+++ b/src/hunter-media.rs
@@ -1,8 +1,7 @@
// Based on https://github.com/jD91mZM2/termplay
// MIT License
-use image::{FilterType, DynamicImage, GenericImageView};
-use sixel::encoder::Encoder;
+use image::{RgbaImage, DynamicImage, GenericImageView};
use base64;
use termion::color::{Bg, Fg, Rgb};
@@ -11,7 +10,7 @@ use termion::input::TermRead;
#[cfg(feature = "video")]
-use gstreamer::{self, prelude::*};
+use gstreamer::prelude::*;
#[cfg(feature = "video")]
use gstreamer_app;
@@ -36,50 +35,65 @@ fn main() -> MResult<()> {
.expect("provide ysize")
.parse()
.unwrap();
- let xpix = args.get(3)
+ let mut xpix = args.get(3)
.expect("provide xsize in pixels")
.parse::<usize>()
.unwrap();
- let ypix = args.get(4)
+ let mut ypix = args.get(4)
.expect("provide ysize in pixels")
.parse::<usize>()
.unwrap();
- let preview_type = args.get(5)
+ let cell_ratio = args.get(5)
+ .expect("Provide cell ratio")
+ .parse::<f32>()
+ .unwrap();
+ let preview_type = args.get(6)
.expect("Provide preview type")
.parse::<String>()
.unwrap();
- // #[cfg(feature = "video")]
- let autoplay = args.get(6)
+ let autoplay = args.get(7)
.expect("Autoplay?")
.parse::<bool>()
.unwrap();
- // #[cfg(feature = "video")]
- let mute = args.get(7)
+ let mute = args.get(8)
.expect("Muted?")
.parse::<bool>()
.unwrap();
- let sixel = args.get(8)
- .expect("Use SIXEL?")
- .parse::<bool>()
+ let target = args.get(9)
+ .expect("Render target?")
+ .parse::<String>()
.unwrap();
- let path = args.get(9).expect("Provide path");
-
- let target = if sixel {
- if std::env::var("TERM") == Ok(String::from("xterm-kitty")) {
- RenderTarget::Kitty
- } else {
- RenderTarget::Sixel
+ let path = args.get(10).expect("Provide path");
+
+ let target = match target.as_str() {
+ #[cfg(feature = "sixel")]
+ "sixel" => RenderTarget::Sixel,
+ "kitty" => RenderTarget::Kitty,
+ "auto" => {
+ let term = std::env::var("TERM").unwrap_or(String::from(""));
+ match term.as_str() {
+ "kitty" => RenderTarget::Kitty,
+ #[cfg(feature = "sixel")]
+ "xterm" => RenderTarget::Sixel,
+ _ => RenderTarget::Unicode,
+ }
}
- } else {
- RenderTarget::Unicode
+ _ => RenderTarget::Unicode
};
+ if target == RenderTarget::Unicode {
+ xpix = xsize;
+ ypix = ysize * 2;
+ }
+
+
let renderer = Renderer::new(target,
xsize,
ysize,
xpix,
- ypix);
+ ypix,
+ cell_ratio);
let result =
match preview_type.as_ref() {
@@ -115,70 +129,95 @@ fn main() -> MResult<()> {
fn image_preview(path: &str,
renderer: Renderer) -> MResult<()> {
let img = image::open(&path)?;
+ let max_size = renderer.max_size_pix(&img);
+ let img = img.resize_exact(max_size.0 as u32,
+ max_size.1 as u32,
+ image::FilterType::Gaussian)
+ .to_rgba();
renderer.send_image(&img)?;
Ok(())
}
+trait ImgSize {
+ fn size(&self) -> MResult<(usize, usize)>;
+}
+
+#[cfg(feature = "video")]