snipt

Ctrl+h for KB shortcuts

Bash

Change wallpaper from Alfred

1
2
3
4
5
6
7
!#/bin/sh
osascript <<EOD
set myPic to POSIX path of "$1"  
tell application "Finder"
set desktop picture to (POSIX file myPic) as alias
end tell
EOD
https://snipt.net/embed/f0d35222f853be1faca28ba567c308e2/
/raw/f0d35222f853be1faca28ba567c308e2/
f0d35222f853be1faca28ba567c308e2
bash
Bash
7
2019-06-27T00:44:41
True
False
False
/api/public/snipt/26543/
change-wallpaper-from-alfred
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>!#/bin/sh </span><span id="L-2"><a name="L-2"></a>osascript <span class="s">&lt;&lt;EOD</span> </span><span id="L-3"><a name="L-3"></a><span class="s">set myPic to POSIX path of &quot;$1&quot; </span> </span><span id="L-4"><a name="L-4"></a><span class="s">tell application &quot;Finder&quot;</span> </span><span id="L-5"><a name="L-5"></a><span class="s">set desktop picture to (POSIX file myPic) as alias</span> </span><span id="L-6"><a name="L-6"></a><span class="s">end tell</span> </span><span id="L-7"><a name="L-7"></a><span class="s">EOD</span> </span></pre></div> </td></tr></table>
alfred, bash