Blur effect behind window

(Jonas Whale) #1

I’m on a new project in Xcode.
I’dt like to add a blur effect behind the main window.

After a couple of hours spent on it, I found this Swift snippet on Github but I’m not able to convert it to AppleScriptObjC.
Can someone help me on this?

//  AppDelegate.swift
//  Swift Window Blur
//  Created by Lee Brimelow on 6/3/14.
//  Copyright (c) 2014 Lee Brimelow. All rights reserved.
import Cocoa

class AppDelegate: NSObject, NSApplicationDelegate {
    @IBOutlet var window: NSWindow
    // define the visual effect view
    var blurryView = NSVisualEffectView(frame: NSRect(x: 0, y: 0, width: 800, height: 600))

    func applicationDidFinishLaunching(aNotification: NSNotification?) {
        // this is default value but is here for clarity
        blurryView.blendingMode = NSVisualEffectBlendingMode.BehindWindow
        // set the background to always be the dark blur
        blurryView.material = NSVisualEffectMaterial.Dark
        // set it to always be blurry regardless of window state
        blurryView.state = NSVisualEffectState.Active

    func applicationWillTerminate(aNotification: NSNotification?) {
        // Insert code here to tear down your application


(Shane Stanley) #2

Why do it in code? Just drag a Visual Effect View into the .xib view and set its properties in the Attributes inspector. Position it so that it’s a subview of the window’s content view, and the rest of the items are subviews of it.

(Jonas Whale) #3

Because I don’t get it.

Here are my settings:

All I get is a transparent window with no blur effect behind.

(Shane Stanley) #4

Click on the Attributes inspector (fourth icon from the left) to change the settings. But you won’t actually see the result until you run the app.

(Shane Stanley) #5

Also see the message in your console — you can throw that old Quark osax out.

(Jonas Whale) #6

If by run you mean press the keys command+R, I did it a hundred of times.
Here is wat I get:
capture 001

I saw this message.
I thought this Osax was installed and needed by the 2015 QuarkXpress version…

(Jonas Whale) #7

Really, I don’t understand.
Here are my settings for the Attributes inspector.
But the window stays opaque if I don’t set the window’s alphaValue.
If I do, the window is transparent but there’s no blur effect.

capture 001

(Shane Stanley) #8

I suspect you’re looking for more effect than it provides – it’s meant to be a very subtle appearance. You shouldn’t be giving it a Core Animation Layer or fiddling with its alpha – it’s meant to be self-contained.

(Shane Stanley) #9

Try removing it and see. The message says it’s not being loaded, so it’s hard to see how it could be doing anything.