mpv config: use mpvSockets script to remove mpv wrappers/aliases (#544)
* add scripts to mpv's cfg \w mpvSockets as 1st dependency and\or script * remove all usage of --input-ipc-server in all cmds * remove mpv alias that adds --input-ipc-server * fix pauseallmpv: correct paths to unix socket files * fix dependency-scripts loading so it works also when opening files off main disk
This commit is contained in:
parent
11eac2294f
commit
a08904d88a
10 changed files with 24 additions and 20 deletions
|
@ -36,9 +36,6 @@ alias \
|
||||||
xr="sudo xbps-remove -R" \
|
xr="sudo xbps-remove -R" \
|
||||||
xq="xbps-query"
|
xq="xbps-query"
|
||||||
|
|
||||||
# This alias is important. It enables the `pauseallmpv` command.
|
|
||||||
alias mpv="mpv --input-ipc-server=/tmp/mpvsoc$(date +%s)"
|
|
||||||
|
|
||||||
# Some other stuff
|
# Some other stuff
|
||||||
alias \
|
alias \
|
||||||
magit="nvim -c MagitOnly" \
|
magit="nvim -c MagitOnly" \
|
||||||
|
|
|
@ -16,8 +16,8 @@ cmd open ${{
|
||||||
text/*) $EDITOR $fx;;
|
text/*) $EDITOR $fx;;
|
||||||
image/x-xcf|image/svg+xml) setsid gimp $f >/dev/null 2>&1 & ;;
|
image/x-xcf|image/svg+xml) setsid gimp $f >/dev/null 2>&1 & ;;
|
||||||
image/*) rotdir $f | setsid sxiv -aio 2>/dev/null | lf-select & ;;
|
image/*) rotdir $f | setsid sxiv -aio 2>/dev/null | lf-select & ;;
|
||||||
audio/*) mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) $f ;;
|
audio/*) mpv $f ;;
|
||||||
video/*) setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) $f -quiet >/dev/null 2>&1 & ;;
|
video/*) setsid mpv $f -quiet >/dev/null 2>&1 & ;;
|
||||||
application/pdf) setsid zathura $fx >/dev/null 2>&1 & ;;
|
application/pdf) setsid zathura $fx >/dev/null 2>&1 & ;;
|
||||||
*) for f in $fx; do setsid $OPENER $f >/dev/null 2>&1 & done;;
|
*) for f in $fx; do setsid $OPENER $f >/dev/null 2>&1 & done;;
|
||||||
esac
|
esac
|
||||||
|
|
3
.config/mpv/scripts/modules.lua
Normal file
3
.config/mpv/scripts/modules.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
local mpv_scripts_dir_path = os.getenv("HOME") .. "/.config/mpv/scripts/"
|
||||||
|
function load(relative_path) dofile(mpv_scripts_dir_path .. relative_path) end
|
||||||
|
load("mpvSockets/mpvSockets.lua")
|
1
.config/mpv/scripts/mpvSockets
Submodule
1
.config/mpv/scripts/mpvSockets
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 8415a08d99a46213c918613cfe1e088071018db9
|
|
@ -101,7 +101,7 @@ ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
|
||||||
ext nes, has fceux, X = fceux "$1"
|
ext nes, has fceux, X = fceux "$1"
|
||||||
ext exe = wine "$1"
|
ext exe = wine "$1"
|
||||||
name ^[mM]akefile$ = make
|
name ^[mM]akefile$ = make
|
||||||
ext asf, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
|
ext asf, has mpv, X, flag f = mpv -- "$@"
|
||||||
|
|
||||||
#--------------------------------------------
|
#--------------------------------------------
|
||||||
# Code
|
# Code
|
||||||
|
@ -118,11 +118,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 --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
|
mime ^video, has mpv, X, flag f = mpv -- "$@"
|
||||||
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 --no-video -- "$@"
|
||||||
mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --fs -- "$@"
|
mime ^video, has mpv, X, flag f = mpv --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 --loop -- "$@"
|
||||||
mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --title="obs" --autofit=1050x700 -- "$@"
|
mime ^video, has mpv, X, flag f = mpv --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 -- "$@"
|
||||||
|
@ -135,16 +135,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 --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-audio-display -- "$@"
|
mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@"
|
||||||
mime ^audio|ogg$ = tag "$@"
|
mime ^audio|ogg$ = tag "$@"
|
||||||
mime ^audio|ogg$, terminal, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
|
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@"
|
||||||
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 --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
|
mime ^video, terminal, !X, has mpv = mpv -- "$@"
|
||||||
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 -- "$@"
|
||||||
|
|
||||||
|
|
|
@ -54,11 +54,11 @@ fileviewer *.odt odt2txt %c -
|
||||||
filetype *.csv,*.xlsx sc-im %c
|
filetype *.csv,*.xlsx sc-im %c
|
||||||
fileviewer *.csv sed "s/,,,,/,,-,,/g;s/,,/ /g" %c | column -t | sed "s/ - / /g" | cut -c -%pw
|
fileviewer *.csv sed "s/,,,,/,,-,,/g;s/,,/ /g" %c | column -t | sed "s/ - / /g" | cut -c -%pw
|
||||||
|
|
||||||
filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mpv --no-audio-display --input-ipc-server=/tmp/mpvsoc$(date +%%s) %c
|
filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mpv --no-audio-display %c
|
||||||
filextype *.pdf,*.ps,*.eps,*.ps.gz,*.djvu,*.epub,*.cbz,*.cbr,*.cb7 zathura %f 2>/dev/null &,
|
filextype *.pdf,*.ps,*.eps,*.ps.gz,*.djvu,*.epub,*.cbz,*.cbr,*.cb7 zathura %f 2>/dev/null &,
|
||||||
fileviewer *.pdf pdftotext -l 1 -nopgbrk %c -
|
fileviewer *.pdf pdftotext -l 1 -nopgbrk %c -
|
||||||
fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.qt,*.divx,*.as[fx],*mp3,*.flac file
|
fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.qt,*.divx,*.as[fx],*mp3,*.flac file
|
||||||
filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,*.as[fx] mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) %f 2>/dev/null &,
|
filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,*.as[fx] mpv %f 2>/dev/null &,
|
||||||
|
|
||||||
fileview *.tar.gz atool -l --format=tar %f 2>/dev/null | awk '{$1=$2=$3=$4=$5=""; print $0}'
|
fileview *.tar.gz atool -l --format=tar %f 2>/dev/null | awk '{$1=$2=$3=$4=$5=""; print $0}'
|
||||||
fileview *.zip,*.cbz atool -l --format=zip %f 2>/dev/null | tail +4 | awk '{$1=$2=$3=""; print $0}'
|
fileview *.zip,*.cbz atool -l --format=zip %f 2>/dev/null | tail +4 | awk '{$1=$2=$3=""; print $0}'
|
||||||
|
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule ".config/mpv/scripts/mpvSockets"]
|
||||||
|
path = .config/mpv/scripts/mpvSockets
|
||||||
|
url = git@github.com:wis/mpvSockets.git
|
|
@ -6,11 +6,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 --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;;
|
"mpv (loop)") setsid mpv -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 --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
|
"mpv (float)") setsid mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*)
|
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*)
|
||||||
setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;;
|
setsid mpv -quiet "$1" >/dev/null 2>&1 & ;;
|
||||||
*png|*jpg|*jpe|*jpeg|*gif)
|
*png|*jpg|*jpe|*jpeg|*gif)
|
||||||
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
|
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
|
||||||
*mp3|*flac|*opus|*mp3?source*)
|
*mp3|*flac|*opus|*mp3?source*)
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
# every single one of them with one command! This is bound to super + shift + p
|
# every single one of them with one command! This is bound to super + shift + p
|
||||||
# (with other things) by default and is used in some other places.
|
# (with other things) by default and is used in some other places.
|
||||||
|
|
||||||
for i in $(ls /tmp/mpvsoc*); do
|
for i in $(ls /tmp/mpvSockets/*); do
|
||||||
echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
|
echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue