I'm totally adding this to epic win. +300

This commit is contained in:
coolnsx
2024-10-04 14:46:07 +05:30
parent 369e49ae17
commit a2532464bb
5 changed files with 16 additions and 7 deletions

View File

@@ -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() {

View File

@@ -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

8
screen
View File

@@ -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*)

View File

@@ -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

View File

@@ -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|.*<title>([^<]*)<.*|\1|p' | sed 's|&amp;|\&|g')
@@ -266,7 +266,7 @@ play_next() {
menu() {
if command -v bemenu >/dev/null; then
bemenu --fn 'IBM Plex Sans 15' -i -c -W 0.5 -B 3 -p "$1" -l 26 -I "${2:-0}" -P ">>" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT"
bemenu -R 20 --fn 'IBM Plex Sans 15' -i -c -W 0.5 -B 3 -p "$1" -l 26 -I "${2:-0}" -P ">>" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT"
else
fzf --prompt="$1" --height=25 --reverse --border=horizontal --header="${2:-0}" --marker=">>"
fi