summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-11-29 19:59:04 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-11-29 19:59:04 +0100
commitd5b0a206b6595d76c7c8b6747685abffa0684cfa (patch)
treee19428f3e0b7f013a46e520c52b8fa66b8572248
parentUpdate (diff)
downloaddotfiles-bsd-d5b0a206b6595d76c7c8b6747685abffa0684cfa.tar.gz
dotfiles-bsd-d5b0a206b6595d76c7c8b6747685abffa0684cfa.tar.bz2
dotfiles-bsd-d5b0a206b6595d76c7c8b6747685abffa0684cfa.tar.xz
dotfiles-bsd-d5b0a206b6595d76c7c8b6747685abffa0684cfa.tar.zst
dotfiles-bsd-d5b0a206b6595d76c7c8b6747685abffa0684cfa.zip
update
-rw-r--r--.config/zsh/alias.zsh2
-rwxr-xr-x.local/bin/linkview55
2 files changed, 43 insertions, 14 deletions
diff --git a/.config/zsh/alias.zsh b/.config/zsh/alias.zsh
index 2e5b8b4..edacf36 100644
--- a/.config/zsh/alias.zsh
+++ b/.config/zsh/alias.zsh
@@ -122,7 +122,7 @@ twi() {
alias nb='newsboat'
alias mutt='neomutt'
alias nmt='neomutt'
-alias sxiv='sxiv -b'
+alias sxiv='sxiv -b -a'
alias pinfo='pkg info -x'
alias psearch='pkg search'
search() {
diff --git a/.local/bin/linkview b/.local/bin/linkview
index 7572702..f4e6145 100755
--- a/.local/bin/linkview
+++ b/.local/bin/linkview
@@ -9,6 +9,7 @@ use Cwd qw(cwd);
use Term::ReadKey;
use Term::ANSIColor qw(colored);
use Capture::Tiny qw(capture);
+use POSIX qw(setsid);
use constant {
MPVIEW_PATH => '/home/jozan/.local/bin/mpview',
@@ -40,7 +41,8 @@ sub open_link
}
elsif ($a == 2 || $a == 3) {
$pid = fork();
- if ($pid == 0) {
+ if (not $pid) {
+ setsid();
chdir home() . "/dl" or
chdir home() . "/Downloads" or
chdir home() or die $!;
@@ -122,20 +124,45 @@ sub open_link
exit 0;
}
}
- elsif ($a == 4) {
- exec(
- SXIV_PATH,
- '-b',
- $url
- );
- }
- elsif ($a == 5) {
- exec(
- ZATHURA_PATH,
- $url
- );
+ elsif ($a == 4 || $a == 5) {
+ $pid = fork();
+ if (not $pid) {
+ setsid();
+ chdir '/tmp' or die $!;
+ $file_name = $url;
+ $file_name =~ s/.+\///g;
+ system(
+ NOTIFYSEND_PATH,
+ '-u',
+ 'low',
+ '-t',
+ '5000',
+ 'download started',
+ ' fetching <b>'. $file_name . '</b> to <b>/tmp</b>'
+ );
+ system(
+ FETCH_PATH,
+ '-q',
+ $url
+ );
+ if ($a == 4) {
+ exec(
+ SXIV_PATH,
+ '-b',
+ '-a',
+ $file_name
+ );
+ }
+ else {
+ exec(
+ ZATHURA_PATH,
+ $file_name
+ );
+ }
+ }
}
elsif ($a == 6) {
+ system('clear');
exec(
MPV_PATH,
'--really-quiet',
@@ -153,6 +180,7 @@ sub open_link
elsif ($a == 8) {
$pid = fork();
if (not $pid) {
+ setsid();
capture {
exec(
FIREFOX_PATH,
@@ -162,6 +190,7 @@ sub open_link
}
}
elsif ($a == 9) {
+ system('clear');
exec(
MPV_PATH,
'--audio-channels=stereo',