mpv pause system changed (socat required)

This commit is contained in:
Luke Smith 2019-01-04 23:08:12 -05:00
parent 13a2e5fe3a
commit e3a4c5a5d6
5 changed files with 24 additions and 29 deletions

19
.bashrc
View file

@ -1,40 +1,33 @@
#!/bin/bash #!/bin/bash
# _ _
# | |__ __ _ ___| |__ _ __ ___
# | '_ \ / _` / __| '_ \| '__/ __|
# | |_) | (_| \__ \ | | | | | (__
# |_.__/ \__,_|___/_| |_|_| \___|
stty -ixon # Disable ctrl-s and ctrl-q. stty -ixon # Disable ctrl-s and ctrl-q.
shopt -s autocd #Allows you to cd into directory merely by typing the directory name. shopt -s autocd #Allows you to cd into directory merely by typing the directory name.
HISTSIZE= HISTFILESIZE= # Infinite history. HISTSIZE= HISTFILESIZE= # Infinite history.
export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]" export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
[ -f "$HOME/.shortcuts" ] && source "$HOME/.shortcuts" # Load shortcut aliases [ -f "$HOME/.shortcuts" ] && source "$HOME/.shortcuts" # Load shortcut aliases
export GPG_TTY=$(tty)
# System Maintainence # System Maintainence
alias mw="~/.config/mutt/mutt-wizard.sh" alias mw="~/.config/mutt/mutt-wizard.sh"
alias muttwizard="~/.config/mutt/mutt-wizard.sh"
alias sdn="sudo shutdown now" alias sdn="sudo shutdown now"
alias psref="gpg-connect-agent RELOADAGENT /bye" # Refresh gpg alias psref="gpg-connect-agent RELOADAGENT /bye" # Refresh gpg
alias gua="git remote | xargs -L1 git push --all"
# Some aliases # Some aliases
alias e="$EDITOR" alias e="$EDITOR"
alias p="sudo pacman" alias p="sudo pacman"
alias SS="sudo systemctl" alias SS="sudo systemctl"
alias v="vim" alias v="vim"
alias sv="sudo vim" alias f="vifm"
alias r="ranger" alias r="ranger"
alias sr="sudo ranger" alias sr="sudo ranger"
alias ka="killall" alias ka="killall"
alias g="git" alias g="git"
alias trem="transmission-remote" alias trem="transmission-remote"
alias mkd="mkdir -pv" alias mkd="mkdir -pv"
alias ref="shortcuts && source ~/.bashrc" # Refresh shortcuts manually and reload bashrc alias ref="shortcuts >/dev/null ; source ~/.bashrc" # Refresh shortcuts manually and reload bashrc
alias bw="wal -i ~/.config/wall.png" # Rerun pywal alias mpv="mpv --input-ipc-server=/tmp/mpvsoc$(date +%s)"
alias x="sxiv -ft *"
alias lp="pacman -Qett --color=always | less"
# Adding color # Adding color
alias ls='ls -hN --color=auto --group-directories-first' alias ls='ls -hN --color=auto --group-directories-first'

View file

@ -117,9 +117,11 @@ ext php = php -- "$1"
#------------------------------------------- #-------------------------------------------
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@" mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
mime ^video|audio, has smplayer, X, flag f = smplayer "$@" mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
mime ^video, has mpv, X, flag f = mpv -- "$@" mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@" mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-video -- "$@"
mime ^video, has mpv, X, flag f = mpv --loop -- "$@" mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --fs -- "$@"
mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --loop -- "$@"
mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --title="obs" --autofit=1050x700 -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
mime ^video, has mplayer, X, flag f = mplayer -- "$@" mime ^video, has mplayer, X, flag f = mplayer -- "$@"
@ -132,16 +134,16 @@ mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@"
#------------------------------------------- #-------------------------------------------
mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@" mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@" mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@" mime ^audio|ogg$, terminal, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-audio-display -- "$@"
mime ^audio|ogg$ = tag "$@" mime ^audio|ogg$ = tag "$@"
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" mime ^audio|ogg$, terminal, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
ext midi?, terminal, has wildmidi = wildmidi -- "$@" ext midi?, terminal, has wildmidi = wildmidi -- "$@"
#-------------------------------------------- #--------------------------------------------
# Video without X: # Video without X:
#------------------------------------------- #-------------------------------------------
mime ^video, terminal, !X, has mpv = mpv -- "$@" mime ^video, terminal, !X, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@" mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
mime ^video, terminal, !X, has mplayer = mplayer -- "$@" mime ^video, terminal, !X, has mplayer = mplayer -- "$@"

View file

@ -5,11 +5,11 @@
case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in
"copy url") echo "$1" | xclip -selection clipboard ;; "copy url") echo "$1" | xclip -selection clipboard ;;
mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;;
"mpv (loop)") setsid mpv -quiet --loop "$1" >/dev/null 2>&1 & ;; "mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;;
"queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;;
"queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;;
browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;; browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;;
feh) setsid feh "$1" >/dev/null 2>&1 & ;; feh) setsid feh "$1" >/dev/null 2>&1 & ;;
w3m) w3m "$1" >/dev/null 2>&1 ;; w3m) w3m "$1" >/dev/null 2>&1 ;;
"mpv (float)") setsid mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;; "mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
esac esac

View file

@ -13,11 +13,11 @@ scihub="http://sci-hub.tw/"
[ -z "$1" ] && { "$BROWSER"; exit; } [ -z "$1" ] && { "$BROWSER"; exit; }
case "$1" in case "$1" in
*mkv|*webm|*mp4|*gif|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*) *mkv|*webm|*mp4|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*)
setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;;
*png|*jpg|*jpe|*jpeg) *png|*jpg|*jpe|*jpeg|*gif)
setsid feh "$1" >/dev/null 2>&1 & ;; setsid sxiv -a "$1" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source) *mp3|*flac|*opus|*mp3?source*)
setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;; setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
*springer.com*) *springer.com*)
setsid curl -sO "$(curl -s "$scihub$*" | grep -Po "(?<=location.href=').+.pdf")" >/dev/null 2>&1 & ;; setsid curl -sO "$(curl -s "$scihub$*" | grep -Po "(?<=location.href=').+.pdf")" >/dev/null 2>&1 & ;;

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
# Sends a , key to all mpv instances, pausing them at the last frame. for i in $(ls /tmp/mpvsoc*); do
echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
xdotool search --class mpv | xargs -I % xdotool key --window % comma done