Full Code of leonspok/Menubar-Toggle for AI

master 26360c146628 cached
24 files
35.5 KB
11.3k tokens
1 requests
Download .txt
Repository: leonspok/Menubar-Toggle
Branch: master
Commit: 26360c146628
Files: 24
Total size: 35.5 KB

Directory structure:
gitextract_izodftd0/

├── .gitignore
├── DMG/
│   ├── AppIcon.icns
│   └── manifest.json
├── LICENSE
├── Menubar Toggle/
│   ├── Menubar Toggle/
│   │   ├── AppDelegate.h
│   │   ├── AppDelegate.m
│   │   ├── Assets.xcassets/
│   │   │   ├── AppIcon.appiconset/
│   │   │   │   └── Contents.json
│   │   │   ├── Contents.json
│   │   │   ├── menubarLogoDarkThemeEnabled.imageset/
│   │   │   │   └── Contents.json
│   │   │   └── menubarLogoLightThemeEnabled.imageset/
│   │   │       └── Contents.json
│   │   ├── Base.lproj/
│   │   │   └── MainMenu.xib
│   │   ├── Info.plist
│   │   ├── LPWallpaperObserver.h
│   │   ├── LPWallpaperObserver.m
│   │   ├── Menubar Toggle.entitlements
│   │   ├── NSImage+Luminance.h
│   │   ├── NSImage+Luminance.m
│   │   ├── change_theme.txt
│   │   ├── get_theme.txt
│   │   └── main.m
│   └── Menubar Toggle.xcodeproj/
│       ├── project.pbxproj
│       └── project.xcworkspace/
│           └── contents.xcworkspacedata
├── README.md
└── toggle.sketch

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
#Pods/


================================================
FILE: DMG/manifest.json
================================================
{
  "title": "Menubar Toggle",
  "icon": "AppIcon.icns",
  "background": "background.png",
  "icon-size": 80,
  "contents": [
    { "x": 304, "y": 140, "type": "link", "path": "/Applications" },
    { "x": 100, "y": 140, "type": "file", "path": "Menubar Toggle.app" }
  ]
}

================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2015 Savelev Igor

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



================================================
FILE: Menubar Toggle/Menubar Toggle/AppDelegate.h
================================================
//
//  AppDelegate.h
//  Menubar Toggle
//
//  Created by Игорь Савельев on 27/09/15.
//  Copyright © 2015 Leonspok. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface AppDelegate : NSObject <NSApplicationDelegate>


@end



================================================
FILE: Menubar Toggle/Menubar Toggle/AppDelegate.m
================================================
//
//  AppDelegate.m
//  Menubar Toggle
//
//  Created by Игорь Савельев on 27/09/15.
//  Copyright © 2015 Leonspok. All rights reserved.
//

#import "AppDelegate.h"
#import "LPWallpaperObserver.h"

@interface AppDelegate ()
@property (strong, nonatomic) NSStatusItem *statusItem;
@property (weak) IBOutlet NSMenu *menu;
@property (weak) IBOutlet NSMenuItem *enabledItem;
@property (weak) IBOutlet NSMenuItem *infoItem;
@property (weak) IBOutlet NSMenuItem *startAtLoginItem;
@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    [self enableStatusItem];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setMenuBarDarkThemeLogo) name:kThemeChangedToDarkNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setMenuBarLightThemeLogo) name:kThemeChangedToLightNotification object:nil];
}

- (void)enableStatusItem {
    [self hideIcon:self];
    
    _statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
    _statusItem.title = @"";
    _statusItem.toolTip = @"Menubar Toggle";
    _statusItem.menu = self.menu;
    _statusItem.menu.autoenablesItems = NO;
    
    if ([[LPWallpaperObserver sharedObserver] isDarkModeEnabled]) {
        [self setMenuBarDarkThemeLogo];
    } else {
        [self setMenuBarLightThemeLogo];
    }
    
    [self.infoItem setTitle:[NSString stringWithFormat:@"ver %@ (Build %@)", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]]];
    
    [self.enabledItem setState:[LPWallpaperObserver sharedObserver].autoSwithOSXTheme? NSOnState : NSOffState];
    [self.startAtLoginItem setState:[self willStartAtLogin]? NSOnState : NSOffState];
}

- (void)applicationWillBecomeActive:(NSNotification *)notification {
    [self enableStatusItem];
}

- (void)applicationWillTerminate:(NSNotification *)aNotification {
    // Insert code here to tear down your application
}

- (void)setMenuBarDarkThemeLogo {
    NSImage *menuBarLogo = [NSImage imageNamed:@"menubarLogoDarkThemeEnabled"];
    [menuBarLogo setTemplate:YES];
    _statusItem.image = menuBarLogo;
}

- (void)setMenuBarLightThemeLogo {
    NSImage *menuBarLogo = [NSImage imageNamed:@"menubarLogoLightThemeEnabled"];
    [menuBarLogo setTemplate:YES];
    _statusItem.image = menuBarLogo;
}

- (IBAction)toggleEnabled:(id)sender {
    [[LPWallpaperObserver sharedObserver] setAutoSwithOSXTheme:![LPWallpaperObserver sharedObserver].autoSwithOSXTheme];
    [self.enabledItem setState:[LPWallpaperObserver sharedObserver].autoSwithOSXTheme? NSOnState : NSOffState];
}

- (BOOL)willStartAtLogin {
    BOOL foundIt = NO;
    LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
    if (loginItems) {
        UInt32 seed = 0U;
        NSArray *currentLoginItems = (__bridge NSArray *)(LSSharedFileListCopySnapshot(loginItems, &seed));
        for (id itemObject in currentLoginItems) {
            LSSharedFileListItemRef item = (__bridge LSSharedFileListItemRef)itemObject;
            
            UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes;
            NSURL *URL = (__bridge NSURL *)(LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, NULL));
            foundIt = [URL isEqual:[[NSBundle mainBundle] bundleURL]];
            if (foundIt) {
                break;
            }
        }
        CFRelease(loginItems);
    }
    return foundIt;
}

- (IBAction)toggleStartAtLogin:(id)sender {
    LSSharedFileListItemRef existingItem = NULL;
    LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
    if (loginItems) {
        UInt32 seed = 0U;
        NSArray *currentLoginItems = (__bridge NSArray *)(LSSharedFileListCopySnapshot(loginItems, &seed));
        for (id itemObject in currentLoginItems) {
            LSSharedFileListItemRef item = (__bridge LSSharedFileListItemRef)itemObject;
            
            UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes;
            NSURL *URL = (__bridge NSURL *)(LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, NULL));
            BOOL foundIt = [URL isEqual:[[NSBundle mainBundle] bundleURL]];
            if (foundIt) {
                existingItem = item;
                break;
            }
        }
        
        if (existingItem != NULL) {
            LSSharedFileListItemRemove(loginItems, existingItem);
        } else {
            LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst,
                                          NULL, NULL, (__bridge CFURLRef)[[NSBundle mainBundle] bundleURL], NULL, NULL);
        }
        
        CFRelease(loginItems);
    }
    
    [self.startAtLoginItem setState:[self willStartAtLogin]? NSOnState : NSOffState];
}

- (IBAction)hideIcon:(id)sender {
    if (!_statusItem) {
        return;
    }
    [[NSStatusBar systemStatusBar] removeStatusItem:_statusItem];
    _statusItem = nil;
}

@end


================================================
FILE: Menubar Toggle/Menubar Toggle/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
  "images" : [
    {
      "size" : "16x16",
      "idiom" : "mac",
      "filename" : "1024@16pt.png",
      "scale" : "1x"
    },
    {
      "size" : "16x16",
      "idiom" : "mac",
      "filename" : "1024@16pt@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "32x32",
      "idiom" : "mac",
      "filename" : "1024@32pt.png",
      "scale" : "1x"
    },
    {
      "size" : "32x32",
      "idiom" : "mac",
      "filename" : "1024@32pt@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "128x128",
      "idiom" : "mac",
      "filename" : "1024@128pt.png",
      "scale" : "1x"
    },
    {
      "size" : "128x128",
      "idiom" : "mac",
      "filename" : "1024@128pt@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "256x256",
      "idiom" : "mac",
      "filename" : "1024@256pt.png",
      "scale" : "1x"
    },
    {
      "size" : "256x256",
      "idiom" : "mac",
      "filename" : "1024@256pt@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "512x512",
      "idiom" : "mac",
      "filename" : "1024@512pt.png",
      "scale" : "1x"
    },
    {
      "size" : "512x512",
      "idiom" : "mac",
      "filename" : "1024@512pt@2x.png",
      "scale" : "2x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: Menubar Toggle/Menubar Toggle/Assets.xcassets/Contents.json
================================================
{
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: Menubar Toggle/Menubar Toggle/Assets.xcassets/menubarLogoDarkThemeEnabled.imageset/Contents.json
================================================
{
  "images" : [
    {
      "idiom" : "universal",
      "filename" : "menubarLogoDarkThemeEnabled.pdf"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: Menubar Toggle/Menubar Toggle/Assets.xcassets/menubarLogoLightThemeEnabled.imageset/Contents.json
================================================
{
  "images" : [
    {
      "idiom" : "universal",
      "filename" : "menubarLogoLightThemeEnabled.pdf"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: Menubar Toggle/Menubar Toggle/Base.lproj/MainMenu.xib
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
    </dependencies>
    <objects>
        <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
            <connections>
                <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
            </connections>
        </customObject>
        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
        <customObject id="Voe-Tx-rLC" customClass="AppDelegate">
            <connections>
                <outlet property="enabledItem" destination="ehm-2n-Gqg" id="GnF-Ml-Q1b"/>
                <outlet property="infoItem" destination="ho1-Mh-Ull" id="Jve-ox-X7S"/>
                <outlet property="menu" destination="18z-eI-EEx" id="WbT-TC-1Kg"/>
                <outlet property="startAtLoginItem" destination="aVr-cq-85D" id="CCJ-g5-HpU"/>
            </connections>
        </customObject>
        <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
        <menu id="18z-eI-EEx">
            <items>
                <menuItem title="Enabled" id="ehm-2n-Gqg">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <connections>
                        <action selector="toggleEnabled:" target="Voe-Tx-rLC" id="j9v-6h-AWD"/>
                    </connections>
                </menuItem>
                <menuItem title="Start at login" id="aVr-cq-85D">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <connections>
                        <action selector="toggleStartAtLogin:" target="Voe-Tx-rLC" id="hPi-io-6TG"/>
                    </connections>
                </menuItem>
                <menuItem title="Hide icon" id="BbI-1l-EGq">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <connections>
                        <action selector="hideIcon:" target="Voe-Tx-rLC" id="wY0-th-8BX"/>
                    </connections>
                </menuItem>
                <menuItem isSeparatorItem="YES" id="ClW-FU-OJg"/>
                <menuItem title="ver 1.0 (Build 1003)" enabled="NO" id="ho1-Mh-Ull">
                    <modifierMask key="keyEquivalentModifierMask"/>
                </menuItem>
                <menuItem title="Quit" id="EA5-RA-6Jq">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <connections>
                        <action selector="terminate:" target="-1" id="Kwd-XN-Hrf"/>
                    </connections>
                </menuItem>
            </items>
            <point key="canvasLocation" x="40" y="287.5"/>
        </menu>
    </objects>
</document>


================================================
FILE: Menubar Toggle/Menubar Toggle/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.1</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>1100</string>
	<key>LSApplicationCategoryType</key>
	<string>public.app-category.utilities</string>
	<key>LSMinimumSystemVersion</key>
	<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
	<key>LSUIElement</key>
	<true/>
	<key>NSHumanReadableCopyright</key>
	<string>Copyright © 2015 Leonspok. All rights reserved.</string>
	<key>NSMainNibFile</key>
	<string>MainMenu</string>
	<key>NSPrincipalClass</key>
	<string>NSApplication</string>
</dict>
</plist>


================================================
FILE: Menubar Toggle/Menubar Toggle/LPWallpaperObserver.h
================================================
//
//  LPWallpaperObserver.h
//  Menubar Toggle
//
//  Created by Игорь Савельев on 27/09/15.
//  Copyright © 2015 Leonspok. All rights reserved.
//

#import <Foundation/Foundation.h>

extern NSString *const kThemeChangedToDarkNotification;
extern NSString *const kThemeChangedToLightNotification;

@interface LPWallpaperObserver : NSObject

@property (nonatomic, assign) BOOL autoSwithOSXTheme;
@property (nonatomic, assign, readonly, getter=isDarkModeEnabled) BOOL darkModeEnabled;

+ (instancetype)sharedObserver;

- (void)setSuitableThemeIfNeeded;
- (void)resetTheme;

@end


================================================
FILE: Menubar Toggle/Menubar Toggle/LPWallpaperObserver.m
================================================
//
//  LPWallpaperObserver.m
//  Menubar Toggle
//
//  Created by Игорь Савельев on 27/09/15.
//  Copyright © 2015 Leonspok. All rights reserved.
//

#import "LPWallpaperObserver.h"
#import "NSImage+Luminance.h"

@import AppKit;

NSString *const kThemeChangedToDarkNotification = @"ThemeChangedToDarkNotification";
NSString *const kThemeChangedToLightNotification = @"ThemeChangedToLightNotification";

static NSString *const kAutoSwithOSXThemeKey = @"autoSwithOSXTheme";
static NSString *const kImagesLuminanceInfoPlistFileName = @"imagesLuminance.plist";

@implementation LPWallpaperObserver {
    NSString *applicationSupportFolder;
    NSTimer *observingTimer;
}

+ (instancetype)sharedObserver {
    static LPWallpaperObserver *__sharedObserver = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        __sharedObserver = [[LPWallpaperObserver alloc] init];
    });
    return __sharedObserver;
}

- (id)init {
    self = [super init];
    if (self) {
        [self updatePaths];
        
        if (self.autoSwithOSXTheme) {
            [self setAutoSwithOSXTheme:self.autoSwithOSXTheme];
        }
    }
    return self;
}

- (void)updatePaths {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
    applicationSupportFolder = [[paths firstObject] stringByAppendingPathComponent:@"Menubar Toggle"];
    
    if (![[NSFileManager defaultManager] fileExistsAtPath:applicationSupportFolder]) {
        [[NSFileManager defaultManager] createDirectoryAtPath:applicationSupportFolder withIntermediateDirectories:YES attributes:nil error:nil];
    }
}

#pragma mark Getters and Setters

- (BOOL)autoSwithOSXTheme {
    if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) {
        return NO;
    }
    
    return [[NSUserDefaults standardUserDefaults] boolForKey:kAutoSwithOSXThemeKey];
}

- (void)setAutoSwithOSXTheme:(BOOL)autoSwithOSXTheme {
    if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) {
        autoSwithOSXTheme = NO;
    }
    
    [[NSUserDefaults standardUserDefaults] setBool:autoSwithOSXTheme forKey:kAutoSwithOSXThemeKey];
    [[NSUserDefaults standardUserDefaults] synchronize];
    
    if (!autoSwithOSXTheme) {
        [self resetTheme];
        [observingTimer invalidate];
        observingTimer = nil;
    } else {
        [self setSuitableThemeIfNeeded];
        dispatch_async(dispatch_get_main_queue(), ^{
            observingTimer = [NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(setSuitableThemeIfNeeded) userInfo:nil repeats:YES];
        });
    }
}

- (BOOL)isDarkModeEnabled {
	NSAppleScript *script = [[NSAppleScript alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"get_theme" withExtension:@"txt"] error:nil];
	NSAppleEventDescriptor *dsc = [script executeAndReturnError:nil];
	return dsc.booleanValue;
}

- (void)resetTheme {
	[self setDarkTheme:NO];
}

#pragma mark Wallpapers Observing

- (BOOL)themeShouldBeDark {
    CGFloat averageLuminance = 0.0f;
    for (NSScreen *screen in [NSScreen screens]) {
        NSString *path = [[[NSWorkspace sharedWorkspace] desktopImageURLForScreen:screen] path];
        averageLuminance += [self luminanceForImageWithPath:path];
    }
    if ([NSScreen screens].count > 0) {
        averageLuminance = averageLuminance/[NSScreen screens].count;
    }
    return averageLuminance < 0.375;
}

- (void)setDarkTheme:(BOOL)dark {
	NSString *scriptSource = [[NSString alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"change_theme" withExtension:@"txt"] encoding:NSUTF8StringEncoding error:nil];
	scriptSource = [scriptSource stringByReplacingOccurrencesOfString:@"<mode>" withString:(dark? @"true" : @"false")];
	NSAppleScript *script = [[NSAppleScript alloc] initWithSource:scriptSource];
	[script executeAndReturnError:nil];
	dispatch_async(dispatch_get_main_queue(), ^{
		if (dark) {
			[[NSNotificationCenter defaultCenter] postNotificationName:kThemeChangedToDarkNotification object:nil];
		} else {
			[[NSNotificationCenter defaultCenter] postNotificationName:kThemeChangedToLightNotification object:nil];
		}
	});
}

- (void)setSuitableThemeIfNeeded {
    if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) {
        return;
    }
    
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
        BOOL shouldBeDark = [self themeShouldBeDark];
        BOOL darkModeEnabled = [self isDarkModeEnabled];
        if (shouldBeDark != darkModeEnabled) {
            dispatch_async(dispatch_get_main_queue(), ^{
                [self setDarkTheme:shouldBeDark];
            });
        }
    });
}

#pragma mark Images Managing

- (CGFloat)luminanceForImageWithPath:(NSString *)path {
    NSString *plistFilePath = [applicationSupportFolder stringByAppendingPathComponent:kImagesLuminanceInfoPlistFileName];
    NSMutableDictionary *info = [[NSMutableDictionary alloc] initWithContentsOfFile:plistFilePath];
    
    if ([info objectForKey:path]) {
        return [[info objectForKey:path] doubleValue];
    }
    
    if (!info) {
        info = [NSMutableDictionary dictionary];
    }
    
    NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
    if (image) {
        CGFloat luminance = image.luminance;
        [info setObject:@(luminance) forKey:path];
        [info writeToFile:plistFilePath atomically:YES];
        return luminance;
    } else {
        return 0.5f;
    }
}

@end


================================================
FILE: Menubar Toggle/Menubar Toggle/Menubar Toggle.entitlements
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>


================================================
FILE: Menubar Toggle/Menubar Toggle/NSImage+Luminance.h
================================================
//
//  NSImage+Luminance.h
//  Unsplash Wallpaper
//
//  Created by Игорь Савельев on 06/06/15.
//  Copyright (c) 2015 Leonspok. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface NSImage (Luminance)

@property (nonatomic, readonly) CGFloat luminance;

@end


================================================
FILE: Menubar Toggle/Menubar Toggle/NSImage+Luminance.m
================================================
//
//  NSImage+Luminance.m
//  Unsplash Wallpaper
//
//  Created by Игорь Савельев on 06/06/15.
//  Copyright (c) 2015 Leonspok. All rights reserved.
//

#import "NSImage+Luminance.h"
#import <objc/runtime.h>

static NSString *const kCalculatedLuminanceKey = @"CALCULATED LUMINANCE";

@implementation NSImage (Luminance) 

- (NSBitmapImageRep *)bitmapImageRepresentation {
    int width = [self size].width;
    int height = [self size].height;
    
    if(width < 1 || height < 1) {
        return nil;
    }
    
    NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]
                             initWithBitmapDataPlanes:NULL
                             pixelsWide:width
                             pixelsHigh:height
                             bitsPerSample:8
                             samplesPerPixel:4
                             hasAlpha:YES
                             isPlanar:NO
                             colorSpaceName:NSDeviceRGBColorSpace
                             bytesPerRow:(width * 4)
                             bitsPerPixel:32];
    
    NSGraphicsContext *ctx = [NSGraphicsContext graphicsContextWithBitmapImageRep:rep];
    [NSGraphicsContext saveGraphicsState];
    [NSGraphicsContext setCurrentContext:ctx];
    [self drawAtPoint:NSZeroPoint
             fromRect:NSZeroRect
            operation:NSCompositeCopy fraction:1.0];
    [ctx flushGraphics];
    [NSGraphicsContext restoreGraphicsState];
    
    return rep;
}

- (CGFloat)luminance {
    NSNumber *lum = objc_getAssociatedObject(self, &kCalculatedLuminanceKey);
    if (lum) {
        return [lum doubleValue];
    }
    
    NSBitmapImageRep *rep = [self bitmapImageRepresentation];
    
    int width = [self size].width;
    int height = [self size].height;
    
    CGFloat totalLuminance = 0;
    CGFloat r;
    CGFloat g;
    CGFloat b;
    NSColor *color;
    NSInteger n = 0;
    for (NSInteger i = 0; i < height; i+=10) {
        for (NSInteger j = 0; j < width; j+=10) {
            color = [rep colorAtX:j y:i];
            [color getRed:&r green:&g blue:&b alpha:NULL];
            CGFloat luminance = (0.299*r + 0.587*g + 0.114*b);
            totalLuminance += luminance;
            n++;
        }
    }
    CGFloat averageLuminance = totalLuminance/n;
    
    objc_setAssociatedObject(self, &kCalculatedLuminanceKey, @(averageLuminance), OBJC_ASSOCIATION_RETAIN);
    return averageLuminance;
}

@end


================================================
FILE: Menubar Toggle/Menubar Toggle/change_theme.txt
================================================
tell application "System Events"
	tell appearance preferences to set dark mode to <mode>
end tell


================================================
FILE: Menubar Toggle/Menubar Toggle/get_theme.txt
================================================
tell application "System Events"
	tell appearance preferences to get dark mode
end tell


================================================
FILE: Menubar Toggle/Menubar Toggle/main.m
================================================
//
//  main.m
//  Menubar Toggle
//
//  Created by Игорь Савельев on 27/09/15.
//  Copyright © 2015 Leonspok. All rights reserved.
//

#import <Cocoa/Cocoa.h>

int main(int argc, const char * argv[]) {
    return NSApplicationMain(argc, argv);
}


================================================
FILE: Menubar Toggle/Menubar Toggle.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {

/* Begin PBXBuildFile section */
		E39CF8221BB805CE0036A8E8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E39CF8211BB805CE0036A8E8 /* AppDelegate.m */; };
		E39CF8251BB805CE0036A8E8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E39CF8241BB805CE0036A8E8 /* main.m */; };
		E39CF8271BB805CE0036A8E8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E39CF8261BB805CE0036A8E8 /* Assets.xcassets */; };
		E39CF82A1BB805CE0036A8E8 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E39CF8281BB805CE0036A8E8 /* MainMenu.xib */; };
		E39CF8361BB826B60036A8E8 /* NSImage+Luminance.m in Sources */ = {isa = PBXBuildFile; fileRef = E39CF8351BB826B60036A8E8 /* NSImage+Luminance.m */; };
		E39CF8391BB82B3E0036A8E8 /* LPWallpaperObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = E39CF8381BB82B3E0036A8E8 /* LPWallpaperObserver.m */; };
		E3CBFB521E11224B004D51A6 /* change_theme.txt in Resources */ = {isa = PBXBuildFile; fileRef = E3CBFB511E11224B004D51A6 /* change_theme.txt */; };
		E3CBFB541E11227D004D51A6 /* get_theme.txt in Resources */ = {isa = PBXBuildFile; fileRef = E3CBFB531E11227D004D51A6 /* get_theme.txt */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
		E39CF81D1BB805CE0036A8E8 /* Menubar Toggle.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Menubar Toggle.app"; sourceTree = BUILT_PRODUCTS_DIR; };
		E39CF8201BB805CE0036A8E8 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
		E39CF8211BB805CE0036A8E8 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
		E39CF8241BB805CE0036A8E8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
		E39CF8261BB805CE0036A8E8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
		E39CF8291BB805CE0036A8E8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
		E39CF82B1BB805CE0036A8E8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
		E39CF8341BB826B60036A8E8 /* NSImage+Luminance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSImage+Luminance.h"; sourceTree = "<group>"; };
		E39CF8351BB826B60036A8E8 /* NSImage+Luminance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSImage+Luminance.m"; sourceTree = "<group>"; };
		E39CF8371BB82B3E0036A8E8 /* LPWallpaperObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPWallpaperObserver.h; sourceTree = "<group>"; };
		E39CF8381BB82B3E0036A8E8 /* LPWallpaperObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LPWallpaperObserver.m; sourceTree = "<group>"; };
		E39CF83C1BB834E10036A8E8 /* Menubar Toggle.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Menubar Toggle.entitlements"; sourceTree = "<group>"; };
		E3CBFB511E11224B004D51A6 /* change_theme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = change_theme.txt; sourceTree = "<group>"; };
		E3CBFB531E11227D004D51A6 /* get_theme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = get_theme.txt; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		E39CF81A1BB805CE0036A8E8 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
		E39CF8141BB805CE0036A8E8 = {
			isa = PBXGroup;
			children = (
				E39CF81F1BB805CE0036A8E8 /* Menubar Toggle */,
				E39CF81E1BB805CE0036A8E8 /* Products */,
			);
			sourceTree = "<group>";
		};
		E39CF81E1BB805CE0036A8E8 /* Products */ = {
			isa = PBXGroup;
			children = (
				E39CF81D1BB805CE0036A8E8 /* Menubar Toggle.app */,
			);
			name = Products;
			sourceTree = "<group>";
		};
		E39CF81F1BB805CE0036A8E8 /* Menubar Toggle */ = {
			isa = PBXGroup;
			children = (
				E39CF83C1BB834E10036A8E8 /* Menubar Toggle.entitlements */,
				E39CF8341BB826B60036A8E8 /* NSImage+Luminance.h */,
				E39CF8351BB826B60036A8E8 /* NSImage+Luminance.m */,
				E39CF8371BB82B3E0036A8E8 /* LPWallpaperObserver.h */,
				E39CF8381BB82B3E0036A8E8 /* LPWallpaperObserver.m */,
				E39CF8201BB805CE0036A8E8 /* AppDelegate.h */,
				E39CF8211BB805CE0036A8E8 /* AppDelegate.m */,
				E39CF8261BB805CE0036A8E8 /* Assets.xcassets */,
				E39CF8281BB805CE0036A8E8 /* MainMenu.xib */,
				E39CF82B1BB805CE0036A8E8 /* Info.plist */,
				E39CF8231BB805CE0036A8E8 /* Supporting Files */,
				E3CBFB511E11224B004D51A6 /* change_theme.txt */,
				E3CBFB531E11227D004D51A6 /* get_theme.txt */,
			);
			path = "Menubar Toggle";
			sourceTree = "<group>";
		};
		E39CF8231BB805CE0036A8E8 /* Supporting Files */ = {
			isa = PBXGroup;
			children = (
				E39CF8241BB805CE0036A8E8 /* main.m */,
			);
			name = "Supporting Files";
			sourceTree = "<group>";
		};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
		E39CF81C1BB805CE0036A8E8 /* Menubar Toggle */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = E39CF82E1BB805CE0036A8E8 /* Build configuration list for PBXNativeTarget "Menubar Toggle" */;
			buildPhases = (
				E39CF8191BB805CE0036A8E8 /* Sources */,
				E39CF81A1BB805CE0036A8E8 /* Frameworks */,
				E39CF81B1BB805CE0036A8E8 /* Resources */,
			);
			buildRules = (
			);
			dependencies = (
			);
			name = "Menubar Toggle";
			productName = "Menubar Toggle";
			productReference = E39CF81D1BB805CE0036A8E8 /* Menubar Toggle.app */;
			productType = "com.apple.product-type.application";
		};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
		E39CF8151BB805CE0036A8E8 /* Project object */ = {
			isa = PBXProject;
			attributes = {
				LastUpgradeCheck = 0700;
				ORGANIZATIONNAME = Leonspok;
				TargetAttributes = {
					E39CF81C1BB805CE0036A8E8 = {
						CreatedOnToolsVersion = 7.0;
						DevelopmentTeam = 6KXZX3AW22;
						ProvisioningStyle = Automatic;
						SystemCapabilities = {
							com.apple.Sandbox = {
								enabled = 0;
							};
						};
					};
				};
			};
			buildConfigurationList = E39CF8181BB805CE0036A8E8 /* Build configuration list for PBXProject "Menubar Toggle" */;
			compatibilityVersion = "Xcode 3.2";
			developmentRegion = English;
			hasScannedForEncodings = 0;
			knownRegions = (
				en,
				Base,
			);
			mainGroup = E39CF8141BB805CE0036A8E8;
			productRefGroup = E39CF81E1BB805CE0036A8E8 /* Products */;
			projectDirPath = "";
			projectRoot = "";
			targets = (
				E39CF81C1BB805CE0036A8E8 /* Menubar Toggle */,
			);
		};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
		E39CF81B1BB805CE0036A8E8 /* Resources */ = {
			isa = PBXResourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				E3CBFB521E11224B004D51A6 /* change_theme.txt in Resources */,
				E3CBFB541E11227D004D51A6 /* get_theme.txt in Resources */,
				E39CF8271BB805CE0036A8E8 /* Assets.xcassets in Resources */,
				E39CF82A1BB805CE0036A8E8 /* MainMenu.xib in Resources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
		E39CF8191BB805CE0036A8E8 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				E39CF8251BB805CE0036A8E8 /* main.m in Sources */,
				E39CF8391BB82B3E0036A8E8 /* LPWallpaperObserver.m in Sources */,
				E39CF8361BB826B60036A8E8 /* NSImage+Luminance.m in Sources */,
				E39CF8221BB805CE0036A8E8 /* AppDelegate.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
		E39CF8281BB805CE0036A8E8 /* MainMenu.xib */ = {
			isa = PBXVariantGroup;
			children = (
				E39CF8291BB805CE0036A8E8 /* Base */,
			);
			name = MainMenu.xib;
			sourceTree = "<group>";
		};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
		E39CF82C1BB805CE0036A8E8 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				CODE_SIGN_IDENTITY = "-";
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = dwarf;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				ENABLE_TESTABILITY = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_DYNAMIC_NO_PIC = NO;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_OPTIMIZATION_LEVEL = 0;
				GCC_PREPROCESSOR_DEFINITIONS = (
					"DEBUG=1",
					"$(inherited)",
				);
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				MACOSX_DEPLOYMENT_TARGET = 10.10;
				MTL_ENABLE_DEBUG_INFO = YES;
				ONLY_ACTIVE_ARCH = YES;
				SDKROOT = macosx;
			};
			name = Debug;
		};
		E39CF82D1BB805CE0036A8E8 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				CODE_SIGN_IDENTITY = "-";
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
				ENABLE_NS_ASSERTIONS = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				MACOSX_DEPLOYMENT_TARGET = 10.10;
				MTL_ENABLE_DEBUG_INFO = NO;
				SDKROOT = macosx;
			};
			name = Release;
		};
		E39CF82F1BB805CE0036A8E8 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				CODE_SIGN_IDENTITY = "Mac Developer";
				COMBINE_HIDPI_IMAGES = YES;
				DEVELOPMENT_TEAM = 6KXZX3AW22;
				INFOPLIST_FILE = "Menubar Toggle/Info.plist";
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
				MACOSX_DEPLOYMENT_TARGET = 10.10;
				PRODUCT_BUNDLE_IDENTIFIER = "com.leonspok.osx.Menubar-Toggle";
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Debug;
		};
		E39CF8301BB805CE0036A8E8 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				CODE_SIGN_IDENTITY = "Mac Developer";
				COMBINE_HIDPI_IMAGES = YES;
				DEVELOPMENT_TEAM = 6KXZX3AW22;
				INFOPLIST_FILE = "Menubar Toggle/Info.plist";
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
				MACOSX_DEPLOYMENT_TARGET = 10.10;
				PRODUCT_BUNDLE_IDENTIFIER = "com.leonspok.osx.Menubar-Toggle";
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Release;
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
		E39CF8181BB805CE0036A8E8 /* Build configuration list for PBXProject "Menubar Toggle" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				E39CF82C1BB805CE0036A8E8 /* Debug */,
				E39CF82D1BB805CE0036A8E8 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		E39CF82E1BB805CE0036A8E8 /* Build configuration list for PBXNativeTarget "Menubar Toggle" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				E39CF82F1BB805CE0036A8E8 /* Debug */,
				E39CF8301BB805CE0036A8E8 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
/* End XCConfigurationList section */
	};
	rootObject = E39CF8151BB805CE0036A8E8 /* Project object */;
}


================================================
FILE: Menubar Toggle/Menubar Toggle.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
   version = "1.0">
   <FileRef
      location = "self:Menubar Toggle.xcodeproj">
   </FileRef>
</Workspace>


================================================
FILE: README.md
================================================
# Menubar Toggle

<img src="light.png" width=250> <img src="dark.png" width=250>

Dark wallpaper - dark OS X, light wallpaper - light OS X. That's so simple.  

Download Menubar Toggle [here](https://github.com/leonspok/Menubar-Toggle/releases).

***

Folder **/DMG** contains all necessary files to create **.dmg** file with [appdmg](https://github.com/LinusU/node-appdmg).
Download .txt
gitextract_izodftd0/

├── .gitignore
├── DMG/
│   ├── AppIcon.icns
│   └── manifest.json
├── LICENSE
├── Menubar Toggle/
│   ├── Menubar Toggle/
│   │   ├── AppDelegate.h
│   │   ├── AppDelegate.m
│   │   ├── Assets.xcassets/
│   │   │   ├── AppIcon.appiconset/
│   │   │   │   └── Contents.json
│   │   │   ├── Contents.json
│   │   │   ├── menubarLogoDarkThemeEnabled.imageset/
│   │   │   │   └── Contents.json
│   │   │   └── menubarLogoLightThemeEnabled.imageset/
│   │   │       └── Contents.json
│   │   ├── Base.lproj/
│   │   │   └── MainMenu.xib
│   │   ├── Info.plist
│   │   ├── LPWallpaperObserver.h
│   │   ├── LPWallpaperObserver.m
│   │   ├── Menubar Toggle.entitlements
│   │   ├── NSImage+Luminance.h
│   │   ├── NSImage+Luminance.m
│   │   ├── change_theme.txt
│   │   ├── get_theme.txt
│   │   └── main.m
│   └── Menubar Toggle.xcodeproj/
│       ├── project.pbxproj
│       └── project.xcworkspace/
│           └── contents.xcworkspacedata
├── README.md
└── toggle.sketch
Condensed preview — 24 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (41K chars).
[
  {
    "path": ".gitignore",
    "chars": 494,
    "preview": "# Xcode\n#\nbuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!defau"
  },
  {
    "path": "DMG/manifest.json",
    "chars": 273,
    "preview": "{\n  \"title\": \"Menubar Toggle\",\n  \"icon\": \"AppIcon.icns\",\n  \"background\": \"background.png\",\n  \"icon-size\": 80,\n  \"content"
  },
  {
    "path": "LICENSE",
    "chars": 1080,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2015 Savelev Igor\n\nPermission is hereby granted, free of charge, to any person obta"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/AppDelegate.h",
    "chars": 233,
    "preview": "//\n//  AppDelegate.h\n//  Menubar Toggle\n//\n//  Created by Игорь Савельев on 27/09/15.\n//  Copyright © 2015 Leonspok. All"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/AppDelegate.m",
    "chars": 5210,
    "preview": "//\n//  AppDelegate.m\n//  Menubar Toggle\n//\n//  Created by Игорь Савельев on 27/09/15.\n//  Copyright © 2015 Leonspok. All"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "chars": 1284,
    "preview": "{\n  \"images\" : [\n    {\n      \"size\" : \"16x16\",\n      \"idiom\" : \"mac\",\n      \"filename\" : \"1024@16pt.png\",\n      \"scale\" "
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/Assets.xcassets/Contents.json",
    "chars": 62,
    "preview": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/Assets.xcassets/menubarLogoDarkThemeEnabled.imageset/Contents.json",
    "chars": 176,
    "preview": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"menubarLogoDarkThemeEnabled.pdf\"\n    }\n  ],\n  \"i"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/Assets.xcassets/menubarLogoLightThemeEnabled.imageset/Contents.json",
    "chars": 177,
    "preview": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"menubarLogoLightThemeEnabled.pdf\"\n    }\n  ],\n  \""
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/Base.lproj/MainMenu.xib",
    "chars": 3101,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.Cocoa.XIB\" version=\"3"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/Info.plist",
    "chars": 1153,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/LPWallpaperObserver.h",
    "chars": 578,
    "preview": "//\n//  LPWallpaperObserver.h\n//  Menubar Toggle\n//\n//  Created by Игорь Савельев on 27/09/15.\n//  Copyright © 2015 Leons"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/LPWallpaperObserver.m",
    "chars": 5490,
    "preview": "//\n//  LPWallpaperObserver.m\n//  Menubar Toggle\n//\n//  Created by Игорь Савельев on 27/09/15.\n//  Copyright © 2015 Leons"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/Menubar Toggle.entitlements",
    "chars": 181,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/NSImage+Luminance.h",
    "chars": 268,
    "preview": "//\n//  NSImage+Luminance.h\n//  Unsplash Wallpaper\n//\n//  Created by Игорь Савельев on 06/06/15.\n//  Copyright (c) 2015 L"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/NSImage+Luminance.m",
    "chars": 2417,
    "preview": "//\n//  NSImage+Luminance.m\n//  Unsplash Wallpaper\n//\n//  Created by Игорь Савельев on 06/06/15.\n//  Copyright (c) 2015 L"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/change_theme.txt",
    "chars": 98,
    "preview": "tell application \"System Events\"\n\ttell appearance preferences to set dark mode to <mode>\nend tell\n"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/get_theme.txt",
    "chars": 88,
    "preview": "tell application \"System Events\"\n\ttell appearance preferences to get dark mode\nend tell\n"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle/main.m",
    "chars": 246,
    "preview": "//\n//  main.m\n//  Menubar Toggle\n//\n//  Created by Игорь Савельев on 27/09/15.\n//  Copyright © 2015 Leonspok. All rights"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle.xcodeproj/project.pbxproj",
    "chars": 13229,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "Menubar Toggle/Menubar Toggle.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 159,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:Menubar Toggle."
  },
  {
    "path": "README.md",
    "chars": 375,
    "preview": "# Menubar Toggle\n\n<img src=\"light.png\" width=250> <img src=\"dark.png\" width=250>\n\nDark wallpaper - dark OS X, light wall"
  }
]

// ... and 2 more files (download for full content)

About this extraction

This page contains the full source code of the leonspok/Menubar-Toggle GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 24 files (35.5 KB), approximately 11.3k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!