Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
NSAntoine committed Oct 17, 2023
1 parent 84130c5 commit 81c49c4
Show file tree
Hide file tree
Showing 43 changed files with 1,255 additions and 914 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"pins" : [
{
"identity" : "maccontrolcenterui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/NSAntoine/MacControlCenterUI.git",
"state" : {
"branch" : "main",
"revision" : "520159dcb9b4a54a9891725338c93b2fdaf10fbb"
}
},
{
"identity" : "menubarextraaccess",
"kind" : "remoteSourceControl",
"location" : "https://github.com/orchetect/MenuBarExtraAccess",
"state" : {
"revision" : "f5896b47e15e114975897354c7e1082c51a2bffd",
"version" : "1.0.5"
}
}
],
"version" : 2
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?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>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
<array/>
</plist>
77 changes: 77 additions & 0 deletions Artemisia.xcodeproj/xcshareddata/xcschemes/Artemisia.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CEEEBE092ADA7C940087CB1C"
BuildableName = "Artemisia.app"
BlueprintName = "Artemisia"
ReferencedContainer = "container:Artemisia.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CEEEBE092ADA7C940087CB1C"
BuildableName = "Artemisia.app"
BlueprintName = "Artemisia"
ReferencedContainer = "container:Artemisia.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CEEEBE092ADA7C940087CB1C"
BuildableName = "Artemisia.app"
BlueprintName = "Artemisia"
ReferencedContainer = "container:Artemisia.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "B0D7C5F1-F3BC-4664-9FE4-4CCB56CA5BF4"
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@
<dict>
<key>SchemeUserState</key>
<dict>
<key>Artemisia.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>BetterBars.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>CEEEBE092ADA7C940087CB1C</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
20 changes: 20 additions & 0 deletions Artemisia/App/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// AppDelegate.h
// Artemisia
//
// Created by Serena on 14/10/2023.
//

#import <Cocoa/Cocoa.h>
#import "DesktopViewController.h"

@interface AppDelegate : NSObject <NSApplicationDelegate>

@property DesktopViewController *desktopVC;
@property NSStatusItem *statusItem;

+(instancetype)sharedDelegate;


@end

86 changes: 86 additions & 0 deletions Artemisia/App/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
//
// AppDelegate.m
// Artemisia
//
// Created by Serena on 14/10/2023.
//

#import "AppDelegate.h"
#import "EventMonitor.h"
#import "WindowController.h"
#import "DesktopViewController.h"

@implementation AppDelegate

+ (instancetype)sharedDelegate {
static AppDelegate *del;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
del = [[AppDelegate alloc] init];
});

return del;
}


- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
[NSApplication.sharedApplication setActivationPolicy:NSApplicationActivationPolicyAccessory];

[[EventMonitor sharedMonitor] startMonitoring];

WindowController *ctrl = [WindowController controllerWithKind:WindowControllerWindowKindBar];
self.desktopVC = (DesktopViewController *)ctrl.contentViewController;
[ctrl showWindow:self];

self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
self.statusItem.button.image = [NSImage imageWithSystemSymbolName:@"slider.horizontal.below.rectangle" accessibilityDescription:nil];

NSMenu *menu = [[NSMenu alloc] init];
NSMenuItem *itm = [[NSMenuItem alloc] init];
itm.view = [self titleView];
[menu addItem:itm];

[menu addItem: NSMenuItem.separatorItem];
NSMenuItem *quit = [menu addItemWithTitle:@"Quit" action:@selector(terminateApp) keyEquivalent:@"q"];
quit.target = self;

self.statusItem.menu = menu;
}

-(void)terminateApp {
[NSApplication.sharedApplication terminate:nil];
}

-(NSView *)titleView {
NSView *v = [[NSView alloc] init];
[v setFrameSize:CGSizeMake(150, 20)];

NSTextField *titleField = [NSTextField labelWithString: NSRunningApplication.currentApplication.localizedName ];
titleField.translatesAutoresizingMaskIntoConstraints = NO;

titleField.font = [NSFont preferredFontForTextStyle:NSFontTextStyleHeadline options:@{}];

[v addSubview:titleField];

[NSLayoutConstraint activateConstraints:@[
[titleField.topAnchor constraintEqualToAnchor:v.topAnchor constant:2.5],
[titleField.leadingAnchor constraintEqualToAnchor:v.leadingAnchor constant:14]
]];

return v;
}



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


- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app {
return YES;
}


@end
24 changes: 24 additions & 0 deletions Artemisia/App/WindowController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// WindowController.h
// Artemisia
//
// Created by Serena on 14/10/2023.
//

#ifndef WindowController_h
#define WindowController_h

#import <Cocoa/Cocoa.h>

typedef NS_CLOSED_ENUM(NSUInteger, WindowControllerWindowKind) {
WindowControllerWindowKindBar,
};

@interface WindowController : NSWindowController

+(instancetype)controllerWithKind: (WindowControllerWindowKind)kind;

@end


#endif /* WindowController_h */
36 changes: 36 additions & 0 deletions Artemisia/App/WindowController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// WindowController.m
// Artemisia
//
// Created by Serena on 14/10/2023.
//

#import <Foundation/Foundation.h>
#import "DesktopViewController.h"
#import "WindowController.h"

@implementation WindowController
+ (instancetype)controllerWithKind:(WindowControllerWindowKind)kind {
NSViewController *ctrller;

switch (kind) {
case WindowControllerWindowKindBar:
ctrller = [[DesktopViewController alloc] init];
}

NSWindow *window = [NSWindow windowWithContentViewController:ctrller];
WindowController *ret = [[WindowController alloc] initWithWindow:window];

switch (kind) {
case WindowControllerWindowKindBar:
window.styleMask -= NSWindowStyleMaskTitled;
window.backgroundColor = [NSColor clearColor];
// window.level = CGWindowLevelForKey(kCGMaximumWindowLevelKey);
window.level = NSFloatingWindowLevel;
window.collectionBehavior = NSWindowCollectionBehaviorCanJoinAllSpaces;
[window setFrame:NSScreen.mainScreen.visibleFrame display:YES];
}

return ret;
}
@end
6 changes: 5 additions & 1 deletion BetterBars/main.m → Artemisia/App/main.m
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
//
// main.m
// BetterBars
// Artemisia
//
// Created by Serena on 14/10/2023.
//

#import <Cocoa/Cocoa.h>
#import "AppDelegate.h"

int main(int argc, const char * argv[]) {
@autoreleasepool {
// Setup code that might create autoreleased objects goes here.
}

AppDelegate *del = [AppDelegate sharedDelegate];
NSApplication.sharedApplication.delegate = del;
return NSApplicationMain(argc, argv);
}
Loading

0 comments on commit 81c49c4

Please sign in to comment.