Skip to content

Commit 86d76ba

Browse files
schrobingusokwasniewski
authored andcommitted
feat: add preference option to change MiniSim icon
feat: implement menu icons with enum plus accomodations
1 parent abe4b6e commit 86d76ba

File tree

13 files changed

+269
-173
lines changed

13 files changed

+269
-173
lines changed

MiniSim.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
76AC9AF62A0EA82C00864A8B /* CustomCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76AC9AF52A0EA82C00864A8B /* CustomCommands.swift */; };
7676
76AC9AF92A0EB50800864A8B /* SymbolPicker in Frameworks */ = {isa = PBXBuildFile; productRef = 76AC9AF82A0EB50800864A8B /* SymbolPicker */; };
7777
76B70F7E2B0D361A009D87A4 /* UserDefaultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76B70F7D2B0D361A009D87A4 /* UserDefaultsTests.swift */; };
78+
76C1396A2C849A3F006CD80C /* MenuIcons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76C139692C849A3F006CD80C /* MenuIcons.swift */; };
7879
76E4451229D4391000039025 /* Onboarding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76E4451129D4391000039025 /* Onboarding.swift */; };
7980
76E4451429D4403F00039025 /* NSNotificationName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76E4451329D4403F00039025 /* NSNotificationName.swift */; };
8081
76F04A11298A5AE000BF9CA3 /* ADB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F04A10298A5AE000BF9CA3 /* ADB.swift */; };
@@ -165,6 +166,7 @@
165166
76AC9AF52A0EA82C00864A8B /* CustomCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCommands.swift; sourceTree = "<group>"; };
166167
76B70F742B0D359D009D87A4 /* MiniSimTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MiniSimTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
167168
76B70F7D2B0D361A009D87A4 /* UserDefaultsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsTests.swift; sourceTree = "<group>"; };
169+
76C139692C849A3F006CD80C /* MenuIcons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuIcons.swift; sourceTree = "<group>"; };
168170
76E4451129D4391000039025 /* Onboarding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Onboarding.swift; sourceTree = "<group>"; };
169171
76E4451329D4403F00039025 /* NSNotificationName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSNotificationName.swift; sourceTree = "<group>"; };
170172
76F04A10298A5AE000BF9CA3 /* ADB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ADB.swift; sourceTree = "<group>"; };
@@ -225,6 +227,7 @@
225227
762CF1E12981DDD400099999 /* Extensions */ = {
226228
isa = PBXGroup;
227229
children = (
230+
76C139692C849A3F006CD80C /* MenuIcons.swift */,
228231
762CF1DF2981968F00099999 /* String+match.swift */,
229232
7645D5022983186100019227 /* NSMenuItem+ImageInit.swift */,
230233
7630B26C2986B4FD00D8B57D /* KeyboardShortcuts.swift */,
@@ -629,6 +632,7 @@
629632
7630B26D2986B4FD00D8B57D /* KeyboardShortcuts.swift in Sources */,
630633
76059BF52AD4361C0008D38B /* SetupPreferences.swift in Sources */,
631634
7684FAAF29D202F500230BB0 /* AndroidHomeError.swift in Sources */,
635+
76C1396A2C849A3F006CD80C /* MenuIcons.swift in Sources */,
632636
55CDB0782B1B6D24002418D7 /* TerminalApps.swift in Sources */,
633637
7645D4BE2982A1B100019227 /* DeviceService.swift in Sources */,
634638
765ABF382A8BECD900A063CB /* ExecuteCommand.swift in Sources */,

MiniSim/.DS_Store

-6 KB
Binary file not shown.

MiniSim/Assets.xcassets/.DS_Store

-6 KB
Binary file not shown.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"filename" : "[email protected]",
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"author" : "xcode",
19+
"version" : 1
20+
}
21+
}
636 Bytes
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"filename" : "[email protected]",
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"author" : "xcode",
19+
"version" : 1
20+
}
21+
}
570 Bytes
Loading

MiniSim/Assets.xcassets/menu_icon.imageset/Contents.json renamed to MiniSim/Assets.xcassets/iphone.imageset/Contents.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scale" : "1x"
66
},
77
{
8-
"filename" : "menu_icon.png",
8+
"filename" : "iphone@2x.png",
99
"idiom" : "universal",
1010
"scale" : "2x"
1111
},
File renamed without changes.

MiniSim/Extensions/MenuIcons.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import AppKit
2+
import Foundation
3+
4+
enum MenuImage: String, CaseIterable {
5+
case iphone = "iphone"
6+
case ipad = "ipad"
7+
case box = "box"
8+
9+
var image: NSImage? {
10+
guard let itemImage = NSImage(named: self.rawValue) else {
11+
return nil
12+
}
13+
itemImage.size = size
14+
itemImage.isTemplate = true
15+
return itemImage
16+
}
17+
18+
var size: NSSize {
19+
switch self {
20+
case .box:
21+
return NSSize(width: 16.5, height: 15)
22+
case .ipad:
23+
return NSSize(width: 19, height: 14)
24+
case .iphone:
25+
return NSSize(width: 11, height: 19)
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)