aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/camtoggle
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2020-12-14 00:32:06 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2020-12-14 00:32:06 +0300
commite87df82bc71e38e77a3bd768d802ecd57a0e9ffb (patch)
tree5154d68b65801168d3db3faaef41f9c51a263fef /dotfiles/.local/bin/camtoggle
parent0323869b0b7faa4214544cf339e096a5c0d16cb6 (diff)
downloadswayrice-e87df82bc71e38e77a3bd768d802ecd57a0e9ffb.tar.gz
swayrice-e87df82bc71e38e77a3bd768d802ecd57a0e9ffb.zip
camtoggle: small changes on how to detect the right camera
Diffstat (limited to 'dotfiles/.local/bin/camtoggle')
-rwxr-xr-xdotfiles/.local/bin/camtoggle11
1 files changed, 7 insertions, 4 deletions
diff --git a/dotfiles/.local/bin/camtoggle b/dotfiles/.local/bin/camtoggle
index a12fcb8..08c61cd 100755
--- a/dotfiles/.local/bin/camtoggle
+++ b/dotfiles/.local/bin/camtoggle
@@ -1,12 +1,15 @@
#!/bin/sh
# 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
+# If the hostname matches that of my laptop, use the second camera
camera="/dev/video0"
-[ -e /dev/video2 ] && camera="/dev/video2"
-[ -n "$1" ] && camera="$1"
+if [ -n "$1" ]; then
+ camera="$1"
+elif [ $HOSTNAME = "thinkslav" ]; then
+ camera="/dev/video2"
+fi
-pkill -f /dev/video || mpv \
+pkill -f "$camera" || mpv \
--gpu-context=wayland \
--profile=low-latency \
--no-osc \