Files
macports-ports/emulators/virt-viewer/files/RemoteViewer.applescript
Dan R. K. PortsandDan Ports 07ea68190a virt-viewer: add Mac app bundle with .vv file association
Add a Remote Viewer.app that registers as a handler for .vv connection
files. The app is built as an AppleScript droplet that copies the file
to a temporary location (for quarantine compatibility) and launches
remote-viewer. The original file is removed if it contains
delete-this-file=1 (as remote-viewer does itself).

Includes an +app_as_root variant that prompts for administrator
privileges before launching. This is less secure but needed for USB
forwarding.
2026-05-13 14:00:48 -07:00

18 lines
728 B
AppleScript

on open theFiles
repeat with oneFile in theFiles
set srcPath to POSIX path of oneFile
set tmpPath to do shell script "/usr/bin/mktemp -t remote-viewer-vv"
do shell script "/bin/cp " & quoted form of srcPath & " " & quoted form of tmpPath
try
do shell script "/usr/bin/grep -q '^delete-this-file[[:space:]]*=[[:space:]]*[^0[:space:]]' " & quoted form of srcPath
do shell script "/bin/rm -f " & quoted form of srcPath
end try
do shell script "@PREFIX@/bin/remote-viewer " & quoted form of tmpPath & " > /dev/null 2>&1 &"@PRIVILEGES@
end repeat
end open
on run
do shell script "@PREFIX@/bin/remote-viewer > /dev/null 2>&1 &"@PRIVILEGES@
end run