diff options
author | Joe <rrbo@proton.me> | 2023-03-13 16:11:54 +0100 |
---|---|---|
committer | Joe <rrbo@proton.me> | 2023-03-13 16:11:54 +0100 |
commit | cd8880e2ebbcfbe6c543a25771d2207542eaa008 (patch) | |
tree | 2a7f5584b611d71f5e5fc2eaa0672ecb2c65f477 | |
parent | up (diff) | |
download | dotfiles-bsd-cd8880e2ebbcfbe6c543a25771d2207542eaa008.tar.gz dotfiles-bsd-cd8880e2ebbcfbe6c543a25771d2207542eaa008.tar.bz2 dotfiles-bsd-cd8880e2ebbcfbe6c543a25771d2207542eaa008.tar.xz dotfiles-bsd-cd8880e2ebbcfbe6c543a25771d2207542eaa008.tar.zst dotfiles-bsd-cd8880e2ebbcfbe6c543a25771d2207542eaa008.zip |
up
Diffstat (limited to '')
-rw-r--r-- | .config/conky/conkyrc | 4 | ||||
-rw-r--r-- | .config/gtk-2.0/gtkfilechooser.ini | 2 | ||||
-rwxr-xr-x | .local/bin/conky/net.sh | 2 | ||||
-rwxr-xr-x | .local/bin/linkview | 71 | ||||
-rwxr-xr-x | .local/bin/mpview | 91 |
5 files changed, 52 insertions, 118 deletions
diff --git a/.config/conky/conkyrc b/.config/conky/conkyrc index 7373187..5a4b7b4 100644 --- a/.config/conky/conkyrc +++ b/.config/conky/conkyrc @@ -99,6 +99,6 @@ ${font2}${color0}${top_mem name 3} ${alignr}${top_mem pid 3} ${top_mem cpu 3} ${font2}${color2}${top_mem name 4} ${alignr}${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem_res 4}${font} ${color1}--------- ${color1}Processes: ${font2}${color0}${processes}${font} -${execpi 15 ~/.local/bin/conky/net.sh} -${if_match "${nodename_short}" == "mother"}${color0}${downspeedgraph eth1 50,185 ebdbb2 928374 256000000 -t}${goto 195}${color0}${upspeedgraph eth1 50,180 ebdbb2 928374 256000000 -t}${endif}${if_match "${nodename_short}" == "po-rbo"}${color0}${downspeedgraph enx4ce1734c425a 50,180 ebdbb2 928374 128000000 -t}${goto 195}${color0}${upspeedgraph enx4ce1734c425a 50,180 ebdbb2 928374 128000000 -t}${endif} +${execpi 5 ~/.local/bin/conky/net.sh} +${if_match "${nodename_short}" == "mother"}${color0}${downspeedgraph eth1 50,185 ebdbb2 928374 256000000 -t}${goto 195}${color0}${upspeedgraph eth1 50,180 ebdbb2 928374 256000000 -t}${endif}${if_match "${nodename_short}" == "po-rbo"}${color0}${downspeedgraph enx34298f762de7 50,180 ebdbb2 928374 128000000 -t}${goto 195}${color0}${upspeedgraph enx34298f762de7 50,180 ebdbb2 928374 128000000 -t}${endif} ]] diff --git a/.config/gtk-2.0/gtkfilechooser.ini b/.config/gtk-2.0/gtkfilechooser.ini index a1ca96a..ba7eb82 100644 --- a/.config/gtk-2.0/gtkfilechooser.ini +++ b/.config/gtk-2.0/gtkfilechooser.ini @@ -2,7 +2,7 @@ LocationMode=path-bar ShowHidden=true ShowSizeColumn=true -GeometryX=806 +GeometryX=3366 GeometryY=432 GeometryWidth=948 GeometryHeight=641 diff --git a/.local/bin/conky/net.sh b/.local/bin/conky/net.sh index 8def12f..edafe07 100755 --- a/.local/bin/conky/net.sh +++ b/.local/bin/conky/net.sh @@ -6,7 +6,7 @@ case "$(hostname -s)" in if_alt="eth0" ;; po-rbo) - if_main="enx4ce1734c425a" + if_main="enx34298f762de7" if_alt="wlp1s0" ;; mars) diff --git a/.local/bin/linkview b/.local/bin/linkview index abc470d..916e0c5 100755 --- a/.local/bin/linkview +++ b/.local/bin/linkview @@ -2,6 +2,7 @@ use strict; use warnings; +use Sys::Hostname; use Scalar::Util qw(looks_like_number); use File::HomeDir qw(home); use File::Basename qw(basename); @@ -9,24 +10,27 @@ use Cwd qw(cwd); use Term::ReadKey; use Capture::Tiny qw(capture); use POSIX qw(setsid); +use feature qw(switch); +no warnings qw(experimental::smartmatch); use constant { - TERMINAL_PATH => '/usr/local/bin/st', - MPVIEW_PATH => home() . '/.local/bin/mpview', - MPV_PATH => '/usr/local/bin/mpv', - YTDL_PATH => '/usr/local/bin/yt-dlp', - FETCH_PATH => '/usr/bin/fetch', - IMGVIEW_PATH => '/usr/local/bin/nsxiv', - ZATHURA_PATH => '/usr/local/bin/zathura', - W3M_PATH => '/usr/local/bin/w3m', - BROWSER_PATH => '/usr/local/bin/iridium', - NOTIFYSEND_PATH => '/usr/local/bin/notify-send' + TERMINAL_PATH => 'st', + MPV_PATH => 'mpv', + YTDL_PATH => 'yt-dlp', + FETCH_PATH => 'fetch', + CURL_PATH => 'curl', + IMGVIEW_PATH => 'nsxiv', + ZATHURA_PATH => 'zathura', + W3M_PATH => 'w3m', + BROWSER_PATH => 'firefox', + NOTIFYSEND_PATH => 'notify-send', + HOSTNAME => (split /\./, hostname()) }; use constant PROG_LIST => "" . "mpv" . "\n" . "mpv-term" . "\n" . -"youtube-dl" . "\n" . -"youtube-dl thumbnail" . "\n" . +"ytdl" . "\n" . +"ytdl thumbnail" . "\n" . "fetch" . "\n" . "nsxiv" . "\n" . "zathura" . "\n" . @@ -60,7 +64,7 @@ sub open_link my @wc; if ($a eq "mpv") { - if (system(MPVIEW_PATH, $url) != 0) { + if (system(MPV_PATH, $url) != 0) { system( NOTIFYSEND_PATH, '-u', 'critical', @@ -74,12 +78,12 @@ sub open_link elsif ($a eq "mpv-term") { exec(TERMINAL_PATH, '-e', MPV_PATH, '--audio-channels=stereo', $url); } - elsif ($a eq "fetch" || $a eq "youtube-dl") { + elsif ($a eq "fetch" || $a eq "ytdl") { $pid = fork(); if (not $pid) { setsid(); $ret = -1; - if ($a eq "youtube-dl") { + if ($a eq "ytdl") { $list = QUAL_LIST; $quality = `printf "$list" | dmenu -i -l 8 -m 0`; if (not $quality) { @@ -97,7 +101,7 @@ sub open_link } $file_name = $url; $file_name =~ s/.+\///g; - $file_name = `youtube-dl -e $url`; + $file_name = `yt-dlp -e $url`; if (not $file_name) { $file_name = "YouTube video"; } @@ -233,7 +237,14 @@ sub open_link ' <b>' . $file_name . '</b> started downloading' ); (undef, undef, $ret) = capture { - system(FETCH_PATH, $url); + given (HOSTNAME) { + when(["mother", "po-rbo"]) { + system(CURL_PATH, "-fsSLO", $url); + } + when("mars") { + system(FETCH_PATH, $url); + } + } }; if ($ret == 0) { system( @@ -271,7 +282,7 @@ sub open_link exit 0; } } - elsif ($a eq "youtube-dl thumbnail") { + elsif ($a eq "ytdl thumbnail") { $pid = fork(); if (not $pid) { setsid(); @@ -279,7 +290,7 @@ sub open_link $file_name = $url; $file_name =~ s/.+\///g; if ($file_name =~ m/^watch\?v=.+/) { - $file_name = `youtube-dl -e $url`; + $file_name = `yt-dlp -e $url`; if (not $file_name) { $file_name = "Youtube video"; } @@ -306,11 +317,18 @@ sub open_link ); exit 0; } - system(FETCH_PATH, '-q', $tmp); + given (HOSTNAME) { + when(["mother", "po-rbo"]) { + system(CURL_PATH, "-fsSLO", $tmp); + } + when("mars") { + system(FETCH_PATH, '-q', $tmp); + } + } $file_name = $tmp; $file_name =~ s/.+\///g; chomp $file_name; - system(IMGVIEW_PATH, '-f', '-b', '-a', $file_name); + system(IMGVIEW_PATH, '-b', '-a', $file_name); unlink($file_name); exit 0; } @@ -329,8 +347,15 @@ sub open_link 'download started', ' fetching <b>'. $file_name . '</b> to <b>/tmp</b>' ); - system(FETCH_PATH, '-q', $url); - if ($a == "nsxiv") { + given (HOSTNAME) { + when(["mother", "po-rbo"]) { + system(CURL_PATH, "-fsSLO", $url); + } + when("mars") { + system(FETCH_PATH, '-q', $url); + } + } + if ($a eq "nsxiv") { exec(IMGVIEW_PATH, '-b', '-a', $file_name); } else { diff --git a/.local/bin/mpview b/.local/bin/mpview deleted file mode 100755 index c1ea734..0000000 --- a/.local/bin/mpview +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use warnings; -use Scalar::Util qw(looks_like_number); -use Term::ReadKey; -use Term::ANSIColor; - -sub get_size -{ - my $size; - my $answer; - - $size = 0; - $answer = 0; - print - "1) 0\n" . - "2) 240\n" . - "3) 360\n" . - "4) 480\n" . - "5) 720\n" . - "6) 1080\n" . - "\n" . - "> "; - open(TTY, "</dev/tty"); - ReadMode "raw"; - $answer = ReadKey 0, *TTY; - ReadMode "normal"; - close(TTY); - print "\n"; - if ( - !looks_like_number($answer) || - $answer == 0 || - $answer == 1 || - $answer > 6 - ) { - $size = 0; - } - elsif ($answer == 2) { - $size = 240; - } - elsif ($answer == 3) { - $size = 360; - } - elsif ($answer == 4) { - $size = 480; - } - elsif ($answer == 5) { - $size = 720; - } - elsif ($answer == 6) { - $size = 1080; - } - return $size; -} - -sub main -{ - my $size; - - if ($#ARGV + 1 == 0) { - print STDERR "URL needed\n"; - exit 1; - } - $size = get_size(); - if ($size != 0) { - print 'mpv --really-quiet --audio-channels=stereo --ytdl-format=[height<=' . $size . '] ' . $ARGV[0] . "\n"; - exec( - 'mpv', - '--really-quiet', - '--audio-channels=stereo', - '--ytdl-format=[height<=' . $size . ']', - $ARGV[0] - ); - } - else { - print 'mpv --really-quiet --audio-channels=stereo ' . $ARGV[0] . "\n"; - exec( - 'mpv', - '--really-quiet', - '--audio-channels=stereo', - $ARGV[0] - ); - } - print "$size\n"; - exit 0; -} - -main(); - -__END__ |