def isolateSheet():
    window = NSApp.keyWindow()

    if not window:
        return

    if window.isSheet():
        window = window.sheetParent()

    sheet = window.attachedSheet()

    if not sheet:
        return

    window.endSheet_(sheet)

    blankWindow = NSWindow.new()
    blankWindow.setStyleMask_(NSWindowStyleMaskFullSizeContentView
                              | NSWindowStyleMaskBorderless)
    blankWindow.setFrame_display_(NSZeroRect, True)
    blankWindow.makeKeyAndOrderFront_(None)
    blankWindow.center()
    blankWindow.beginSheet_completionHandler_(sheet, None)
__MenuTitle__ = {
    "de": "​​​​​Fenster transparent machen",
    "en": "​​​​​Make Window Transparent",
}
__MenuDescription__ = {
    "de":
    "Setzt den Alpha-Wert des vordersten Fensters auf 0. Hilfreich, falls Bildschirmfotos von Popover-Fenstern gemacht werden sollen (welche nicht von diesem Skript beeinflusst werden).",
    "en":
    "Sets the alpha value of the frontmost window to 0. Helpful for screenshotting popovers (which are not affected by this script).",
}

from Cocoa import NSApp

NSApp.keyWindow().setAlphaValue_(0)