diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-11-01 20:19:21 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-11-01 20:19:21 +0100 |
commit | 1739341e87cf7b1b80f76b78eb0a48912d47a705 (patch) | |
tree | fede94876a0daf1198a8e08ffefc3fb19a4270b3 | |
parent | Renamed (diff) | |
download | dotfiles-bsd-1739341e87cf7b1b80f76b78eb0a48912d47a705.tar.gz dotfiles-bsd-1739341e87cf7b1b80f76b78eb0a48912d47a705.tar.bz2 dotfiles-bsd-1739341e87cf7b1b80f76b78eb0a48912d47a705.tar.xz dotfiles-bsd-1739341e87cf7b1b80f76b78eb0a48912d47a705.tar.zst dotfiles-bsd-1739341e87cf7b1b80f76b78eb0a48912d47a705.zip |
Renamed again
-rw-r--r-- | .config/fish/alias.fish | 3 | ||||
-rw-r--r-- | .config/vifm/vifmrc | 2 | ||||
-rwxr-xr-x | .local/bin/linkview (renamed from .local/bin/linkview.pl) | 39 | ||||
-rw-r--r-- | .urlview | 2 |
4 files changed, 40 insertions, 6 deletions
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.pl b/.local/bin/linkview index 8baf8c0..2a16c03 100755 --- a/.local/bin/linkview.pl +++ b/.local/bin/linkview @@ -2,6 +2,7 @@ use strict; use warnings; +use Scalar::Util qw(looks_like_number); use Term::ANSIColor; use constant { @@ -28,16 +29,48 @@ use constant { # 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 = <STDIN>; + 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 "URL needed\n"; + print STDERR "linkview: URL needed\n"; exit 1; } - print colored($ARGV[0], 'bold_green') . "\n"; - $answer = <STDIN>; + $answer = prompt($ARGV[0]); + if ($answer == -1) { + print STDERR "linkview: Bad answer\n"; + exit 2; + } + open_link($answer); return; } @@ -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 |