Commit: 3874390bb8661dd41dec9bfec503401308526f48
Parent: e239fef53335311db93a428b76b5299c974a5492
Author: Randy Palamar
Date: Thu, 17 Aug 2023 20:49:10 -0600
mpv: detect-image.lua: toggle {image} input section
Diffstat:
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/.config/mpv/input.conf b/.config/mpv/input.conf
@@ -24,16 +24,15 @@ U cycle-values sub-color "#DCDCCC" "#F0E118"
F1 cycle stop-screensaver
F4 rescan-external-files keep-selection
-k {images} repeatable add video-zoom 0.1
-j {images} repeatable add video-zoom -0.1
-
-up {images} repeatable add video-pan-y +0.05
-down {images} repeatable add video-pan-y -0.05
-left {images} repeatable add video-pan-x +0.05
-right {images} repeatable add video-pan-x -0.05
-Shift+up {images} repeatable add video-pan-y +0.01
-Shift+down {images} repeatable add video-pan-y -0.01
-Shift+left {images} repeatable add video-pan-x +0.01
-Shift+right {images} repeatable add video-pan-x -0.01
-
-enter {images} set video-pan-x 0; set video-pan-y 0; set video-zoom 0
+k {image} repeatable add video-zoom 0.1
+j {image} repeatable add video-zoom -0.1
+enter {image} set video-pan-x 0; set video-pan-y 0; set video-zoom 0
+
+up {image} repeatable add video-pan-y +0.05
+down {image} repeatable add video-pan-y -0.05
+left {image} repeatable add video-pan-x +0.05
+right {image} repeatable add video-pan-x -0.05
+Shift+up {image} repeatable add video-pan-y +0.01
+Shift+down {image} repeatable add video-pan-y -0.01
+Shift+left {image} repeatable add video-pan-x +0.01
+Shift+right {image} repeatable add video-pan-x -0.01
diff --git a/.config/mpv/scripts/detect-image.lua b/.config/mpv/scripts/detect-image.lua
@@ -5,6 +5,11 @@ mp.register_event("file-loaded", function()
for _, t in pairs(tl) do
a = a or t.type == "audio"
end
- mp.set_property_native("user-data/is-image",
- (fc == 0 or fc == 1) and a == 0)
+ local isimg = (fc == 0 or fc == 1) and a == 0
+ mp.set_property_native("user-data/is-image", isimg)
+ if isimg then
+ mp.commandv("enable-section", "image")
+ else
+ mp.commandv("disable-section", "image")
+ end
end)