summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ar/.config/mpv/input.conf8
-rwxr-xr-xar/.local/bin/webcam33
2 files changed, 37 insertions, 4 deletions
diff --git a/ar/.config/mpv/input.conf b/ar/.config/mpv/input.conf
index f580f38..13725fd 100644
--- a/ar/.config/mpv/input.conf
+++ b/ar/.config/mpv/input.conf
@@ -19,13 +19,15 @@ ctrl+a no-osd seek -180 exact; script-message-to misc show-position
shift+a no-osd seek -30 exact; script-message-to misc show-position # Seek exactly 30 second backward
v script-binding showplaylist # Playlist in current path
shift+v script-binding navigator # Playlist in all path
-alt+v vf toggle vflip # Flip vertically
+alt+v vf toggle vflip # Flip vertically
c no-osd seek 15 exact; script-message-to misc show-position # Seek exactly 5 seconds forward
-ctrl+c add video-zoom 0.1 # Zoom in
+ctrl+c no-osd seek -300 exact; script-message-to misc show-position # Seek exactly 180 second backward
shift+c no-osd seek 60 exact; script-message-to misc show-position # Seek exactly 5 seconds forward
+alt+c add video-zoom 0.1 # Zoom in
z no-osd seek -15 exact; script-message-to misc show-position # Seek exactly 5 seconds backward
-ctrl+z add video-zoom -0.1 # Zoom out
+ctrl+z no-osd seek 300 exact; script-message-to misc show-position # Seek exactly 180 second backward
shift+z no-osd seek -60 exact; script-message-to misc show-position # Seek exactly 5 seconds backward
+alt+z add video-zoom -0.1 # Zoom out
q no-osd sub-seek -1 # Seek to the previous subtitle
ctrl+q add chapter -1 # Seek -chapters
shift+q cycle sub down # Switch subtitle track backwards
diff --git a/ar/.local/bin/webcam b/ar/.local/bin/webcam
index 8fcb724..7800b46 100755
--- a/ar/.local/bin/webcam
+++ b/ar/.local/bin/webcam
@@ -7,10 +7,41 @@ case "$1" in
*) flip="" ;;
esac
+# Extract full camera names and their first /dev/video* device
+cameras=$(
+ v4l2-ctl --list-devices | awk '
+ BEGIN { RS=""; FS="\n" }
+ {
+ name = $1;
+ sub(/ \(.*$/, "", name);
+ gsub(/^[ \t]+|[ \t]+$/, "", name);
+ for (i=2; i<=NF; i++) {
+ if ($i ~ /\/dev\/video/) {
+ gsub(/^[ \t]+/, "", $i);
+ print name "|" $i;
+ break;
+ }
+ }
+ }'
+)
+
+# Extract only camera names for dmenu
+names=$(echo "$cameras" | cut -d '|' -f1)
+
+# Select camera with dmenu
+choice=$(echo "$names" | dmenu -i -p 'Choose a camera:')
+
+# Find corresponding /dev/video* device
+camera=$(echo "$cameras" | awk -F '|' -v sel="$choice" '$1 == sel {print $2}')
+
+# If no selection, exit
+[ -z "$camera" ] && exit 1
+
mpv --untimed \
--no-cache \
--no-osc \
--no-input-default-bindings \
--profile=low-latency \
--input-conf=/dev/null \
- --title=webcam "$flip" "$(find /dev -name 'video[02468]' 2>/dev/null | tail -n 1)"
+ --title=webcam \
+ $flip "$camera"