Add screencast, webmconvert to alias.sh
This commit is contained in:
@@ -40,6 +40,10 @@ super + {F2,F3}
|
||||
{_,shift,super} + @Print
|
||||
scrot {_,-s,-u} -e "mv \$f $CAPTURE"
|
||||
|
||||
# Screen record
|
||||
ctrl + @Print
|
||||
$HOME/.scripts/alias.sh screencast "$CAPTURE/$(date '+%Y-%m-%d-%H%M%S_1500x1000_screencast.mkv')"
|
||||
|
||||
# Volume
|
||||
XF86Audio{LowerVolume,RaiseVolume,Mute}
|
||||
volctl.sh {dec 5,inc 5,toggle}
|
||||
|
||||
+7
-8
@@ -83,6 +83,7 @@ alias ls="ls --color --group-directories-first"
|
||||
alias grep="grep --color"
|
||||
alias df="df -h"
|
||||
alias md="mkdir -p"
|
||||
alias mkcd="$HOME/.scripts/alias.sh mkcd"
|
||||
alias rm="rm -i"
|
||||
alias se="sudoedit"
|
||||
alias semacs="sudoedit"
|
||||
@@ -96,16 +97,10 @@ alias ss="sudo systemctl"
|
||||
|
||||
# Config
|
||||
alias c="$HOME/.scripts/config.sh"
|
||||
alias i3c="$EDITOR $XDG_CONFIG_HOME/i3/config"
|
||||
alias vrc="$EDITOR $XDG_CONFIG_HOME/vim/vimrc"
|
||||
alias xrc="$EDITOR $XDG_CONFIG_HOME/xorg/xinitrc"
|
||||
alias xr="$EDITOR $XDG_CONFIG_HOME/xorg/Xresources"
|
||||
alias zp="$EDITOR $ZDOTDIR/.zprofile"
|
||||
alias zrc="$EDITOR $ZDOTDIR/.zshrc && source $ZDOTDIR/.zshrc"
|
||||
|
||||
alias li3="i3-msg restart"
|
||||
alias lxr="xrdb $XDG_CONFIG_HOME/xorg/Xresources"
|
||||
alias lzrc="source $ZDOTDIR/.zshrc"
|
||||
alias lxrdb="xrdb $XDG_CONFIG_HOME/xorg/Xresources"
|
||||
alias lzshrc="source $ZDOTDIR/.zshrc"
|
||||
|
||||
# Pacman
|
||||
alias install="sudo pacman -S --needed"
|
||||
@@ -141,12 +136,16 @@ alias vc="$HOME/.scripts/volctl.sh"
|
||||
alias vp="$HOME/.scripts/vimplugin.sh"
|
||||
alias mpvshuffle="$HOME/.scripts/mpv.sh shuffle"
|
||||
|
||||
|
||||
|
||||
# Other
|
||||
alias len="xclip -o | wc -m"
|
||||
alias length="rofi -dmenu -i -p 'String length' -lines 0 | tr -d '\n' | wc -m"
|
||||
alias p="$HOME/.scripts/alias.sh pastebin"
|
||||
alias screencast="$HOME/.scripts/alias.sh screencast"
|
||||
alias stream="$HOME/.scripts/alias.sh stream"
|
||||
alias weather="curl -s 'https://wttr.in/dordrecht?q&n&p' | head -n -3"
|
||||
alias webmconvert="$HOME/.scripts/alias.sh webmconvert"
|
||||
alias workbench="GDK_SCALE=1 GDK_DPI_SCALE=1 mysql-workbench > /dev/null 2>&1 & disown"
|
||||
alias ytdl="youtube-dl -f bestvideo+bestaudio"
|
||||
alias ytaudio="youtube-dl -f bestaudio/best -x --audio-format mp3"
|
||||
|
||||
+59
-13
@@ -1,5 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
depend() {
|
||||
pactree -u -d 1 "$1" | tail -n +2 | sort
|
||||
}
|
||||
|
||||
emacs() {
|
||||
# Create new frame if (there isnt one || no file specified)
|
||||
if [ -z "$(pgrep emacsclient)" ] || [ "$1" = "" ]; then
|
||||
@@ -9,8 +13,14 @@ emacs() {
|
||||
fi
|
||||
}
|
||||
|
||||
depend() {
|
||||
pactree -u -d 1 "$1" | tail -n +2 | sort
|
||||
# $1 = find, $2 = list, $3 = list separator
|
||||
in_list() {
|
||||
[ -z "$1" ] || [ -z "$2" ] && return 1
|
||||
if ! echo "$2" | awk -v m="^$1$" -v RS="${3:-' '}" '$0 ~ m { exit 1 }'; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
java_doc() {
|
||||
@@ -24,6 +34,14 @@ java_run () {
|
||||
java -cp './out' "$1"
|
||||
}
|
||||
|
||||
mkcd(){
|
||||
mkdir -p "$1" && cd "$1" || exit
|
||||
}
|
||||
|
||||
pastebin() {
|
||||
echo "$1" | curl -F 'f:1=<-' ix.io
|
||||
}
|
||||
|
||||
raspbian() {
|
||||
sudo systemctl start avahi-daemon.service
|
||||
if ! ip a show usb0 | grep -q 'inet6'; then
|
||||
@@ -33,24 +51,52 @@ raspbian() {
|
||||
sudo systemctl stop avahi-daemon.service
|
||||
}
|
||||
|
||||
# $1 = find, $2 = list, $3 = list separator
|
||||
in_list() {
|
||||
[ -z "$1" ] || [ -z "$2" ] && return 1
|
||||
if ! echo "$2" | awk -v m="^$1$" -v RS="${3:-' '}" '$0 ~ m { exit 1 }'; then
|
||||
return 0
|
||||
screencast() {
|
||||
IS_RUNNING="$(pgrep ffmpeg)"
|
||||
if [ "$IS_RUNNING" != "" ]; then
|
||||
notify-send "Stopped recording.."
|
||||
# Kill with SIGTERM, allowing finishing touches
|
||||
pkill -15 ffmpeg
|
||||
sleep 3
|
||||
# Kill with SIGKILL, just in case it is still running
|
||||
pkill -9 ffmpeg
|
||||
else
|
||||
return 1
|
||||
NAME=${1:-"output"}
|
||||
[ -n "$2" ] && AUDIO_CODEC="-c:a aac"
|
||||
[ -n "$2" ] && AUDIO_SOURCE="-f pulse -ac 2 -i $2" # 1 = system, 2 = mic
|
||||
|
||||
notify-send "Started recording.."
|
||||
ffmpeg -y \
|
||||
-threads 4 \
|
||||
-f x11grab \
|
||||
-framerate 24 \
|
||||
-s 3000x2000 \
|
||||
-i "$DISPLAY.0" \
|
||||
$AUDIO_SOURCE \
|
||||
-r 24 \
|
||||
-vf scale=1500:1000 \
|
||||
$AUDIO_CODEC \
|
||||
-c:v libx264 -crf 0 -preset ultrafast \
|
||||
"$NAME.mkv" &
|
||||
fi
|
||||
}
|
||||
|
||||
pastebin() {
|
||||
echo "$1" | curl -F 'f:1=<-' ix.io
|
||||
}
|
||||
|
||||
stream() {
|
||||
[ -z "$2" ] && QUALITY="720p" || QUALITY="$2"
|
||||
QUALITY=${2:-"720p"}
|
||||
|
||||
streamlink --player mpv "https://twitch.tv/$1" "$QUALITY" > /dev/null 2>&1 &
|
||||
}
|
||||
|
||||
webmconvert() {
|
||||
[ "$2" = "1" ] && AUDIO="-c:a libvorbis" || AUDIO="-an"
|
||||
|
||||
# https://trac.ffmpeg.org/wiki/Encode/H.264
|
||||
# https://trac.ffmpeg.org/wiki/Encode/VP8
|
||||
# -qmin 0 (0-63, default 4, lower = better quality)
|
||||
# -qmax 40 (qmin-63, default 63)
|
||||
# -crf 16 (0-51, default 23, 0 = lossless)
|
||||
# -b:v 4M
|
||||
ffmpeg -threads 4 -i "$1" -c:v libvpx -qmin 0 -qmax 40 -crf 16 -b:v 4M "$AUDIO" "${1%.*}_convert.webm"
|
||||
}
|
||||
|
||||
"$@"
|
||||
|
||||
Reference in New Issue
Block a user