<commit_before>import os

def fixup_window():
    from Cocoa import NSApplication, NSWindow, NSImageView, NSImage, NSRect, NSColor

    app = NSApplication.sharedApplication()

    screen_window = app.windows()[0]

    screen_window.setStyleMask_(0)
    screen_window.setHasShadow_(False)

    # screen_window.setMovableByWindowBackground_(True)

    rect = NSRect()
    rect.size.width = 482
    rect.size.height = 333

    image_window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(
        rect, 
        1+2+4+32768,
        2,
        False)

    view = NSImageView.alloc().init()
    image = NSImage.alloc().initWithContentsOfFile_(os.path.join(os.path.dirname(__file__), 'bot.png'))

    view.setImage_(image)
    image_window.setContentView_(view)
    image_window.setOpaque_(False)
    image_window.setAlphaValue_(1.0)
    image_window.setBackgroundColor_(NSColor.clearColor())
    image_window.setHasShadow_(True)
    # image_window.setMovable_(True)
    image_window.setMovableByWindowBackground_(True)
    
    image_window.setTitlebarAppearsTransparent_(True)
    image_window.makeKeyAndOrderFront_(None)

    image_window.addChildWindow_ordered_(screen_window, 1)

    frame = screen_window.frame()
    frame.origin = image_window.frame().origin
    frame.origin.x += 64
    frame.origin.y += 65
    screen_window.setFrame_display_(frame, False)
<commit_msg>Close simulator when window is closed<commit_after>import os

def fixup_window():
    from Cocoa import NSApplication, NSWindow, NSImageView, NSImage, NSRect, NSColor

    app = NSApplication.sharedApplication()

    screen_window = app.windows()[0]

    screen_window.setStyleMask_(0)
    screen_window.setHasShadow_(False)

    # screen_window.setMovableByWindowBackground_(True)

    rect = NSRect()
    rect.size.width = 482
    rect.size.height = 333

    image_window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(
        rect, 
        1+2+4+32768,
        2,
        False)

    view = NSImageView.alloc().init()
    image = NSImage.alloc().initWithContentsOfFile_(os.path.join(os.path.dirname(__file__), 'bot.png'))

    view.setImage_(image)
    image_window.setContentView_(view)
    image_window.setOpaque_(False)
    image_window.setAlphaValue_(1.0)
    image_window.setBackgroundColor_(NSColor.clearColor())
    image_window.setHasShadow_(True)
    # image_window.setMovable_(True)
    image_window.setMovableByWindowBackground_(True)
    
    image_window.setTitlebarAppearsTransparent_(True)
    image_window.makeKeyAndOrderFront_(None)

    image_window.addChildWindow_ordered_(screen_window, 1)

    frame = screen_window.frame()
    frame.origin = image_window.frame().origin
    frame.origin.x += 64
    frame.origin.y += 65
    screen_window.setFrame_display_(frame, False)
    
    from Cocoa import NSNotificationCenter
    
    def window_did_close(notification):
        app.terminate_(None)

    NSNotificationCenter.defaultCenter().addObserverForName_object_queue_usingBlock_(
        "NSWindowDidCloseNotification",
        image_window,
        None,
        window_did_close)

{'fraction_non_alphanumeric': 0.09534510433386838, 'fraction_numerical': 0.015409309791332263, 'mean_word_length': 3.89937106918239, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4676445', 'n_tokens_mistral': 1016, 'n_tokens_neox': 950, 'n_words': 135}