aboutsummaryrefslogtreecommitdiff
path: root/dotfiles
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2020-07-14 04:19:58 +0300
committerYaroslav <contact@yaroslavps.com>2020-07-14 04:19:58 +0300
commitc54028716921f75b9c4a5f667504629616df1288 (patch)
tree3cc59fb698eb492bb6738c8797b6e1cd7187c02a /dotfiles
parent1fcc587038ee31d7517eba59a682d636bf133dc6 (diff)
downloadswayrice-c54028716921f75b9c4a5f667504629616df1288.tar.gz
swayrice-c54028716921f75b9c4a5f667504629616df1288.zip
camtoggle: use second webcam if present
Diffstat (limited to 'dotfiles')
-rwxr-xr-xdotfiles/.local/bin/camtoggle14
1 files changed, 13 insertions, 1 deletions
diff --git a/dotfiles/.local/bin/camtoggle b/dotfiles/.local/bin/camtoggle
index ba8b0d3..8f3de0e 100755
--- a/dotfiles/.local/bin/camtoggle
+++ b/dotfiles/.local/bin/camtoggle
@@ -1,3 +1,15 @@
#!/bin/sh
-pkill -f /dev/video || mpv --gpu-context=wayland --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=30% --title="mpvfloat" /dev/video2
+# I have two cameras on my laptop and the first one is an IR camera (video0)
+# If a second camera is present, use the second one
+camera="/dev/video0"
+[ -f /dev/video2 ] && camera="/dev/video2"
+
+pkill -f /dev/video || mpv \
+ --gpu-context=wayland \
+ --no-osc \
+ --no-input-default-bindings \
+ --input-conf=/dev/null \
+ --geometry=-0-0 \
+ --autofit=25% \
+ --title="mpvfloat" "$camera"