add swayscreenshare

This commit is contained in:
lelgenio 2020-04-22 14:34:34 -03:00
parent d276232db3
commit 88bbfc6778
6 changed files with 72 additions and 18 deletions

View File

@ -1,17 +1,17 @@
{
// Remove clutter
// "window.titleBarStyle": "custom",
"window.menuBarVisibility": "toggle",
"workbench.activityBar.visible": false,
"workbench.editor.showTabs": false,
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": true,
"breadcrumbs.enabled": false,
"workbench.editor.closeEmptyGroups": true,
"workbench.editor.tabCloseButton": "off",
"explorer.openEditors.visible": 0,
"debug.openDebug": "openOnDebugBreak",
"debug.internalConsoleOptions": "none",
"window.titleBarStyle": "custom",
// "window.menuBarVisibility": "toggle",
// "workbench.activityBar.visible": false,
// "workbench.editor.showTabs": false,
// "workbench.editor.enablePreview": false,
// "workbench.editor.enablePreviewFromQuickOpen": true,
// "breadcrumbs.enabled": false,
// "workbench.editor.closeEmptyGroups": true,
// "workbench.editor.tabCloseButton": "off",
// "explorer.openEditors.visible": 0,
// "debug.openDebug": "openOnDebugBreak",
// "debug.internalConsoleOptions": "none",
// Don't ask
"git.autofetch": true,
"git.confirmSync": false,

View File

@ -39,7 +39,7 @@ abbr ec edit-config
function mutt --wraps=neomutt --description 'alias mutt=neomutt'
neomutt $argv;
pkill -SIGRTMIN+4 waybar
pkill -RTMIN+4 waybar
end
abbr neomutt mutt

View File

@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -x
if ! lsmod | grep v4l2loopback > /dev/null; then
echo "Adding v42loopback module to kernel"
sudo modprobe v4l2loopback
fi
geometry(){
windowGeometries=$(
# `height - 1` is there because of: https://github.com/ammen99/wf-recorder/pull/56 (I could remove it if it's merged, maybe)
swaymsg -t get_workspaces -r | jq -r '.[] | select(.focused) | .rect | "\(.x),\(.y) \(.width)x\(.height - 1)"'; \
swaymsg -t get_outputs -r | jq -r '.[] | select(.active) | .rect | "\(.x),\(.y) \(.width)x\(.height)"'
)
geometry=$(slurp -b "#45858820" -c "#45858880" -w 3 -d <<< "$windowGeometries") || exit $?
echo $geometry
}
{
if [ "$1" == "stop" ]; then
if pgrep ffplay > /dev/null; then
pkill ffplay > /dev/null
fi
if pgrep wf-recorder > /dev/null; then
pkill wf-recorder > /dev/null
fi
notify-send -t 2000 "Wayland recording has been stopped"
elif [ "$1" == "is-recording" ]; then
if pgrep wf-recorder > /dev/null && pgrep ffplay > /dev/null; then
notify-send -t 2000 "Wayland recording is up"
else
notify-send -t 2000 "No Wayland recording"
fi
else
if ! pgrep wf-recorder > /dev/null; then
geometry=$(geometry) || exit $?
wf-recorder --muxer=v4l2 --codec=rawvideo --file=/dev/video2 --geometry="$geometry" &
fi
if ! pgrep ffplay; then
unset SDL_VIDEODRIVER
ffplay /dev/video2 &
sleep 0.5
# a hack so FPS is not dropping
swaymsg [class=ffplay] move position 1915 1050
swaymsg focus tiling
fi
notify-send -t 2000 "Wayland recording has been started"
fi
} > ~/.wayland-share-screen.log 2>&1

6
scripts/.local/bin/terminal Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
command -v kitty > /dev/null &&
exec kitty $@
command -v alacritty > /dev/null &&
exec alacritty -e $@

View File

@ -16,7 +16,7 @@
set $up k
set $right l
set $term alacritty
set $term terminal
# set $menu wofi --show drun --allow-images --insensitive --term $term -p'Iniciar: '
set $menu bmenu run $term
font Fira Code 14px

View File

@ -107,7 +107,7 @@
"format": "<b>{}</b>",
"exec": "jq -r '.temp +\"°C \"+ .weather' .forecast.json",
"interval": 30,
"on-click": "alacritty --class weather -e sh -c 'forecast full;read -n1 -p\"Press Any key to quit \"'",
"on-click": "terminal --class weather sh -c 'forecast full;read -n1 -p\"Press Any key to quit \"'",
"on-click-right": "xdg-open https://openweathermap.org"
},
"custom/mail": {
@ -115,7 +115,7 @@
"format":"{} <b></b>",
"exec-if":"sleep 30s",
"exec": "checkmail",
"on-click": "alacritty -e neomutt; pkill -SIGRTMIN+4 waybar",
"on-click": "terminal neomutt; pkill -SIGRTMIN+4 waybar",
"signal": 4,
"interval": 30
},
@ -125,7 +125,7 @@
"interval": 60,
"exec-if":"sleep 60s",
"exec": "yay -Qqu | wc -l | sed 's/^0$//'",
"on-click": "alacritty -e sh -c 'ping -qc1 archlinux.org >/dev/null && yay -Syu || yay -Su; pkill -SIGRTMIN+8 waybar; read'",
"on-click": "terminal sh -c 'ping -qc1 archlinux.org >/dev/null && yay -Syu || yay -Su; pkill -SIGRTMIN+8 waybar; read'",
"signal": 8
},
"custom/recording": {
@ -139,7 +139,7 @@
"format":"{}",
"exec":"pgrep -f spigot.jar>/dev/null && spigot command list | awk '/There are/ {if ($6) print $6}'",
"interval":30,
"on-click":"alacritty -e spigot console"
"on-click":"terminal spigot console"
},
"custom/delugeD":{
"format":"{}",