dotfiles/bin/screen-share-sway

51 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/bin/bash
# Screen Sharing with OBS Studio on Fedora and Sway
# ref: https://github.com/hw0lff/screen-share-sway
grep -q "alias obs" ~/.zshrc || echo 'alias obs="QT_QPA_PLATFORM=xcb obs"' >> ~/.zshrc
V4L2_VERSION="0.12.5"
U="$HOME/utils"
# grab and build latest v4l2 module
"$U"/dotfiles/bin/v4l2pls "$V4L2_VERSION"
# ref: https://github.com/obsproject/obs-studio/wiki/Install-Instructions#red-hatfedora-based-build-directions
if [ ! -d "$U/obs-studio" ]; then
cd "$U" || exit
git clone --recursive https://github.com/obsproject/obs-studio.git
fi
cd "$U"/obs-studio || exit
git pull
git submodule update --recursive
mkdir -pv build && cd build
cmake -DUNIX_STRUCTURE=1 -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
sudo make install
if [ ! -d "$U/obs-v4l2sink" ]; then
cd "$U" || exit
git clone https://github.com/CatxFish/obs-v4l2sink.git
fi
cd "$U"/obs-v4l2sink || exit
git pull
mkdir -pv build && cd build
cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=~/.local ..
make -j4
make install
if [ ! -d "$U/wlrobs" ]; then
cd "$U" || exit
hg clone https://hg.sr.ht/~scoopta/wlrobs
fi
cd "$U"/wlrobs || exit
hg pull
meson --reconfigure build
ninja -C build
mkdir -pv "$HOME"/.config/obs-studio/plugins/wlrobs/bin/64bit
cp -v build/libwlrobs.so "$HOME"/.config/obs-studio/plugins/wlrobs/bin/64bit