Jump to content

Recommended Posts

Author:

I am the author of this workflow.

 

Repository: 

https://github.com/kennonb/alfred-workflow-bing-wallpaper

 

Dependencies:

- PHP

 

Description:

 

This workflow shows the latest 8 wallpapers from Bing Wallpaper. Type bing into Alfred (without any arguments), and it will show you the list of current wallpapers.

 

Then it allows you to:

  • Press Enter to download the wallpaper and set it as your desktop image.
  • Press CMD+Enter to view the wallpaper in your browser.
  • Press Shift, or CMD+Y, to quicklook the image at a reduced resolution.

 

Before you use the workflow you will need to make sure you have PHP installed on your local system. The easiest way is through Homebrew.

  • brew install php

 

Then you will need to configure the path to where you want the wallpapers to be stored on your computer.

 

image.thumb.png.a2c4102ff4682532dff9064418a7907e.png

Edited by Kennon Bickhart
Link to comment
Share on other sites

Pretty detailed submission! Thank you. A few issues:

  • Not really a problem, but you don’t need the if [ -f "/opt/homebrew/bin/php" ] checks (none of the three). Alfred includes all those paths in PATH so you can just php fetchImageList.php "$1" as the whole script (see more).
  • The Default Value for the wallpaperFolder variable should be ~/Photos. Using ~ will let Alfred know to use the correct user directory.
  • The code fails for me:

ERROR: Bing Wallpapers[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0. in JSON:
Warning: Undefined property: stdClass::$desc in /Users/vm/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.D3CEBAB3-CF30-4875-B2C4-2AE8C2AB39E6/fetchImageList.php on line 18

Fatal error: Uncaught TypeError: Alfred\Workflows\Item::subtitle(): Argument #1 ($subtitle) must be of type string, null given, called in /Users/vm/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.D3CEBAB3-CF30-4875-B2C4-2AE8C2AB39E6/fetchImageList.php on line 18 and defined in /Users/vm/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.D3CEBAB3-CF30-4875-B2C4-2AE8C2AB39E6/vendor/joetannenbaum/alfred-workflow/src/ItemParam/HasSubtitle.php:14
Stack trace:
#0 /Users/vm/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.D3CEBAB3-CF30-4875-B2C4-2AE8C2AB39E6/fetchImageList.php(18): Alfred\Workflows\Item->subtitle(NULL)
#1 {main}
  thrown in /Users/vm/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.D3CEBAB3-CF30-4875-B2C4-2AE8C2AB39E6/vendor/joetannenbaum/alfred-workflow/src/ItemParam/HasSubtitle.php on line 14

 

Link to comment
Share on other sites

2 hours ago, vitor said:

Pretty detailed submission! Thank you.

 

A few issues:

  • Not really a problem, but you don’t need the if [ -f "/opt/homebrew/bin/php" ] checks (none of the three). Alfred includes all those paths in PATH so you can just php fetchImageList.php "$1" as the whole script (see more).
  • The Default Value for the wallpaperFolder variable should be ~/Photos. Using ~ will let Alfred know to use the correct user directory.
  • The code fails for me:

 

👍🏻

 

1. I've modified that conditional.

2. I've updated the default value for `wallpaperFolder` to `~/Pictures` since that's the default for macOS (I believe, at least it is for me).

3. I added data caching that should automatically invalidate the API data every 2 hours after the initial cache.

 

I can't reproduce that error though. I'm not sure why you'd be getting that. It seems to work just fine for me no matter what I do. 😕 I tried to remove the whole workflow and re-import from scratch and it was still working.

 

Anything else you can think of that I can try to see what you're seeing? What version of everything are you running? I'm on:

 

- PHP 8.2.1

- macOS Ventura 13.2.1

- Macbook Pro 14" M1

 

I've published the changes so far to GitHub.

Link to comment
Share on other sites

On 3/1/2023 at 1:58 AM, Kennon Bickhart said:

What version of everything are you running?

  • PHP 8.2.3
  • macOS 13.2.1
  • M1

The machine is otherwise mostly clean. I can still reproduce with the latest version, though now it’s on line 24 of fetchImageList.php.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...