๐Ÿ“ฆโž”๐Ÿฆ‹ Store and retrieve files on the Atmosphere

move toggle-desktop to own file

+51 -49
-46
src/commands/old_cmds.sh
··· 416 416 fi 417 417 } 418 418 419 - function atfile.invoke.toggle_desktop() { 420 - unset desktop_dir 421 - unset mime_dir 422 - 423 - [[ $_os == "haiku" ]] && atfile.die "Not available on Haiku" 424 - [[ $_os == "macos" ]] && atfile.die "Not available on macOS\nThink you could help? See: https://tangled.sh/@zio.sh/atfile/issues/9" 425 - 426 - uid="$(id -u)" 427 - if [[ $uid == 0 ]]; then 428 - desktop_dir="/usr/local/share/applications" 429 - mime_dir="/usr/local/share/mime" 430 - else 431 - desktop_dir="$HOME/.local/share/applications" 432 - mime_dir="$HOME/.local/share/mime" 433 - fi 434 - 435 - desktop_path="$desktop_dir/atfile-handler.desktop" 436 - mkdir -p "$desktop_dir" 437 - mkdir -p "$mime_dir" 438 - 439 - if [[ -f "$desktop_path" ]]; then 440 - atfile.say "Removing '$desktop_path'..." 441 - rm "$desktop_path" 442 - else 443 - atfile.say "Installing '$desktop_path'..." 444 - 445 - echo "[Desktop Entry] 446 - Name=ATFile (Handler) 447 - Description=Handle atfile:/at: URIs with ATFile 448 - Exec=$_prog_path handle %U 449 - Terminal=false 450 - Type=Application 451 - MimeType=x-scheme-handler/at;x-scheme-handler/atfile; 452 - NoDisplay=true" > "$desktop_path" 453 - fi 454 - 455 - if [ -x "$(command -v xdg-mime)" ] &&\ 456 - [ -x "$(command -v update-mime-database)" ]; then 457 - atfile.say "Updating mime database..." 458 - 459 - update-mime-database "$mime_dir" 460 - xdg-mime default atfile-handler.desktop x-scheme-handler/at 461 - xdg-mime default atfile-handler.desktop x-scheme-handler/atfile 462 - fi 463 - } 464 - 465 419 function atfile.invoke.upload() { 466 420 file="$1" 467 421 recipient="$2"
+48
src/commands/toggle-desktop.sh
··· 1 + #!/usr/bin/env bash 2 + 3 + function atfile.toggle_desktop() { 4 + unset desktop_dir 5 + unset mime_dir 6 + 7 + # shellcheck disable=SC2154 8 + [[ $_os == "haiku" ]] && atfile.die "Not available on Haiku" 9 + [[ $_os == "macos" ]] && atfile.die "Not available on macOS" 10 + 11 + uid="$(id -u)" 12 + if [[ $uid == 0 ]]; then 13 + desktop_dir="/usr/local/share/applications" 14 + mime_dir="/usr/local/share/mime" 15 + else 16 + desktop_dir="$HOME/.local/share/applications" 17 + mime_dir="$HOME/.local/share/mime" 18 + fi 19 + 20 + desktop_path="$desktop_dir/atfile-handler.desktop" 21 + mkdir -p "$desktop_dir" 22 + mkdir -p "$mime_dir" 23 + 24 + if [[ -f "$desktop_path" ]]; then 25 + atfile.say "Removing '$desktop_path'..." 26 + rm "$desktop_path" 27 + else 28 + atfile.say "Installing '$desktop_path'..." 29 + 30 + echo "[Desktop Entry] 31 + Name=ATFile (Handler) 32 + Description=Handle atfile:/at: URIs with ATFile 33 + Exec=$_prog_path handle %U 34 + Terminal=false 35 + Type=Application 36 + MimeType=x-scheme-handler/at;x-scheme-handler/atfile; 37 + NoDisplay=true" > "$desktop_path" 38 + fi 39 + 40 + if [ -x "$(command -v xdg-mime)" ] &&\ 41 + [ -x "$(command -v update-mime-database)" ]; then 42 + atfile.say "Updating mime database..." 43 + 44 + update-mime-database "$mime_dir" 45 + xdg-mime default atfile-handler.desktop x-scheme-handler/at 46 + xdg-mime default atfile-handler.desktop x-scheme-handler/atfile 47 + fi 48 + }
+1 -1
src/commands/token.sh
··· 1 1 #!/usr/bin/env bash 2 2 3 - function atfile.invoke.token() { 3 + function atfile.token() { 4 4 atfile.xrpc.pds.jwt 5 5 }
+2 -2
src/shared/invoke.sh
··· 139 139 atfile.stream "${args[0]}" "${args[1]}" "${args[2]}" "${args[3]}" 140 140 ;; 141 141 "token") 142 - atfile.invoke.token 142 + atfile.token 143 143 ;; 144 144 "toggle-mime") 145 - atfile.invoke.toggle_desktop 145 + atfile.toggle_desktop 146 146 ;; 147 147 "upload") 148 148 atfile.util.check_prog_optional_metadata