MacOS – Can Safari’s download popover window be made wider

applescriptautomatorcommand linemacossafari

How can the max. width (fixed width≈425) of Safari's download-popover-window be made wider?

Is there a way to get at Safari's "download pop over window" in any way so its max-size is larger than 425 px and longer file names are no longer abbreviated?
Maybe via AppleScriptObjC?

[[ Answers:
So far (w/o use of AS-objC) just three "workarounds" have come around…

  • Original Workaround #1 … a mixture of (do) shellScript (cat/sed), AS, Html and Automator
  • Workaround # 1 … uses only Automator modules but also contains the above shell script
  • Workaround # 2 … with direct AS access on Safari's plist file, a dialog & a "button" in Safari

WA #2 is my favorite; the others' "windows" are more flexible. Both use Automator shortcuts. ]]

Best Answer

Original Workaround #1:

The first one here has got the advantage to use only one Automator action and allows quite precise settings of the resulting Safari-owned window. Its end results are a "service" in Safari's menus plus a keyboard shortcut.
These components are involved:

  • Safari's "Download.plist" (in: Library/Safari)
  • A shell script running cat & sed, filtering the plist-file's input into "Downloads1.html"
  • An Html file "Downloads2.html" holding Html tags of your choice (w/o finishing tags: </...)
  • An AppleScript containing a "do shell script" command, "telling" Safari to open an
  • ... Html file "Downloads.html", generated by shell script, in order to at last get …
  • Automator to place a workflow in Safari's "Services" menu.

This code runs as an Automator Service (without "run" commands it's plain AppleScript):

on run {input, parameters} 
 -- [Only if needed, place: "LANG=C; LC_CTYPE=C; LC_ALL=C;" in front of "cd"]

    do shell script "cd ˜/Users/[myName]/Library/Safari/;
             rm Downloads.html;
             cat Downloads.plist | sed -n ' { s/.*Downloads/<p>D`load => /; ¬
                     s/.*Trash/<p>Trashed => / ; s/.*Movies/<p>Movies => /; ¬
                     s/mp4.*/mp4<p>/ p; }' > Downloads1.html';
             cat Downloads2.html Downloads1.html > Downloads.html;"

    tell application "Safari"
        make new document at end of documents with properties ¬
            {URL:"file:///Users/[myName]/Library/Safari/Downloads.html"} 
        set bounds of window 1 to {700, 62, 1280, 450} 
    end tell 
    return input 
end run

(The shell script and "make new document…" are meant to be one liners each.)

Integrated are two "filters" to the sed part (.*Movies & .*Trash) so my browser window looks like this (you may edit these filters or/and add Extensions to your needs):

+----------------------- Toolbar -------------------------+
|                                                         |
|  D'load => /Some_sinster_TV_series_S02E01_15.11.21_00-  |
|  40_BBC3_93_TVOON_DE.mpg.HQ.avi.otrkey                  |
|                                                         |
|  Movies => DS9.4.07_Little_green_men.mp4                |
|                                                         |
|  Trashed => /DS9.3.09_Defiant.mp4                       |
|                                                         |
|  Trashed => /DS9.3.07_Civil_Defense.mp4                 |
|                                                         |
+---------------------------------------------------------+

(Those leading slashes suck… hard to filter out, though.)

  • The commented out second line may be needed, or may not…
  • Replace [myName] with your own user name.
  • To use this code as "service" in Safari, you have to paste it inside a "Run AppleScript" field in automator. Save it as "workflow".
  • You can then create a shortcut (e.g.: opt-cmd-d) that will run it instantaneously (System-Prefences / Keyboard / Shortcuts / Services).
  • My solution is not really sophisticated, but I learned (glimpsed) a lot about sed, awk, cat and AppleScript/Automator.