From 1739341e87cf7b1b80f76b78eb0a48912d47a705 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 1 Nov 2020 20:19:21 +0100 Subject: Renamed again --- .config/fish/alias.fish | 3 +- .config/vifm/vifmrc | 2 +- .local/bin/linkview | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ .local/bin/linkview.pl | 46 ---------------------------- .urlview | 2 +- 5 files changed, 83 insertions(+), 49 deletions(-) create mode 100755 .local/bin/linkview delete mode 100755 .local/bin/linkview.pl diff --git a/.config/fish/alias.fish b/.config/fish/alias.fish index 29a843a..4170bd4 100644 --- a/.config/fish/alias.fish +++ b/.config/fish/alias.fish @@ -6,6 +6,7 @@ alias mkf='gmake fclean' alias mkc='gmake clean' alias mk='gmake -j5' alias web='w3m https://duckduckgo.com/' +alias mpv='mpv --audio-channels=stereo' alias cp='cp -iv' alias mv='mv -iv' alias rm='rm -v' @@ -37,7 +38,7 @@ alias pa="cd $XDG_DATA_HOME/packs && ls" alias co="cd $XDG_CONFIG_HOME/ && ls" alias bi="cd $HOME/.local/bin && ls" function twi - mpv https://twitch.tv/$argv; + mpv --really-quiet https://twitch.tv/$argv; end alias nb='newsboat' alias mutt='neomutt' diff --git a/.config/vifm/vifmrc b/.config/vifm/vifmrc index 385900f..1db30d2 100644 --- a/.config/vifm/vifmrc +++ b/.config/vifm/vifmrc @@ -65,7 +65,7 @@ filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mpv - filextype *.pdf,*.ps,*.eps,*.ps.gz,*.djvu,*.epub zathura %f 2>/dev/null &, 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 -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 --audio-channels=stereo --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 --quiet --audio-channels=stereo --input-ipc-server=/tmp/mpvsoc$(date +%%s) %f 2>/dev/null &, fileview *.zip,*.rar,*.tar.gz atool -l %f filetype *.zip,*.rar,*.tar.gz ext %f diff --git a/.local/bin/linkview b/.local/bin/linkview new file mode 100755 index 0000000..2a16c03 --- /dev/null +++ b/.local/bin/linkview @@ -0,0 +1,79 @@ +#!/usr/local/bin/perl + +use strict; +use warnings; +use Scalar::Util qw(looks_like_number); +use Term::ANSIColor; + +use constant { + MPV_PATH => '/home/jozan/.local/bin/mpview', + FETCH_PATH => '/usr/bin/fetch' +}; + +# ext="${1##*.}" +# mpvFiles="mkv mp4 gif" +# sxivFiles="png jpg jpeg jpe xpm" +# wgetFiles="flac mp3 mp3?source=feed opus pdf doc docx" +# +# cd ~/dl || exit +# +# if echo "$sxivFiles" | grep -w "$ext" > /dev/null; then +# nohup sxiv "$1" > /dev/null & +# elif echo "$mpvFiles" | grep -w "$ext" > /dev/null; then +# nohup mpv --loop --quiet "$1" > /dev/null & +# elif echo "$wgetFiles" | grep -w "$ext" > /dev/null; then +# clear +# fetch "$1" +# else +# clear +# mpv-view.pl "$1" +# fi + +sub open_link +{ + my ($answer) = @_; + return; +} + +sub prompt +{ + my ($url) = @_; + my $answer; + + print 'URL: ' . colored($url, 'red') . "\n\n" . + "Open with?\n" . + "0) mpv\n" . + "1) fetch\n" . + "2) sxiv\n" . + "3) zathura\n" . + "4) w3m\n" . + "5) firefox\n\n" . + "> "; + $answer = ; + if (!looks_like_number($answer) || $answer == 0 || $answer == 1 || $answer > 6) { + $answer = -1; + } + return $answer; +} + +sub main +{ + my $answer; + + system('tput', 'clear'); + if (@ARGV == 0) { + print STDERR "linkview: URL needed\n"; + exit 1; + } + $answer = prompt($ARGV[0]); + if ($answer == -1) { + print STDERR "linkview: Bad answer\n"; + exit 2; + } + open_link($answer); + return; +} + +main(); + +__END__ diff --git a/.local/bin/linkview.pl b/.local/bin/linkview.pl deleted file mode 100755 index 8baf8c0..0000000 --- a/.local/bin/linkview.pl +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/local/bin/perl - -use strict; -use warnings; -use Term::ANSIColor; - -use constant { - MPV_PATH => '/home/jozan/.local/bin/mpview', - FETCH_PATH => '/usr/bin/fetch' -}; - -# ext="${1##*.}" -# mpvFiles="mkv mp4 gif" -# sxivFiles="png jpg jpeg jpe xpm" -# wgetFiles="flac mp3 mp3?source=feed opus pdf doc docx" -# -# cd ~/dl || exit -# -# if echo "$sxivFiles" | grep -w "$ext" > /dev/null; then -# nohup sxiv "$1" > /dev/null & -# elif echo "$mpvFiles" | grep -w "$ext" > /dev/null; then -# nohup mpv --loop --quiet "$1" > /dev/null & -# elif echo "$wgetFiles" | grep -w "$ext" > /dev/null; then -# clear -# fetch "$1" -# else -# clear -# mpv-view.pl "$1" -# fi - -sub main -{ - my $answer; - - if (@ARGV == 0) { - print STDERR "URL needed\n"; - exit 1; - } - print colored($ARGV[0], 'bold_green') . "\n"; - $answer = ; - return; -} - -main(); - -__END__ diff --git a/.urlview b/.urlview index 36e6eb4..649f158 100644 --- a/.urlview +++ b/.urlview @@ -1,4 +1,4 @@ REGEXP (((http|https|ftp|gopher)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):] -COMMAND ~/.local/bin/linkview.pl +COMMAND ~/.local/bin/linkview QUITONLAUNCH -- cgit v1.2.3