├── .gitignore
├── DarkModeSwitcher
├── Assets.xcassets
│ ├── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Preview Content
│ └── Preview Assets.xcassets
│ │ └── Contents.json
├── DarkModeSwitcher.entitlements
├── AppInfo.swift
├── AppDelegate.swift
├── Info.plist
├── AppList.swift
├── Defaults.swift
├── AppModel.swift
├── AppScanner.swift
├── ContentView.swift
└── Base.lproj
│ └── Main.storyboard
├── DarkModeSwitcher.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── swiftpm
│ │ └── Package.resolved
└── project.pbxproj
├── WTFPL-LICENSE.txt
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | *.xcuserdatad
3 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/DarkModeSwitcher/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/DarkModeSwitcher.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/DarkModeSwitcher.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/DarkModeSwitcher.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/DarkModeSwitcher.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved:
--------------------------------------------------------------------------------
1 | {
2 | "object": {
3 | "pins": [
4 | {
5 | "package": "ShellOut",
6 | "repositoryURL": "https://github.com/JohnSundell/ShellOut",
7 | "state": {
8 | "branch": null,
9 | "revision": "d3d54ce662dfee7fef619330b71d251b8d4869f9",
10 | "version": "2.2.0"
11 | }
12 | }
13 | ]
14 | },
15 | "version": 1
16 | }
17 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/AppInfo.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppInfo.swift
3 | // DarkModeSwitcher
4 | //
5 | // Created by Kuba Suder on 12.06.2019.
6 | // Copyright © 2019 Kuba Suder. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | struct AppInfo: Codable {
12 | let iconFileName: String?
13 | let bundleIdentifier: String
14 |
15 | enum CodingKeys: String, CodingKey {
16 | case iconFileName = "CFBundleIconFile"
17 | case bundleIdentifier = "CFBundleIdentifier"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/WTFPL-LICENSE.txt:
--------------------------------------------------------------------------------
1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2 | Version 2, December 2004
3 |
4 | Copyright (C) 2004 Sam Hocevar
5 |
6 | Everyone is permitted to copy and distribute verbatim or modified
7 | copies of this license document, and changing it is allowed as long
8 | as the name is changed.
9 |
10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12 |
13 | 0. You just DO WHAT THE FUCK YOU WANT TO.
14 |
15 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "size" : "16x16",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "mac",
10 | "size" : "16x16",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "mac",
15 | "size" : "32x32",
16 | "scale" : "1x"
17 | },
18 | {
19 | "idiom" : "mac",
20 | "size" : "32x32",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "mac",
25 | "size" : "128x128",
26 | "scale" : "1x"
27 | },
28 | {
29 | "idiom" : "mac",
30 | "size" : "128x128",
31 | "scale" : "2x"
32 | },
33 | {
34 | "idiom" : "mac",
35 | "size" : "256x256",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "mac",
40 | "size" : "256x256",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "mac",
45 | "size" : "512x512",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "mac",
50 | "size" : "512x512",
51 | "scale" : "2x"
52 | }
53 | ],
54 | "info" : {
55 | "version" : 1,
56 | "author" : "xcode"
57 | }
58 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Dark Mode Switcher
2 |
3 | This is a demo app I've built as an experiment in using SwiftUI with AppKit, as described in this blog post: .
4 |
5 | The app lets you force any other app to use a light mode when the whole desktop uses a dark mode. Unfortunately there doesn't seem to be any way now to do the opposite (use dark mode only in specific apps).
6 |
7 | This isn't really a great app, it's mostly useful as sample code - it works pretty slowly because of the constant AutoLayout constraint errors, which I don't know how to fix. So I'm not providing any binaries - if you really want to try it, just download the code and build it.
8 |
9 | **August 2020 update**: I've updated the code to work with stable Xcode 11 and made some minor improvements.
10 |
11 |
12 |
13 | ## License
14 |
15 | Copyright © 2020 [Kuba Suder](https://mackuba.eu). The entire code of the app is licensed under [WTFPL License](http://www.wtfpl.net) - this is intended to be example code after all, so feel free to take whatever parts you need and use them for anything you need.
16 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // DarkModeSwitcher
4 | //
5 | // Created by Kuba Suder on 12.06.2019.
6 | // Copyright © 2019 Kuba Suder. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 | import SwiftUI
11 |
12 | @NSApplicationMain
13 | class AppDelegate: NSObject, NSApplicationDelegate {
14 |
15 | var window: NSWindow!
16 |
17 | func applicationDidFinishLaunching(_ aNotification: Notification) {
18 | // Insert code here to initialize your application
19 | window = NSWindow(
20 | contentRect: NSRect(x: 0, y: 0, width: 480, height: 300),
21 | styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
22 | backing: .buffered, defer: false)
23 | window.center()
24 | window.setFrameAutosaveName("Main Window")
25 | window.title = "Dark Mode Switcher"
26 |
27 | let appList = AppList()
28 | appList.loadApps()
29 |
30 | window.contentView = NSHostingView(rootView: ContentView(appList: appList))
31 |
32 | window.makeKeyAndOrderFront(nil)
33 | }
34 |
35 | func applicationWillTerminate(_ aNotification: Notification) {
36 | // Insert code here to tear down your application
37 | }
38 |
39 |
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | Copyright © 2019 Kuba Suder. All rights reserved.
27 | NSMainStoryboardFile
28 | Main
29 | NSPrincipalClass
30 | NSApplication
31 | NSSupportsAutomaticTermination
32 |
33 | NSSupportsSuddenTermination
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/AppList.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppList.swift
3 | // DarkModeSwitcher
4 | //
5 | // Created by Kuba Suder on 12.06.2019.
6 | // Copyright © 2019 Kuba Suder. All rights reserved.
7 | //
8 |
9 | import Combine
10 | import Foundation
11 | import SwiftUI
12 |
13 | typealias Signal = PassthroughSubject
14 |
15 | class AppList: ObservableObject {
16 | var runningAppsObservation: NSKeyValueObservation?
17 |
18 | @Published var apps: [AppModel] = []
19 |
20 | func loadApps() {
21 | DispatchQueue.global(qos: .userInitiated).async {
22 | let foundApps = AppScanner().findApps()
23 | let sortedApps = foundApps.sorted(by: { (app1, app2) -> Bool in
24 | return app1.name.localizedCaseInsensitiveCompare(app2.name) == .orderedAscending
25 | })
26 |
27 | DispatchQueue.main.async {
28 | self.apps = sortedApps
29 | self.startObservingRunningApps()
30 | }
31 | }
32 | }
33 |
34 | func startObservingRunningApps() {
35 | runningAppsObservation = NSWorkspace.shared.observe(\.runningApplications) { _, _ in
36 | self.updateRunningApps()
37 | }
38 |
39 | updateRunningApps()
40 | }
41 |
42 | func updateRunningApps() {
43 | let runningApps = NSWorkspace.shared.runningApplications
44 | let runningIds = Set(runningApps.compactMap({ $0.bundleIdentifier }))
45 |
46 | for app in self.apps {
47 | if let bundleId = app.bundleIdentifier {
48 | app.isRunning = runningIds.contains(bundleId)
49 | }
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/Defaults.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Defaults.swift
3 | // DarkModeSwitcher
4 | //
5 | // Created by Kuba Suder on 13.06.2019.
6 | // Copyright © 2019 Kuba Suder. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import ShellOut
11 |
12 | private let RequiresAquaSetting = "NSRequiresAquaSystemAppearance"
13 |
14 | class Defaults {
15 | func checkRequiresLightMode(for bundleIdentifier: String) -> Bool? {
16 | do {
17 | let value = try shellOut(
18 | to: "defaults",
19 | arguments: ["read", bundleIdentifier, RequiresAquaSetting]
20 | )
21 |
22 | return (value == "1")
23 | } catch let error as ShellOutError {
24 | let errorMessage = String(decoding: error.errorData, as: UTF8.self)
25 |
26 | if errorMessage != "" && !errorMessage.contains("does not exist") {
27 | print("Error checking defaults for \(bundleIdentifier): \(error)")
28 | }
29 | } catch {
30 | print("Error checking defaults for \(bundleIdentifier): \(error)")
31 | }
32 |
33 | return nil
34 | }
35 |
36 | func setRequiresLightMode(_ lightMode: Bool, for bundleIdentifier: String) {
37 | do {
38 | let arguments = lightMode ?
39 | ["write", bundleIdentifier, RequiresAquaSetting, "-bool", "true"] :
40 | ["delete", bundleIdentifier, RequiresAquaSetting]
41 |
42 | try shellOut(to: "defaults", arguments: arguments)
43 | } catch let error {
44 | print("Error setting default for \(bundleIdentifier): \(error)")
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/AppModel.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppModel.swift
3 | // DarkModeSwitcher
4 | //
5 | // Created by Kuba Suder on 12.06.2019.
6 | // Copyright © 2019 Kuba Suder. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 | import SwiftUI
11 |
12 | class AppModel: ObservableObject, CustomStringConvertible {
13 | enum ModeSwitchSetting {
14 | case auto
15 | case light
16 | }
17 |
18 | let name: String
19 | let bundleURL: URL
20 | var icon: NSImage?
21 | var bundleIdentifier: String?
22 |
23 | var requiresLightMode: Bool = false {
24 | didSet {
25 | if requiresLightMode != oldValue {
26 | needsRestart = isRunning
27 | }
28 | }
29 | }
30 |
31 | @Published var needsRestart: Bool = false
32 |
33 | @Published var isRunning: Bool = false {
34 | didSet {
35 | if !isRunning {
36 | needsRestart = false
37 | }
38 | }
39 | }
40 |
41 | var modeSwitchSetting: ModeSwitchSetting {
42 | get {
43 | requiresLightMode ? .light : .auto
44 | }
45 |
46 | set {
47 | guard let bundleIdentifier = bundleIdentifier else {
48 | fatalError("No bundleIdentifier set")
49 | }
50 |
51 | if newValue != modeSwitchSetting {
52 | requiresLightMode = (newValue == .light)
53 | print("Mode for \(bundleIdentifier) = \(requiresLightMode)")
54 |
55 | DispatchQueue.global(qos: .userInitiated).async {
56 | Defaults().setRequiresLightMode(newValue == .light, for: bundleIdentifier)
57 | }
58 | }
59 | }
60 | }
61 |
62 | init(bundleURL: URL) {
63 | self.name = bundleURL.deletingPathExtension().lastPathComponent
64 | self.bundleURL = bundleURL
65 | }
66 |
67 | var description: String {
68 | return "AppModel(name: \(name), bundleURL: \(bundleURL), identifier: \(bundleIdentifier ?? "?"), " +
69 | "requiresLightMode: \(requiresLightMode), icon: \(icon == nil ? "not loaded" : "loaded"))"
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/AppScanner.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppScanner.swift
3 | // DarkModeSwitcher
4 | //
5 | // Created by Kuba Suder on 12.06.2019.
6 | // Copyright © 2019 Kuba Suder. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 | import Foundation
11 |
12 | class AppScanner {
13 |
14 | var applicationFolders: [URL] {
15 | return FileManager.default.urls(for: .applicationDirectory, in: .allDomainsMask)
16 | }
17 |
18 | func findApps() -> [AppModel] {
19 | var foundApps: [AppModel] = []
20 | let manager = FileManager.default
21 |
22 | for folder in applicationFolders {
23 | do {
24 | var isDirectory: ObjCBool = false
25 | let exists = manager.fileExists(atPath: folder.path, isDirectory: &isDirectory)
26 |
27 | guard exists && isDirectory.boolValue else {
28 | print("Skipping \(folder)")
29 | continue
30 | }
31 |
32 | // TODO: scan subdirectories
33 | let urls = try manager.contentsOfDirectory(
34 | at: folder,
35 | includingPropertiesForKeys: [],
36 | options: [.skipsHiddenFiles]
37 | )
38 |
39 | for url in urls {
40 | guard url.pathExtension == "app" else { continue }
41 |
42 | let app = AppModel(bundleURL: url)
43 | foundApps.append(app)
44 |
45 | DispatchQueue.global(qos: .userInitiated).async {
46 | self.processApp(app: app)
47 | }
48 | }
49 | } catch {
50 | NSLog("Error: couldn't scan applications in %@", "\(folder)")
51 | }
52 | }
53 |
54 | return foundApps
55 | }
56 |
57 | func processApp(app: AppModel) {
58 | let plist = app.bundleURL.appendingPathComponent("Contents").appendingPathComponent("Info.plist")
59 |
60 | do {
61 | let contents = try Data(contentsOf: plist)
62 | let info = try PropertyListDecoder().decode(AppInfo.self, from: contents)
63 | let defaultsSetting = Defaults().checkRequiresLightMode(for: info.bundleIdentifier)
64 |
65 | DispatchQueue.main.async {
66 | app.objectWillChange.send()
67 | app.bundleIdentifier = info.bundleIdentifier
68 |
69 | if let iconFileName = info.iconFileName {
70 | let iconFile = app.bundleURL
71 | .appendingPathComponent("Contents")
72 | .appendingPathComponent("Resources")
73 | .appendingPathComponent(iconFileName)
74 |
75 | app.icon = iconFile.pathExtension.isEmpty ?
76 | NSImage(contentsOf: iconFile.appendingPathExtension("icns")) :
77 | NSImage(contentsOf: iconFile)
78 | }
79 |
80 | if let defaultsSetting = defaultsSetting {
81 | app.requiresLightMode = defaultsSetting
82 | }
83 |
84 | print("Updated app info: \(app)")
85 | }
86 | } catch let error {
87 | print("Could not load app info for \(app.name): \(error)")
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/ContentView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ContentView.swift
3 | // DarkModeSwitcher
4 | //
5 | // Created by Kuba Suder on 12.06.2019.
6 | // Copyright © 2019 Kuba Suder. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | private let iconSize: CGFloat = 32
12 |
13 | struct ContentView: View {
14 | @ObservedObject var appList: AppList
15 | @State var query: String = ""
16 |
17 | var matchingApps: [AppModel] {
18 | if query.isEmpty {
19 | return appList.apps
20 | } else {
21 | return appList.apps.filter({
22 | $0.name.lowercased().contains(query.lowercased())
23 | })
24 | }
25 | }
26 |
27 | var body: some View {
28 | VStack(spacing: 0) {
29 | SearchBar(query: $query)
30 |
31 | Divider()
32 |
33 | List(matchingApps, id: \.bundleURL) { app in
34 | AppRowView(app: app)
35 | }
36 | }
37 | .frame(minWidth: 450, minHeight: 300)
38 | }
39 | }
40 |
41 | struct SearchBar: View {
42 | @Binding var query: String
43 |
44 | var clearIcon: NSImage {
45 | NSImage(named: "NSStopProgressFreestandingTemplate")!
46 | }
47 |
48 | var body: some View {
49 | HStack(spacing: 0) {
50 | Spacer()
51 |
52 | Text("🔍")
53 |
54 | TextField("Search", text: $query)
55 | .textFieldStyle(RoundedBorderTextFieldStyle())
56 | .padding(8)
57 |
58 | Button(action: clearQuery) {
59 | Image(nsImage: clearIcon)
60 | .opacity(query.count == 0 ? 0.5 : 1.0)
61 | }
62 | .disabled(query.count == 0)
63 | .padding(.trailing, 8)
64 | }
65 | .onExitCommand(perform: clearQuery)
66 | }
67 |
68 | func clearQuery() {
69 | self.query = ""
70 | }
71 | }
72 |
73 | struct MissingAppIcon: View {
74 | var body: some View {
75 | Circle()
76 | .fill(Color.gray)
77 | .padding(.all, 2)
78 | .frame(width: iconSize, height: iconSize)
79 | .opacity(0.5)
80 | .overlay(Text("?").foregroundColor(.white).opacity(0.8))
81 | }
82 | }
83 |
84 | struct AppRowView: View {
85 | @ObservedObject var app: AppModel
86 |
87 | var body: some View {
88 | HStack {
89 | if app.icon != nil {
90 | Image(nsImage: app.icon!)
91 | .resizable()
92 | .frame(width: iconSize, height: iconSize)
93 | } else {
94 | MissingAppIcon()
95 | }
96 |
97 | Text(app.name)
98 |
99 | Spacer()
100 |
101 | if app.needsRestart {
102 | Image(nsImage: NSImage(named: "NSCaution")!)
103 | .resizable()
104 | .frame(width: 28, height: 28)
105 | .padding(.trailing, 5)
106 | .accessibility(
107 | label: Text("App requires restart")
108 | )
109 | }
110 |
111 | Picker("", selection: $app.modeSwitchSetting) {
112 | Text("Auto").tag(AppModel.ModeSwitchSetting.auto)
113 | Text("Light").tag(AppModel.ModeSwitchSetting.light)
114 | }
115 | .pickerStyle(SegmentedPickerStyle())
116 | .disabled(app.bundleIdentifier == nil)
117 | .frame(width: 200)
118 | }
119 | }
120 | }
121 |
122 | struct ContentView_Previews : PreviewProvider {
123 | static var previews: some View {
124 | let names = ["App Store", "Music", "Numbers", "Photos", "Safari"]
125 | let appList = AppList()
126 | appList.apps = names.map {
127 | let app = AppModel(
128 | bundleURL: URL(fileURLWithPath: "/System/Applications/\($0).app")
129 | )
130 | app.bundleIdentifier = "app.\($0)"
131 | app.icon = NSImage(
132 | contentsOf: app.bundleURL
133 | .appendingPathComponent("Contents")
134 | .appendingPathComponent("Resources")
135 | .appendingPathComponent("AppIcon.icns")
136 | )
137 | app.needsRestart = (app.name == "Slack")
138 | return app
139 | }
140 |
141 | return Group {
142 | AppRowView(app: appList.apps[0])
143 | .previewLayout(.fixed(width: 500, height: 50))
144 | .padding(.all, 5)
145 |
146 | ContentView(appList: appList)
147 | }
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/DarkModeSwitcher.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 52;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 8C8199EF22B26F7200C60158 /* ShellOut in Frameworks */ = {isa = PBXBuildFile; productRef = 8C8199EE22B26F7200C60158 /* ShellOut */; };
11 | 8C8199F122B2741C00C60158 /* Defaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C8199F022B2741C00C60158 /* Defaults.swift */; };
12 | 8CBFB3D622B1986000BE244F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CBFB3D522B1986000BE244F /* AppDelegate.swift */; };
13 | 8CBFB3D822B1986000BE244F /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CBFB3D722B1986000BE244F /* ContentView.swift */; };
14 | 8CBFB3DA22B1986000BE244F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8CBFB3D922B1986000BE244F /* Assets.xcassets */; };
15 | 8CBFB3DD22B1986000BE244F /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8CBFB3DC22B1986000BE244F /* Preview Assets.xcassets */; };
16 | 8CBFB3E022B1986000BE244F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8CBFB3DE22B1986000BE244F /* Main.storyboard */; };
17 | 8CBFB3E922B19B1600BE244F /* AppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CBFB3E822B19B1600BE244F /* AppModel.swift */; };
18 | 8CBFB3EB22B19B8900BE244F /* AppList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CBFB3EA22B19B8900BE244F /* AppList.swift */; };
19 | 8CBFB3ED22B19BD900BE244F /* AppScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CBFB3EC22B19BD900BE244F /* AppScanner.swift */; };
20 | 8CBFB3EF22B1AA3000BE244F /* AppInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CBFB3EE22B1AA3000BE244F /* AppInfo.swift */; };
21 | /* End PBXBuildFile section */
22 |
23 | /* Begin PBXFileReference section */
24 | 8C8199F022B2741C00C60158 /* Defaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Defaults.swift; sourceTree = ""; };
25 | 8CBFB3D222B1986000BE244F /* DarkModeSwitcher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DarkModeSwitcher.app; sourceTree = BUILT_PRODUCTS_DIR; };
26 | 8CBFB3D522B1986000BE244F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
27 | 8CBFB3D722B1986000BE244F /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
28 | 8CBFB3D922B1986000BE244F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
29 | 8CBFB3DC22B1986000BE244F /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
30 | 8CBFB3DF22B1986000BE244F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
31 | 8CBFB3E122B1986000BE244F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
32 | 8CBFB3E222B1986000BE244F /* DarkModeSwitcher.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DarkModeSwitcher.entitlements; sourceTree = ""; };
33 | 8CBFB3E822B19B1600BE244F /* AppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppModel.swift; sourceTree = ""; };
34 | 8CBFB3EA22B19B8900BE244F /* AppList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppList.swift; sourceTree = ""; };
35 | 8CBFB3EC22B19BD900BE244F /* AppScanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppScanner.swift; sourceTree = ""; };
36 | 8CBFB3EE22B1AA3000BE244F /* AppInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppInfo.swift; sourceTree = ""; };
37 | /* End PBXFileReference section */
38 |
39 | /* Begin PBXFrameworksBuildPhase section */
40 | 8CBFB3CF22B1986000BE244F /* Frameworks */ = {
41 | isa = PBXFrameworksBuildPhase;
42 | buildActionMask = 2147483647;
43 | files = (
44 | 8C8199EF22B26F7200C60158 /* ShellOut in Frameworks */,
45 | );
46 | runOnlyForDeploymentPostprocessing = 0;
47 | };
48 | /* End PBXFrameworksBuildPhase section */
49 |
50 | /* Begin PBXGroup section */
51 | 8CBFB3C922B1986000BE244F = {
52 | isa = PBXGroup;
53 | children = (
54 | 8CBFB3D422B1986000BE244F /* DarkModeSwitcher */,
55 | 8CBFB3D322B1986000BE244F /* Products */,
56 | );
57 | sourceTree = "";
58 | };
59 | 8CBFB3D322B1986000BE244F /* Products */ = {
60 | isa = PBXGroup;
61 | children = (
62 | 8CBFB3D222B1986000BE244F /* DarkModeSwitcher.app */,
63 | );
64 | name = Products;
65 | sourceTree = "";
66 | };
67 | 8CBFB3D422B1986000BE244F /* DarkModeSwitcher */ = {
68 | isa = PBXGroup;
69 | children = (
70 | 8CBFB3D522B1986000BE244F /* AppDelegate.swift */,
71 | 8CBFB3EE22B1AA3000BE244F /* AppInfo.swift */,
72 | 8CBFB3EA22B19B8900BE244F /* AppList.swift */,
73 | 8CBFB3E822B19B1600BE244F /* AppModel.swift */,
74 | 8CBFB3EC22B19BD900BE244F /* AppScanner.swift */,
75 | 8CBFB3D722B1986000BE244F /* ContentView.swift */,
76 | 8C8199F022B2741C00C60158 /* Defaults.swift */,
77 | 8CBFB3D922B1986000BE244F /* Assets.xcassets */,
78 | 8CBFB3DE22B1986000BE244F /* Main.storyboard */,
79 | 8CBFB3E122B1986000BE244F /* Info.plist */,
80 | 8CBFB3E222B1986000BE244F /* DarkModeSwitcher.entitlements */,
81 | 8CBFB3DB22B1986000BE244F /* Preview Content */,
82 | );
83 | path = DarkModeSwitcher;
84 | sourceTree = "";
85 | };
86 | 8CBFB3DB22B1986000BE244F /* Preview Content */ = {
87 | isa = PBXGroup;
88 | children = (
89 | 8CBFB3DC22B1986000BE244F /* Preview Assets.xcassets */,
90 | );
91 | path = "Preview Content";
92 | sourceTree = "";
93 | };
94 | /* End PBXGroup section */
95 |
96 | /* Begin PBXNativeTarget section */
97 | 8CBFB3D122B1986000BE244F /* DarkModeSwitcher */ = {
98 | isa = PBXNativeTarget;
99 | buildConfigurationList = 8CBFB3E522B1986000BE244F /* Build configuration list for PBXNativeTarget "DarkModeSwitcher" */;
100 | buildPhases = (
101 | 8CBFB3CE22B1986000BE244F /* Sources */,
102 | 8CBFB3CF22B1986000BE244F /* Frameworks */,
103 | 8CBFB3D022B1986000BE244F /* Resources */,
104 | );
105 | buildRules = (
106 | );
107 | dependencies = (
108 | );
109 | name = DarkModeSwitcher;
110 | packageProductDependencies = (
111 | 8C8199EE22B26F7200C60158 /* ShellOut */,
112 | );
113 | productName = DarkModeSwitcher;
114 | productReference = 8CBFB3D222B1986000BE244F /* DarkModeSwitcher.app */;
115 | productType = "com.apple.product-type.application";
116 | };
117 | /* End PBXNativeTarget section */
118 |
119 | /* Begin PBXProject section */
120 | 8CBFB3CA22B1986000BE244F /* Project object */ = {
121 | isa = PBXProject;
122 | attributes = {
123 | LastSwiftUpdateCheck = 1100;
124 | LastUpgradeCheck = 1150;
125 | ORGANIZATIONNAME = "Kuba Suder";
126 | TargetAttributes = {
127 | 8CBFB3D122B1986000BE244F = {
128 | CreatedOnToolsVersion = 11.0;
129 | };
130 | };
131 | };
132 | buildConfigurationList = 8CBFB3CD22B1986000BE244F /* Build configuration list for PBXProject "DarkModeSwitcher" */;
133 | compatibilityVersion = "Xcode 9.3";
134 | developmentRegion = en;
135 | hasScannedForEncodings = 0;
136 | knownRegions = (
137 | en,
138 | Base,
139 | );
140 | mainGroup = 8CBFB3C922B1986000BE244F;
141 | packageReferences = (
142 | 8C8199ED22B26F7200C60158 /* XCRemoteSwiftPackageReference "ShellOut" */,
143 | );
144 | productRefGroup = 8CBFB3D322B1986000BE244F /* Products */;
145 | projectDirPath = "";
146 | projectRoot = "";
147 | targets = (
148 | 8CBFB3D122B1986000BE244F /* DarkModeSwitcher */,
149 | );
150 | };
151 | /* End PBXProject section */
152 |
153 | /* Begin PBXResourcesBuildPhase section */
154 | 8CBFB3D022B1986000BE244F /* Resources */ = {
155 | isa = PBXResourcesBuildPhase;
156 | buildActionMask = 2147483647;
157 | files = (
158 | 8CBFB3E022B1986000BE244F /* Main.storyboard in Resources */,
159 | 8CBFB3DD22B1986000BE244F /* Preview Assets.xcassets in Resources */,
160 | 8CBFB3DA22B1986000BE244F /* Assets.xcassets in Resources */,
161 | );
162 | runOnlyForDeploymentPostprocessing = 0;
163 | };
164 | /* End PBXResourcesBuildPhase section */
165 |
166 | /* Begin PBXSourcesBuildPhase section */
167 | 8CBFB3CE22B1986000BE244F /* Sources */ = {
168 | isa = PBXSourcesBuildPhase;
169 | buildActionMask = 2147483647;
170 | files = (
171 | 8CBFB3D822B1986000BE244F /* ContentView.swift in Sources */,
172 | 8C8199F122B2741C00C60158 /* Defaults.swift in Sources */,
173 | 8CBFB3EB22B19B8900BE244F /* AppList.swift in Sources */,
174 | 8CBFB3E922B19B1600BE244F /* AppModel.swift in Sources */,
175 | 8CBFB3D622B1986000BE244F /* AppDelegate.swift in Sources */,
176 | 8CBFB3ED22B19BD900BE244F /* AppScanner.swift in Sources */,
177 | 8CBFB3EF22B1AA3000BE244F /* AppInfo.swift in Sources */,
178 | );
179 | runOnlyForDeploymentPostprocessing = 0;
180 | };
181 | /* End PBXSourcesBuildPhase section */
182 |
183 | /* Begin PBXVariantGroup section */
184 | 8CBFB3DE22B1986000BE244F /* Main.storyboard */ = {
185 | isa = PBXVariantGroup;
186 | children = (
187 | 8CBFB3DF22B1986000BE244F /* Base */,
188 | );
189 | name = Main.storyboard;
190 | sourceTree = "";
191 | };
192 | /* End PBXVariantGroup section */
193 |
194 | /* Begin XCBuildConfiguration section */
195 | 8CBFB3E322B1986000BE244F /* Debug */ = {
196 | isa = XCBuildConfiguration;
197 | buildSettings = {
198 | ALWAYS_SEARCH_USER_PATHS = NO;
199 | CLANG_ANALYZER_NONNULL = YES;
200 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
201 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
202 | CLANG_CXX_LIBRARY = "libc++";
203 | CLANG_ENABLE_MODULES = YES;
204 | CLANG_ENABLE_OBJC_ARC = YES;
205 | CLANG_ENABLE_OBJC_WEAK = YES;
206 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
207 | CLANG_WARN_BOOL_CONVERSION = YES;
208 | CLANG_WARN_COMMA = YES;
209 | CLANG_WARN_CONSTANT_CONVERSION = YES;
210 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
211 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
212 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
213 | CLANG_WARN_EMPTY_BODY = YES;
214 | CLANG_WARN_ENUM_CONVERSION = YES;
215 | CLANG_WARN_INFINITE_RECURSION = YES;
216 | CLANG_WARN_INT_CONVERSION = YES;
217 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
218 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
219 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
220 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
221 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
222 | CLANG_WARN_STRICT_PROTOTYPES = YES;
223 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
224 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
225 | CLANG_WARN_UNREACHABLE_CODE = YES;
226 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
227 | COPY_PHASE_STRIP = NO;
228 | DEBUG_INFORMATION_FORMAT = dwarf;
229 | ENABLE_STRICT_OBJC_MSGSEND = YES;
230 | ENABLE_TESTABILITY = YES;
231 | GCC_C_LANGUAGE_STANDARD = gnu11;
232 | GCC_DYNAMIC_NO_PIC = NO;
233 | GCC_NO_COMMON_BLOCKS = YES;
234 | GCC_OPTIMIZATION_LEVEL = 0;
235 | GCC_PREPROCESSOR_DEFINITIONS = (
236 | "DEBUG=1",
237 | "$(inherited)",
238 | );
239 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
240 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
241 | GCC_WARN_UNDECLARED_SELECTOR = YES;
242 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
243 | GCC_WARN_UNUSED_FUNCTION = YES;
244 | GCC_WARN_UNUSED_VARIABLE = YES;
245 | MACOSX_DEPLOYMENT_TARGET = 10.15;
246 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
247 | MTL_FAST_MATH = YES;
248 | ONLY_ACTIVE_ARCH = YES;
249 | SDKROOT = macosx;
250 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
251 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
252 | };
253 | name = Debug;
254 | };
255 | 8CBFB3E422B1986000BE244F /* Release */ = {
256 | isa = XCBuildConfiguration;
257 | buildSettings = {
258 | ALWAYS_SEARCH_USER_PATHS = NO;
259 | CLANG_ANALYZER_NONNULL = YES;
260 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
261 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
262 | CLANG_CXX_LIBRARY = "libc++";
263 | CLANG_ENABLE_MODULES = YES;
264 | CLANG_ENABLE_OBJC_ARC = YES;
265 | CLANG_ENABLE_OBJC_WEAK = YES;
266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
267 | CLANG_WARN_BOOL_CONVERSION = YES;
268 | CLANG_WARN_COMMA = YES;
269 | CLANG_WARN_CONSTANT_CONVERSION = YES;
270 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
272 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
273 | CLANG_WARN_EMPTY_BODY = YES;
274 | CLANG_WARN_ENUM_CONVERSION = YES;
275 | CLANG_WARN_INFINITE_RECURSION = YES;
276 | CLANG_WARN_INT_CONVERSION = YES;
277 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
278 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
279 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
280 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
281 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
282 | CLANG_WARN_STRICT_PROTOTYPES = YES;
283 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
284 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
285 | CLANG_WARN_UNREACHABLE_CODE = YES;
286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
287 | COPY_PHASE_STRIP = NO;
288 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
289 | ENABLE_NS_ASSERTIONS = NO;
290 | ENABLE_STRICT_OBJC_MSGSEND = YES;
291 | GCC_C_LANGUAGE_STANDARD = gnu11;
292 | GCC_NO_COMMON_BLOCKS = YES;
293 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
294 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
295 | GCC_WARN_UNDECLARED_SELECTOR = YES;
296 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
297 | GCC_WARN_UNUSED_FUNCTION = YES;
298 | GCC_WARN_UNUSED_VARIABLE = YES;
299 | MACOSX_DEPLOYMENT_TARGET = 10.15;
300 | MTL_ENABLE_DEBUG_INFO = NO;
301 | MTL_FAST_MATH = YES;
302 | SDKROOT = macosx;
303 | SWIFT_COMPILATION_MODE = wholemodule;
304 | SWIFT_OPTIMIZATION_LEVEL = "-O";
305 | };
306 | name = Release;
307 | };
308 | 8CBFB3E622B1986000BE244F /* Debug */ = {
309 | isa = XCBuildConfiguration;
310 | buildSettings = {
311 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
312 | CODE_SIGN_ENTITLEMENTS = DarkModeSwitcher/DarkModeSwitcher.entitlements;
313 | CODE_SIGN_IDENTITY = "Apple Development";
314 | CODE_SIGN_STYLE = Automatic;
315 | COMBINE_HIDPI_IMAGES = YES;
316 | DEVELOPMENT_ASSET_PATHS = "DarkModeSwitcher/Preview\\ Content";
317 | DEVELOPMENT_TEAM = KL585M628D;
318 | ENABLE_HARDENED_RUNTIME = YES;
319 | ENABLE_PREVIEWS = YES;
320 | INFOPLIST_FILE = DarkModeSwitcher/Info.plist;
321 | LD_RUNPATH_SEARCH_PATHS = (
322 | "$(inherited)",
323 | "@executable_path/../Frameworks",
324 | );
325 | PRODUCT_BUNDLE_IDENTIFIER = eu.mackuba.DarkModeSwitcher;
326 | PRODUCT_NAME = "$(TARGET_NAME)";
327 | SWIFT_VERSION = 5.0;
328 | };
329 | name = Debug;
330 | };
331 | 8CBFB3E722B1986000BE244F /* Release */ = {
332 | isa = XCBuildConfiguration;
333 | buildSettings = {
334 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
335 | CODE_SIGN_ENTITLEMENTS = DarkModeSwitcher/DarkModeSwitcher.entitlements;
336 | CODE_SIGN_IDENTITY = "Apple Development";
337 | CODE_SIGN_STYLE = Automatic;
338 | COMBINE_HIDPI_IMAGES = YES;
339 | DEVELOPMENT_ASSET_PATHS = "DarkModeSwitcher/Preview\\ Content";
340 | DEVELOPMENT_TEAM = KL585M628D;
341 | ENABLE_HARDENED_RUNTIME = YES;
342 | ENABLE_PREVIEWS = YES;
343 | INFOPLIST_FILE = DarkModeSwitcher/Info.plist;
344 | LD_RUNPATH_SEARCH_PATHS = (
345 | "$(inherited)",
346 | "@executable_path/../Frameworks",
347 | );
348 | PRODUCT_BUNDLE_IDENTIFIER = eu.mackuba.DarkModeSwitcher;
349 | PRODUCT_NAME = "$(TARGET_NAME)";
350 | SWIFT_VERSION = 5.0;
351 | };
352 | name = Release;
353 | };
354 | /* End XCBuildConfiguration section */
355 |
356 | /* Begin XCConfigurationList section */
357 | 8CBFB3CD22B1986000BE244F /* Build configuration list for PBXProject "DarkModeSwitcher" */ = {
358 | isa = XCConfigurationList;
359 | buildConfigurations = (
360 | 8CBFB3E322B1986000BE244F /* Debug */,
361 | 8CBFB3E422B1986000BE244F /* Release */,
362 | );
363 | defaultConfigurationIsVisible = 0;
364 | defaultConfigurationName = Release;
365 | };
366 | 8CBFB3E522B1986000BE244F /* Build configuration list for PBXNativeTarget "DarkModeSwitcher" */ = {
367 | isa = XCConfigurationList;
368 | buildConfigurations = (
369 | 8CBFB3E622B1986000BE244F /* Debug */,
370 | 8CBFB3E722B1986000BE244F /* Release */,
371 | );
372 | defaultConfigurationIsVisible = 0;
373 | defaultConfigurationName = Release;
374 | };
375 | /* End XCConfigurationList section */
376 |
377 | /* Begin XCRemoteSwiftPackageReference section */
378 | 8C8199ED22B26F7200C60158 /* XCRemoteSwiftPackageReference "ShellOut" */ = {
379 | isa = XCRemoteSwiftPackageReference;
380 | repositoryURL = "https://github.com/JohnSundell/ShellOut";
381 | requirement = {
382 | kind = upToNextMajorVersion;
383 | minimumVersion = 2.2.0;
384 | };
385 | };
386 | /* End XCRemoteSwiftPackageReference section */
387 |
388 | /* Begin XCSwiftPackageProductDependency section */
389 | 8C8199EE22B26F7200C60158 /* ShellOut */ = {
390 | isa = XCSwiftPackageProductDependency;
391 | package = 8C8199ED22B26F7200C60158 /* XCRemoteSwiftPackageReference "ShellOut" */;
392 | productName = ShellOut;
393 | };
394 | /* End XCSwiftPackageProductDependency section */
395 | };
396 | rootObject = 8CBFB3CA22B1986000BE244F /* Project object */;
397 | }
398 |
--------------------------------------------------------------------------------
/DarkModeSwitcher/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
--------------------------------------------------------------------------------