r/iOSsetups • • Nov 02 '20

Beautiful blurred translucent widgets (with Scriptable, of course)

Post image
820 Upvotes

105 comments sorted by

58

u/mzeryck Nov 02 '20 edited Nov 02 '20

I wrote a script that allows you to mimic the blurred, translucent background of the built-in Batteries widget. You can choose to use the light or dark blur style when you’re making your widget background. I worked really hard to match the blur effect — using Javascript only! This depends on the awesome StackBlur algorithm, plus some very exciting algebraic formulas.

If you’ve used my previous scripts, the newest version of Weather Cal has support for dark text on light backgrounds, like you see in the images. Just change the text colors to “000000” and set tintIcons to true.

Here are the links for the wallpapers: Christopher Kuzman (rocks at sea) | Jeremy Bishop (mountain sunrise) | Amber Wilburn (pine trees) | Ameer Basheer (rock formation)

13

u/kuipuds Nov 02 '20

I really love your work man! I just can’t seem to make it work. Super bummed cause I’ve tried every other troubleshooting suggestions on the issues tab

The first error I got was “TypeError: undefined is not an object (evaluating 'weatherDataRaw.current.temp')” so I hard coded the location as you suggested from the issues tab then the next error I got was a “SyntaxError: Parser error” :(

I also made sure that location access was enabled

5

u/mzeryck Nov 02 '20

Weird - I'm guessing that means you tried the two solutions suggested by commenters here (waiting on the API key, making sure location is on). If you'd like, feel free to message me and I can try to help troubleshoot!

→ More replies (5)

7

u/sametkayaghae Nov 02 '20

“alerts are not supported in a widget” ☹️

what does this mean ?

1

u/mzeryck Nov 02 '20

Ah, I realized my explanation wasn't clear enough. The script isn't meant to be run within a widget, you just run the code from the Scriptable app itself. It'll walk you through the process of creating the blurred background image, which you can use in any widget (I saw a cool one in Widgy on Twitter).

The screenshots I posted use the Weather Cal widget, which does take a bit of setup (explained on the GitHub page). So I've created the backgrounds using the blur code and then added them to Weather Cal.

I hope this helps! Let me know if you have other issues.

1

u/[deleted] Nov 02 '20

How does one do a blurred background like this on widgy?

2

u/mzeryck Nov 02 '20

You would still need to copy this code into the Scriptable app. When you run the code (using the "play" button) it'll walk you through the steps, and at the end, you can export the image to the Photos app. Then, in Widgy, just use that photo as the background for your widget. Does that make sense?

→ More replies (3)
→ More replies (4)

3

u/PepperGhost718 Nov 02 '20

Nice setup, But what about the wallpapers?

3

u/mzeryck Nov 02 '20

Here are the links for the wallpapers: Christopher Kuzman (rocks at sea) | Jeremy Bishop (mountain sunrise) | Amber Wilburn (pine trees) | Ameer Basheer (rock formation)

1

u/Jonasuwu Nov 02 '20 edited Aug 07 '24

versed exultant disarm truck chief rich books fearless cows six

This post was mass deleted and anonymized with Redact

3

u/mzeryck Nov 02 '20

Ah, good call. I'll add that to my list! /u/1848573827472's suggestion should work, although my code blurs the image prior to cropping it, which is a bit more "accurate".

→ More replies (1)

1

u/iGpdThis Nov 02 '20

I keep getting “2020-11-02 07:26:30: Error on line 1444: SyntaxError: Unexpected end of script”

1

u/mzeryck Nov 02 '20

Weird, that's a new one! If you want, feel free to message me with more details.

1

u/ryancgray1 Nov 02 '20

Is there a way to set it so that it can switch between dark and light mode? Or is that just not going to be possible?

1

u/mzeryck Nov 02 '20

It's been on my list for a while - I am hoping to add that feature!

→ More replies (1)

1

u/Anonq54 Nov 02 '20

I love the first two the most, nicely done!

1

u/mzeryck Nov 02 '20

Thank you! :)

1

u/iGpdThis Nov 02 '20

Ok I finally got it to work. Only requests would be adding reminders to it or showing status of a current timer set. And how to change battery icon color. That’s all it’s oerfect

3

u/mzeryck Nov 07 '20

Hey, just wanted to let you know that the newest version has reminders! https://github.com/mzeryck/Weather-Cal

1

u/iGpdThis Nov 09 '20

Is there a way I can change the reminder little rectangle color? As well as the calendar events

1

u/mzeryck Nov 11 '20

The color is pulling directly from the associated calendar or list. You can change them in the Calendar or Reminders app, or if you don't want the rectangle to show up at all, you can set showCalendarColor: "" (and same for showListColor)

2

u/iGpdThis Nov 07 '20

Wow thanks so much god bless I’m downloading it now

1

u/mzeryck Nov 03 '20

Reminders is a common request, and I've been meaning to work on it! I don't know of a good way to support timers using the Scriptable app. For the battery icon color, what are you hoping for?

1

u/iGpdThis Nov 03 '20

A green color or of it could match how the stock batter turns red when almost dead yellow when low power battery mode or green when charging. In the space between the sunrise-sunset icons and the tomorrow events could you let me know how can I add a greeting to it?

2

u/mzeryck Nov 03 '20

Ah, the battery currently does turn red at 20%, but it's not possible to detect low power mode right now.

To add the greeting, just add greeting, in the layout list between sunset, and space,

→ More replies (5)

1

u/Haijime Nov 02 '20

Wallpapers?

1

u/mzeryck Nov 03 '20

Here are the links for the wallpapers: Christopher Kuzman (rocks at sea) | Jeremy Bishop (mountain sunrise) | Amber Wilburn (pine trees) | Ameer Basheer (rock formation)

1

u/Gsantos52012 Nov 02 '20

So cool! Hopefully Apple eventually allows widgets to be transparent/ use the wallpaper. Stuff like this is really nice.

1

u/mzeryck Nov 03 '20

Thank you! And yes, even though I have fun making these scripts it would definitely be nicer if it was supported by Apple!!

1

u/paninipasta Nov 02 '20

i really apologize if this question is ignorant but im not familiar with your work, i am faniliar with widgy and i was curious as to how i can get this EXACT widget.. the info is perfect and i love that it tells the weather... what steps did you take to make or acquire this exact widget ir where can i find instructions

1

u/mzeryck Nov 03 '20

The Scriptable app allows you to build custom widgets. This page has instructions of how to set up Weather Cal, which is the widget shown in the screenshots. Even though it's based on Javascript, you can change the layout and settings without knowing anything about code. Let me know if you have more questions!

1

u/Gulaseyes Nov 14 '20

Hi there!

I tried many times this script and always failed. Last night I tried it again and I choose from settings I don't want weather info. At the end of process widget keeps giving me error message with weather info. Only Red lines. Can you write exact which codes I need to edit?

1

u/mzeryck Nov 15 '20

The default widget layout has weather items in it, so you'd just need to remove those. You can just delete the words "current" and "future" from the layout list, and you might need to rearrange some things. Feel free to paste your layout code here if you want me to take a look.

→ More replies (2)

1

u/LiquidDiviums Nov 03 '20

I would like to do it, but I would need a video tutorial because I don’t know much about JavaScript.

2

u/mzeryck Nov 03 '20

You actually don't need to use Javascript! Just copy the code into the Scriptable app and press run (the "play" icon). It will walk you through the steps :)

1

u/harubyday124 Nov 03 '20

I wanted to make part of the date capitalized, what would I need to add to make that work?

1

u/mzeryck Nov 03 '20

Hmm, what part of the date are you hoping to capitalize? (And how comfortable are you with Javascript?)

1

u/harubyday124 Nov 03 '20

I’m not too great at JavaScript haha

But I’m using the large size date, and just wanted to capitalize the day of the week which I have on line 1 (for large size)

1

u/mzeryck Nov 03 '20

Ah okay, it's a bit manual but here's how to do it: scroll allll the way down to the "WIDGET ITEMS" section (around line 790). You'll see a line that looks like this:

let dateOne = provideText(df.string(currentDate), dateOneStack, textFormat.largeDate1)

Change it to:

let dateOne = provideText(df.string(currentDate).toUpperCase(), dateOneStack, textFormat.largeDate1)

→ More replies (1)

1

u/International_Bar736 Nov 03 '20

Anyone know how to fix “Alerts are not supported in a widget”

1

u/mzeryck Nov 03 '20

The blur script is meant to be run within the Scriptable app itself. Once you run it, it'll export an image that can be used as the background of whatever widget you'd like!

1

u/JSVRone Nov 03 '20

This is great! Tried to add a bigger time above the date but I’m no Java master. Wanted to have the a kind of iPad home screen look.

1

u/mzeryck Nov 03 '20

I've really wanted to add the time to this widget, but unfortunately it's not possible in the current version of Scriptable - hopefully someday.

→ More replies (1)

1

u/smuckerssssss Nov 03 '20

How do I get this to work? I run the script and it works and I save the image to my photos, but then what?

1

u/mzeryck Nov 04 '20

Now you can use that image as the background for any widget, like in Widgetsmith, Widgy, or Scriptable. The widgets in the screenshot use my Weather Cal code for Scriptable.

→ More replies (1)

1

u/spiraled0ut Nov 04 '20

been loving this widget! I have a quick question though, is it possible to change the app opened when you tap the weather info? such as opening the iOS weather app instead of the weather channel app

also, is it possible to add a now playing field to the bottom right?

2

u/mzeryck Nov 04 '20

It's definitely possible to change the destination (either to a different weather website, or a different weather app). The only exception is the built-in weather app, sadly there's no way to open it from a widget!

Scriptable doesn't offer any way to do now playing. But I'd add it very quickly if it did!

1

u/jezza21 Nov 06 '20

Thanks mate, having a bit of trouble with this new version. Does it still support medium widgets? Used to work fine, but with this code my calendar comes out looking like this:

https://i.imgur.com/PaN4VEu.jpg

2

u/mzeryck Nov 06 '20

What does your layout look like? The new default layout doesn't fit in a medium widget, but it's easy enough to change depending on what you'd like to display.

1

u/jezza21 Nov 06 '20

Didn’t change it much! Tried removing sunrise to see if that helped, but otherwise should be similar to how it started https://i.imgur.com/5BPNoBK.jpg

2

u/mzeryck Nov 06 '20

The extra row is causing the issue. Try this instead:

row,
column,
date,
events,
column(90),
current,
future,

→ More replies (1)

1

u/aarishrajwani1 Nov 06 '20

For the weather cal script it looks really cool and pretty easy to setup. I was wondering if there was a way for the background to switch when dark mode is activated. I used the script to make the background image blurred but I want it to use the dark blurred image when dark mode is activated. Is that possible?

3

u/mzeryck Nov 06 '20

Unfortunately, this is not possible with Scriptable. There is no way for a Scriptable widget to detect if dark mode is on or off. I've thought about adding a schedule feature, similar to the systemwide setting, that would switch the widget at sunset.

→ More replies (1)

1

u/JSVRone Nov 08 '20

Anyone figure out if you can put sunrise and future on the same line next to each other?

1

u/mzeryck Nov 11 '20

It's weirdly difficult to code things to be side-by-side (without going into the Javascript). The easiest way is by adding them to consecutive columns. If you send your current layout, I could show what I mean.

1

u/JSVRone Nov 11 '20

I figured it’d be strange, I was able to achieve it with columns but depending on the layout it doesn’t always layout nice. Thanks for being so responsive! Actually pretty happy with my current layout. Just took some playing around.

2

u/mzeryck Nov 11 '20

I thought a ton about this and never came up with any solution that made any sense without making the layout formatting super weird. But glad to hear you got it to a good place!

1

u/[deleted] Nov 09 '20

This feature is what I’ve been waiting for, big thanks for this! By the way here are some additional suggestions that I think can be useful for all: (1) can this script still run without an internet connection? If yes, it would be nice to have a validation wherein the script will check if there is an internet connection. If there is none, the weather details will not be displayed but the widget will still continue to display. (2) ceiling/maximum number of both reminders and events that can be displayed on the widget. I know there is an option wherein we could modify the number of events displayed and number of lists displayed seperately, but those constants will not always be the case. I think it will be more useful if there is total number of displayed events and list that could limit what will be displayed so that it won’t cause the display on the widget to go overboard.

2

u/mzeryck Nov 11 '20

Thanks for these suggestions! For (1), I think it might be a bit difficult but I could look into it (feel free to add an issue on the GitHub). And for (2), I am hoping to add a combined reminders/events item, rather than having them be separate, which would solve this issue!

1

u/[deleted] Nov 19 '20

I know this is an older thread, but is there a way to include the battery for the Apple Watch in the widget?

1

u/mzeryck Nov 21 '20

I wish there was, but it's not possible in Scriptable right now.

3

u/[deleted] Nov 02 '20

thank you so much! this is amazing

1

u/Nims020 Nov 02 '20

This is amazing!! Gives iOS 7 vibes

1

u/arcangel_06 Nov 02 '20

Absolutely amazing... wow!

1

u/yung40oz84 Nov 02 '20

This is awesome! Thanks!

1

u/[deleted] Nov 02 '20

https://i.imgur.com/G2G5RPO.jpg Um mate why is it like this?

1

u/weavemat Nov 02 '20

After seeing the amazing work done using this app, I really wish I understood how to use it.

1

u/hunt4some71 Nov 02 '20

iOS 7 vibes

1

u/Jelbb Nov 04 '20

How can I reset the image? I clicked on medium size image when I should have picked large

2

u/Jelbb Nov 04 '20 edited Nov 05 '20

nevermind just saw the setting at the top

1

u/[deleted] Dec 19 '20

This will be what motivates me to learn how to code... Jesus it's beautiful...

1

u/[deleted] Jan 12 '21

Is it possible to select units(imperial or metric)?

1

u/astrologyisracist Jan 28 '21

It doesn’t seem like the time is updating accurately, sometimes falling way behind. Any way I can fix this? TIA!

1

u/mikedeuce Jan 30 '21

Hi /u/mzeryck, I tried using the transparent effect and it exports a cropped version of my wallpaper without any effect. I know this post is old now, but just wondering if you could help? Thanks!

0

u/[deleted] Nov 02 '20

[deleted]

4

u/mzeryck Nov 02 '20

That's awesome to hear, it's definitely a fun way to mess around with code! And yes, that's been on my list - hoping this week is slightly less busy for me so I can work on it.