diff --git a/.functions b/.functions index 3bc09c8..4d1855f 100644 --- a/.functions +++ b/.functions @@ -7,7 +7,7 @@ menu_droid() { } menu_linux() { - bemenu --fn 'Cascadia Mono 15' -i -c -W "0.${3:-6}" -B 3 -l 25 -p "$1" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT" -R 20 + bemenu --fn 'IBM Plex Sans 15' -i -c -W "0.${3:-6}" -B 3 -l 25 -p "$1" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT" -R 20 } search_droid() { diff --git a/ani-new b/ani-new index 90b20b5..7f9ea17 100755 --- a/ani-new +++ b/ani-new @@ -22,7 +22,7 @@ case $(uname -o) in *) os="linux" download_dir="$HOME/Downloads" - [ -t 1 ] || terminal="${TERMINAL:-foot} -e" + terminal="setsid -f ${TERMINAL:-foot} -e" ;; esac diff --git a/screen b/screen index 62c6bca..5b6f1bf 100755 --- a/screen +++ b/screen @@ -35,7 +35,7 @@ record() { mic="alsa_input.pci-0000_04_00.6.analog-stereo" #It is called in eval on line 9 #shellcheck disable=SC2034 speaker="alsa_output.pci-0000_04_00.6.analog-stereo.monitor" #It is called in eval on line 9 - source=$(printf "screen only\nspeaker\nmic" | menu "Audio Source:" "3") + source=$(printf "screen only\n%s" "$(pactl -f json list sources | sed 's|"index":|\n|g' | sed -nE 's|.*,"name":"([^"]*)","description":"([^"]*)".*|\2\t\1|p')" | menu "Audio Source:" "3") [ -z "$source" ] && info "" "2000" "No option Selected" && return 0 @@ -65,6 +65,8 @@ stop() { #shellcheck disable=SC1091 . "$HOME"/.config/.env + nextcloud_creds + cloudname="screenrecord-$(date +"%F_%H-%M-%S").mp4" #upload to nextcloud instance, universal code @@ -76,9 +78,13 @@ stop() { info "nextcloud" "10000" "Generating Share Link" expire_date=$(date -d "+ 1 month" +"%Y-%m-%d") # link won't available after 1 month curl -u "$NC_USER:$NC_TOKEN" -s "$NC_URL/ocs/v2.php/apps/files_sharing/api/v1/shares" -H 'content-type: application/json' -H 'accept: application/json, text/plain, */*' -H 'OCS-APIRequest: true' --data-raw '{"path":"'"${NC_SHARE_PATH}/$cloudname"'","shareType":3,"expireDate":"'"$expire_date"'"}' | sed -nE 's|.*"url":"([^"]*)".*|\1|p' | sed 's/\\//g' | wl-copy && info "com.github.davidmhewitt.clipped" "2000" "Share Link Created and copied to clipboard" + + nextcloud_creds "unload" ;; *matrix) + matrix_creds + matrix_creds "unload" ;; save*) diff --git a/torrent b/torrent index e294802..750d841 100755 --- a/torrent +++ b/torrent @@ -26,6 +26,9 @@ else script_dir="$HOME/repos_scripts" download_dir="$HOME/Softwares" [ -z "$magnet" ] && magnet="$(wl-paste)" + terminal="${TERMINAL:-foot}" + prefix="setsid -f $terminal -e" + pgrep -af "$0" | grep -q "$terminal" || { $prefix "$0" "$magnet"; exit 0; } fi #import generic functions diff --git a/yt-music b/yt-music index 6b7030b..45503ac 100755 --- a/yt-music +++ b/yt-music @@ -65,7 +65,7 @@ get_cookies() { # the user has firefox installed if [ ! -f "$HOME/.config/google-chrome/Default/Cookies" ]; then cp "$(find "$HOME/.mozilla" -type f -iname 'cookies.sqlite' | head -1)" "$logdir/cookies.sqlite" - sqlite3 "$logdir/cookies.sqlite" "SELECT name, value FROM moz_cookies WHERE host='.youtube.com' and name NOT like 'ST-%';" | tr '|\n' '=;' >"$cookie" + sqlite3 "$logdir/cookies.sqlite" "SELECT name, value FROM moz_cookies WHERE host='.youtube.com' and name NOT like 'ST-%' and name NOT like 'VISITOR%' and name NOT like 'PREF%';" | tr '|\n' '=;' >"$cookie" rm "$logdir/cookies.sqlite" return 0 fi @@ -196,7 +196,7 @@ play() { curl -s "https://i.ytimg.com/vi/$id/hqdefault.jpg" -o - | magick convert - -crop 270x270+105+45 "$logdir/default.jpg" && notify-send -e -h "string:x-canonical-private-synchronous:${0##*/}" -i "$logdir/default.jpg" "Now Playing" "$title" -t 5000 pgrep -f "$socket" >/dev/null || (setsid -f mpv --really-quiet --input-ipc-server="$socket" --idle --quiet >/dev/null && sleep 1) printf '{"command":["loadfile","%s","replace"]}\n' "$audio_url" | socat - "$socket" - printf "SONG='%s'\nARTIST='%s'\nID='%s'" "$(printf '%s' "$title" | sed 's|[^-]*$||g;s|-$||g;s| $||g;s|^ ||g')" "$(printf '%s' "$title" | sed 's_.* - __;s| $||')" "$id" >"$logdir/current" + printf 'SONG="%s"\nARTIST="%s"\nID="%s"' "$(printf '%s' "$title" | sed 's|[^-]*$||g;s|-$||g;s| $||g;s|^ ||g;s/\\//g')" "$(printf '%s' "$title" | sed 's_.* - __;s| $||')" "$id" >"$logdir/current" #self explainatory get_song_lyrics "$id" & @@ -226,7 +226,7 @@ search_play() { \"params\": \"EgWKAQIIAWoKEAMQBBAJEAoQBQ%3D%3D\" }" - res=$(get_data "search" "$json_search" "$agent" | sed 's/watchEndpoint"/\n/g' | sed -nE 's_.*videoId":"([^"]*)",.*label":"Play ([^"]*)".*_\2\t\1_p' | menu "Yt-music [Play]:") + res=$(get_data "search" "$json_search" "$agent" | sed 's/watchEndpoint"/\n/g' | sed -nE 's_.*videoId":"([^"]*)",.*label":"Play ([^}]*)".*_\2\t\1_p' | menu "Yt-music [Play]:") else id=$(printf '%s' "$query" | cut -d':' -f2 | cut -d"=" -f2 | cut -d"/" -f4 | cut -d'&' -f1) title=$(curl -s "https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=$id&format=xml" | sed -nE 's|.*