Commit 8262d620 authored by Annika Backstrom's avatar Annika Backstrom

Initial commit

parents
# Created by http://www.gitignore.io
### Xcode ###
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.xcuserstate
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:BrowserSwitcher.xcodeproj">
</FileRef>
</Workspace>
//
// BSAppDelegate.h
// BrowserSwitcher
//
// Created by Annika Backstrom on 2014-08-27.
// Copyright (c) 2014 Annika Backstrom. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface BSAppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (readwrite, retain) IBOutlet NSMenu *menu;
@property (readwrite, retain) IBOutlet NSStatusItem *statusItem;
- (IBAction)menuAction:(id)sender;
@end
//
// BSAppDelegate.m
// BrowserSwitcher
//
// Created by Annika Backstrom on 2014-08-27.
// Copyright (c) 2014 Annika Backstrom. All rights reserved.
//
#import "BSAppDelegate.h"
@implementation BSAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
}
- (void)awakeFromNib
{
self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
self.statusItem.menu = self.menu;
self.statusItem.title = @"Browser";
self.statusItem.highlightMode = YES;
NSArray *identifiers = [self getHandlerBundleIdentifiers];
NSString *defaultHandler = [self getDefaultHandler];
for (NSString *identifier in identifiers) {
NSLog(@"Adding %@", identifier);
NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:identifier
action:@selector(handleBrowserSelect)
keyEquivalent:@""];
if ([identifier isEqual:defaultHandler])
{
menuItem.state = NSOnState;
}
[self.menu insertItem:menuItem atIndex:0];
}
}
- (void)handleBrowserSelect
{
NSLog(@"handleBrowserSelect");
}
- (NSArray *)getHandlerBundleIdentifiers
{
NSMutableArray *identifiers = [[NSMutableArray alloc] init];
CFArrayRef httpHandlers = LSCopyAllHandlersForURLScheme(CFSTR("https"));
CFIndex handlerCount = CFArrayGetCount(httpHandlers);
CFStringRef bundleIdentifier;
for (int i = 0; i < handlerCount; i++) {
bundleIdentifier = CFArrayGetValueAtIndex(httpHandlers, i);
[identifiers addObject:[NSString stringWithString:(__bridge NSString *)bundleIdentifier]];
CFRelease(bundleIdentifier);
}
return identifiers;
}
- (NSString *)getDefaultHandler
{
CFStringRef httpHandler = LSCopyDefaultHandlerForURLScheme(CFSTR("https"));
return (__bridge NSString *)httpHandler;
}
- (void)menuAction:(id)sender
{
NSLog(@"Menu");
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
</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"/>
<customObject id="Voe-Tx-rLC" customClass="BSAppDelegate">
<connections>
<outlet property="menu" destination="oId-f6-uWN" id="Fbf-YC-Llx"/>
</connections>
</customObject>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu id="oId-f6-uWN" userLabel="BrowserMenu">
<items>
<menuItem isSeparatorItem="YES" id="ANO-ir-UyU"/>
<menuItem title="Quit" id="571-2x-S6k">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="terminate:" target="-3" id="zvx-7P-eUm"/>
</connections>
</menuItem>
</items>
</menu>
</objects>
</document>
<?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>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.sixohthree.${PRODUCT_NAME:rfc1034identifier}</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.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</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 © 2014 Annika Backstrom. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw9840\paperh8400
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\f0\b\fs24 \cf0 Engineering:
\b0 \
Some people\
\
\b Human Interface Design:
\b0 \
Some other people\
\
\b Testing:
\b0 \
Hopefully not nobody\
\
\b Documentation:
\b0 \
Whoever\
\
\b With special thanks to:
\b0 \
Mom\
}
/* Localized versions of Info.plist keys */
//
// main.m
// BrowserSwitcher
//
// Created by Annika Backstrom on 2014-08-27.
// Copyright (c) 2014 Annika Backstrom. All rights reserved.
//
#import <Cocoa/Cocoa.h>
int main(int argc, const char * argv[])
{
return NSApplicationMain(argc, argv);
}
<?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>com.sixohthree.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
//
// BrowserSwitcherTests.m
// BrowserSwitcherTests
//
// Created by Annika Backstrom on 2014-08-27.
// Copyright (c) 2014 Annika Backstrom. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface BrowserSwitcherTests : XCTestCase
@end
@implementation BrowserSwitcherTests
- (void)setUp
{
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample
{
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
}
@end
/* Localized versions of Info.plist keys */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment