diff --git a/.gitignore b/.gitignore index dd2592e..f24b421 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .DS_Store Box42/.DS_Store + +.prettierrc +.swift-format \ No newline at end of file diff --git a/Box42.xcodeproj/project.pbxproj b/Box42.xcodeproj/project.pbxproj new file mode 100644 index 0000000..90cda27 --- /dev/null +++ b/Box42.xcodeproj/project.pbxproj @@ -0,0 +1,561 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + DE018BB32A5099F900FF0AA3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BB22A5099F900FF0AA3 /* AppDelegate.swift */; }; + DE018BB82A5099F900FF0AA3 /* Box42.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = DE018BB62A5099F900FF0AA3 /* Box42.xcdatamodeld */; }; + DE018BDD2A509AEB00FF0AA3 /* EventMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BDC2A509AEB00FF0AA3 /* EventMonitor.swift */; }; + DE018BE02A509B0600FF0AA3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DE018BDF2A509B0600FF0AA3 /* Assets.xcassets */; }; + DE018BE42A509B1700FF0AA3 /* CPU.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BE32A509B1700FF0AA3 /* CPU.swift */; }; + DE018BE72A509B1E00FF0AA3 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BE62A509B1E00FF0AA3 /* WebViewController.swift */; }; + DE018BEA2A509B2100FF0AA3 /* WebViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BE92A509B2100FF0AA3 /* WebViewModel.swift */; }; + DE018BED2A509B2600FF0AA3 /* URLModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BEC2A509B2600FF0AA3 /* URLModel.swift */; }; + DE018BF02A509B2F00FF0AA3 /* MenubarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BEF2A509B2F00FF0AA3 /* MenubarViewController.swift */; }; + DE018BF32A509B3300FF0AA3 /* MenubarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BF22A509B3300FF0AA3 /* MenubarModel.swift */; }; + DE018BF62A509B3600FF0AA3 /* MenubarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BF52A509B3600FF0AA3 /* MenubarView.swift */; }; + DE018BF92A509B3B00FF0AA3 /* BoxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BF82A509B3B00FF0AA3 /* BoxViewController.swift */; }; + DE018BFC2A509B3E00FF0AA3 /* BoxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BFB2A509B3E00FF0AA3 /* BoxModel.swift */; }; + DE018BFF2A509B4200FF0AA3 /* BoxView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BFE2A509B4200FF0AA3 /* BoxView.swift */; }; + DE018C032A509B5D00FF0AA3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DE018C022A509B5D00FF0AA3 /* Main.storyboard */; }; + DE2AD3292A824EEB00002D51 /* Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2AD3282A824EEB00002D51 /* Accessibility.swift */; }; + DE77BA512A82580400713683 /* MenubarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE77BA502A82580400713683 /* MenubarViewModel.swift */; }; + DE77BA562A82637900713683 /* StateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE77BA552A82637900713683 /* StateManager.swift */; }; + DE7A257A2A6D8CA20043225A /* PreferencesController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE7A25792A6D8CA20043225A /* PreferencesController.swift */; }; + DE874F4E2A591DEA00FC3B77 /* Hotkey.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE874F4D2A591DEA00FC3B77 /* Hotkey.swift */; }; + DE874F542A591F1400FC3B77 /* PreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE874F532A591F1400FC3B77 /* PreferencesView.swift */; }; + DE874F572A591F2500FC3B77 /* Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE874F562A591F2500FC3B77 /* Icon.swift */; }; + DE874F5F2A5935CC00FC3B77 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE874F5E2A5935CC00FC3B77 /* StringExtension.swift */; }; + DE9BCA0D2A8360460031CA7B /* BoxViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9BCA0C2A8360460031CA7B /* BoxViewModel.swift */; }; + DEB862D42A85124500278FCD /* cleanCache.sh in Resources */ = {isa = PBXBuildFile; fileRef = DEB862D32A85124500278FCD /* cleanCache.sh */; }; + DEB862D92A852C4500278FCD /* brewInGoinfre.sh in Resources */ = {isa = PBXBuildFile; fileRef = DEB862D82A852C4500278FCD /* brewInGoinfre.sh */; }; + DEB862DC2A85347400278FCD /* Scripts.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEB862DB2A85347400278FCD /* Scripts.swift */; }; + DEB862EB2A853F7F00278FCD /* BoxWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEB862E92A853F7F00278FCD /* BoxWindowController.swift */; }; + DEB862EC2A853F7F00278FCD /* BoxWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DEB862EA2A853F7F00278FCD /* BoxWindowController.xib */; }; + DEF749322A85657600D987C8 /* NSScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF749312A85657600D987C8 /* NSScreen.swift */; }; + DEF749372A8565C400D987C8 /* BoxButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF749362A8565C400D987C8 /* BoxButtonView.swift */; }; + DEF7493B2A85683F00D987C8 /* BoxButtonHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF7493A2A85683F00D987C8 /* BoxButtonHandler.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + DE018BAF2A5099F900FF0AA3 /* Box42.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Box42.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DE018BB22A5099F900FF0AA3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + DE018BB72A5099F900FF0AA3 /* Box42.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Box42.xcdatamodel; sourceTree = ""; }; + DE018BBE2A5099FA00FF0AA3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DE018BDC2A509AEB00FF0AA3 /* EventMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventMonitor.swift; sourceTree = ""; }; + DE018BDF2A509B0600FF0AA3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + DE018BE32A509B1700FF0AA3 /* CPU.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CPU.swift; sourceTree = ""; }; + DE018BE62A509B1E00FF0AA3 /* WebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = ""; }; + DE018BE92A509B2100FF0AA3 /* WebViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebViewModel.swift; sourceTree = ""; }; + DE018BEC2A509B2600FF0AA3 /* URLModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = URLModel.swift; sourceTree = ""; }; + DE018BEF2A509B2F00FF0AA3 /* MenubarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenubarViewController.swift; sourceTree = ""; }; + DE018BF22A509B3300FF0AA3 /* MenubarModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenubarModel.swift; sourceTree = ""; }; + DE018BF52A509B3600FF0AA3 /* MenubarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenubarView.swift; sourceTree = ""; }; + DE018BF82A509B3B00FF0AA3 /* BoxViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoxViewController.swift; sourceTree = ""; }; + DE018BFB2A509B3E00FF0AA3 /* BoxModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoxModel.swift; sourceTree = ""; }; + DE018BFE2A509B4200FF0AA3 /* BoxView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoxView.swift; sourceTree = ""; }; + DE018C022A509B5D00FF0AA3 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; + DE018C192A509DBA00FF0AA3 /* Box42.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Box42.entitlements; sourceTree = ""; }; + DE2AD3282A824EEB00002D51 /* Accessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Accessibility.swift; sourceTree = ""; }; + DE77BA502A82580400713683 /* MenubarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenubarViewModel.swift; sourceTree = ""; }; + DE77BA552A82637900713683 /* StateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateManager.swift; sourceTree = ""; }; + DE7A25792A6D8CA20043225A /* PreferencesController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesController.swift; sourceTree = ""; }; + DE874F4D2A591DEA00FC3B77 /* Hotkey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Hotkey.swift; sourceTree = ""; }; + DE874F532A591F1400FC3B77 /* PreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesView.swift; sourceTree = ""; }; + DE874F562A591F2500FC3B77 /* Icon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Icon.swift; sourceTree = ""; }; + DE874F5E2A5935CC00FC3B77 /* StringExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = ""; }; + DE9BCA0C2A8360460031CA7B /* BoxViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxViewModel.swift; sourceTree = ""; }; + DEB862D32A85124500278FCD /* cleanCache.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = cleanCache.sh; sourceTree = ""; }; + DEB862D82A852C4500278FCD /* brewInGoinfre.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = brewInGoinfre.sh; sourceTree = ""; }; + DEB862DB2A85347400278FCD /* Scripts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Scripts.swift; path = Box42/Scripts/Scripts.swift; sourceTree = SOURCE_ROOT; }; + DEB862E92A853F7F00278FCD /* BoxWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxWindowController.swift; sourceTree = ""; }; + DEB862EA2A853F7F00278FCD /* BoxWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BoxWindowController.xib; sourceTree = ""; }; + DEF7492E2A85603700D987C8 /* nodeInstall.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = nodeInstall.sh; sourceTree = ""; }; + DEF749312A85657600D987C8 /* NSScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSScreen.swift; sourceTree = ""; }; + DEF749362A8565C400D987C8 /* BoxButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxButtonView.swift; sourceTree = ""; }; + DEF7493A2A85683F00D987C8 /* BoxButtonHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxButtonHandler.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DE018BAC2A5099F900FF0AA3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + DE018BA62A5099F900FF0AA3 = { + isa = PBXGroup; + children = ( + DE018BB12A5099F900FF0AA3 /* Box42 */, + DE018BB02A5099F900FF0AA3 /* Products */, + DE17AF722A834A1600325BF4 /* Frameworks */, + ); + sourceTree = ""; + }; + DE018BB02A5099F900FF0AA3 /* Products */ = { + isa = PBXGroup; + children = ( + DE018BAF2A5099F900FF0AA3 /* Box42.app */, + ); + name = Products; + sourceTree = ""; + }; + DE018BB12A5099F900FF0AA3 /* Box42 */ = { + isa = PBXGroup; + children = ( + DEF749302A85655E00D987C8 /* Extensions */, + DEB862E82A853F6800278FCD /* Window */, + DEB862D22A8511D600278FCD /* Scripts */, + DE77BA542A82636500713683 /* Shared */, + DE874F512A591EC600FC3B77 /* Preferences */, + DE018C0C2A509BDF00FF0AA3 /* Resources */, + DE018C062A509B9000FF0AA3 /* CPU */, + DE018C082A509BB500FF0AA3 /* WebView */, + DE018C0B2A509BC100FF0AA3 /* URL */, + DE018C0E2A509C0C00FF0AA3 /* Menubar */, + DE018C102A509C1A00FF0AA3 /* Box */, + ); + path = Box42; + sourceTree = ""; + }; + DE018C062A509B9000FF0AA3 /* CPU */ = { + isa = PBXGroup; + children = ( + DE018BE32A509B1700FF0AA3 /* CPU.swift */, + ); + path = CPU; + sourceTree = ""; + }; + DE018C082A509BB500FF0AA3 /* WebView */ = { + isa = PBXGroup; + children = ( + DE018BE92A509B2100FF0AA3 /* WebViewModel.swift */, + DE018BE62A509B1E00FF0AA3 /* WebViewController.swift */, + ); + path = WebView; + sourceTree = ""; + }; + DE018C0B2A509BC100FF0AA3 /* URL */ = { + isa = PBXGroup; + children = ( + DE018BEC2A509B2600FF0AA3 /* URLModel.swift */, + ); + path = URL; + sourceTree = ""; + }; + DE018C0C2A509BDF00FF0AA3 /* Resources */ = { + isa = PBXGroup; + children = ( + DE018C192A509DBA00FF0AA3 /* Box42.entitlements */, + DE018BB22A5099F900FF0AA3 /* AppDelegate.swift */, + DE018BDF2A509B0600FF0AA3 /* Assets.xcassets */, + DE018BBE2A5099FA00FF0AA3 /* Info.plist */, + DE018C022A509B5D00FF0AA3 /* Main.storyboard */, + DE018BDC2A509AEB00FF0AA3 /* EventMonitor.swift */, + DE018BB62A5099F900FF0AA3 /* Box42.xcdatamodeld */, + ); + path = Resources; + sourceTree = ""; + }; + DE018C0E2A509C0C00FF0AA3 /* Menubar */ = { + isa = PBXGroup; + children = ( + DE018BEF2A509B2F00FF0AA3 /* MenubarViewController.swift */, + DE018BF22A509B3300FF0AA3 /* MenubarModel.swift */, + DE018BF52A509B3600FF0AA3 /* MenubarView.swift */, + DE77BA502A82580400713683 /* MenubarViewModel.swift */, + ); + path = Menubar; + sourceTree = ""; + }; + DE018C102A509C1A00FF0AA3 /* Box */ = { + isa = PBXGroup; + children = ( + DEF749352A8565B000D987C8 /* View */, + DE9BCA0C2A8360460031CA7B /* BoxViewModel.swift */, + DE018BF82A509B3B00FF0AA3 /* BoxViewController.swift */, + DE018BFB2A509B3E00FF0AA3 /* BoxModel.swift */, + DEF7493A2A85683F00D987C8 /* BoxButtonHandler.swift */, + ); + path = Box; + sourceTree = ""; + }; + DE17AF722A834A1600325BF4 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; + DE77BA542A82636500713683 /* Shared */ = { + isa = PBXGroup; + children = ( + DE77BA552A82637900713683 /* StateManager.swift */, + ); + path = Shared; + sourceTree = ""; + }; + DE874F512A591EC600FC3B77 /* Preferences */ = { + isa = PBXGroup; + children = ( + DE7A25792A6D8CA20043225A /* PreferencesController.swift */, + DE874F532A591F1400FC3B77 /* PreferencesView.swift */, + DE874F562A591F2500FC3B77 /* Icon.swift */, + DE2AD3282A824EEB00002D51 /* Accessibility.swift */, + DE874F4D2A591DEA00FC3B77 /* Hotkey.swift */, + ); + path = Preferences; + sourceTree = ""; + }; + DEB862D22A8511D600278FCD /* Scripts */ = { + isa = PBXGroup; + children = ( + DEB862DE2A85348600278FCD /* sh */, + DEB862DB2A85347400278FCD /* Scripts.swift */, + ); + path = Scripts; + sourceTree = ""; + }; + DEB862DE2A85348600278FCD /* sh */ = { + isa = PBXGroup; + children = ( + DEB862D32A85124500278FCD /* cleanCache.sh */, + DEB862D82A852C4500278FCD /* brewInGoinfre.sh */, + DEF7492E2A85603700D987C8 /* nodeInstall.sh */, + ); + path = sh; + sourceTree = ""; + }; + DEB862E82A853F6800278FCD /* Window */ = { + isa = PBXGroup; + children = ( + DEB862E92A853F7F00278FCD /* BoxWindowController.swift */, + DEB862EA2A853F7F00278FCD /* BoxWindowController.xib */, + ); + path = Window; + sourceTree = ""; + }; + DEF749302A85655E00D987C8 /* Extensions */ = { + isa = PBXGroup; + children = ( + DE874F5E2A5935CC00FC3B77 /* StringExtension.swift */, + DEF749312A85657600D987C8 /* NSScreen.swift */, + ); + path = Extensions; + sourceTree = ""; + }; + DEF749352A8565B000D987C8 /* View */ = { + isa = PBXGroup; + children = ( + DE018BFE2A509B4200FF0AA3 /* BoxView.swift */, + DEF749362A8565C400D987C8 /* BoxButtonView.swift */, + ); + path = View; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + DE018BAE2A5099F900FF0AA3 /* Box42 */ = { + isa = PBXNativeTarget; + buildConfigurationList = DE018BC22A5099FA00FF0AA3 /* Build configuration list for PBXNativeTarget "Box42" */; + buildPhases = ( + DE018BAB2A5099F900FF0AA3 /* Sources */, + DE018BAC2A5099F900FF0AA3 /* Frameworks */, + DE018BAD2A5099F900FF0AA3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Box42; + productName = Box42; + productReference = DE018BAF2A5099F900FF0AA3 /* Box42.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DE018BA72A5099F900FF0AA3 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1230; + LastUpgradeCheck = 1230; + TargetAttributes = { + DE018BAE2A5099F900FF0AA3 = { + CreatedOnToolsVersion = 12.3; + }; + }; + }; + buildConfigurationList = DE018BAA2A5099F900FF0AA3 /* Build configuration list for PBXProject "Box42" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = DE018BA62A5099F900FF0AA3; + productRefGroup = DE018BB02A5099F900FF0AA3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DE018BAE2A5099F900FF0AA3 /* Box42 */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DE018BAD2A5099F900FF0AA3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DE018C032A509B5D00FF0AA3 /* Main.storyboard in Resources */, + DEB862D42A85124500278FCD /* cleanCache.sh in Resources */, + DEB862EC2A853F7F00278FCD /* BoxWindowController.xib in Resources */, + DEB862D92A852C4500278FCD /* brewInGoinfre.sh in Resources */, + DE018BE02A509B0600FF0AA3 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DE018BAB2A5099F900FF0AA3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DE018BFF2A509B4200FF0AA3 /* BoxView.swift in Sources */, + DE018BB82A5099F900FF0AA3 /* Box42.xcdatamodeld in Sources */, + DE9BCA0D2A8360460031CA7B /* BoxViewModel.swift in Sources */, + DE874F542A591F1400FC3B77 /* PreferencesView.swift in Sources */, + DE77BA562A82637900713683 /* StateManager.swift in Sources */, + DE018BF62A509B3600FF0AA3 /* MenubarView.swift in Sources */, + DEF749372A8565C400D987C8 /* BoxButtonView.swift in Sources */, + DEF7493B2A85683F00D987C8 /* BoxButtonHandler.swift in Sources */, + DE018BE72A509B1E00FF0AA3 /* WebViewController.swift in Sources */, + DEF749322A85657600D987C8 /* NSScreen.swift in Sources */, + DE018BF92A509B3B00FF0AA3 /* BoxViewController.swift in Sources */, + DE018BF02A509B2F00FF0AA3 /* MenubarViewController.swift in Sources */, + DE77BA512A82580400713683 /* MenubarViewModel.swift in Sources */, + DE018BE42A509B1700FF0AA3 /* CPU.swift in Sources */, + DE874F5F2A5935CC00FC3B77 /* StringExtension.swift in Sources */, + DE874F4E2A591DEA00FC3B77 /* Hotkey.swift in Sources */, + DE018BB32A5099F900FF0AA3 /* AppDelegate.swift in Sources */, + DE018BF32A509B3300FF0AA3 /* MenubarModel.swift in Sources */, + DE7A257A2A6D8CA20043225A /* PreferencesController.swift in Sources */, + DE018BED2A509B2600FF0AA3 /* URLModel.swift in Sources */, + DEB862EB2A853F7F00278FCD /* BoxWindowController.swift in Sources */, + DE018BFC2A509B3E00FF0AA3 /* BoxModel.swift in Sources */, + DE018BDD2A509AEB00FF0AA3 /* EventMonitor.swift in Sources */, + DEB862DC2A85347400278FCD /* Scripts.swift in Sources */, + DE2AD3292A824EEB00002D51 /* Accessibility.swift in Sources */, + DE874F572A591F2500FC3B77 /* Icon.swift in Sources */, + DE018BEA2A509B2100FF0AA3 /* WebViewModel.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + DE018BC02A5099FA00FF0AA3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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 = 11.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + DE018BC12A5099FA00FF0AA3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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 = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + DE018BC32A5099FA00FF0AA3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = Box42/Resources/Box42.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Box42/Resources/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; + PRODUCT_BUNDLE_IDENTIFIER = com.chanheki.Box42; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + DE018BC42A5099FA00FF0AA3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = Box42/Resources/Box42.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Box42/Resources/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; + PRODUCT_BUNDLE_IDENTIFIER = com.chanheki.Box42; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DE018BAA2A5099F900FF0AA3 /* Build configuration list for PBXProject "Box42" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DE018BC02A5099FA00FF0AA3 /* Debug */, + DE018BC12A5099FA00FF0AA3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DE018BC22A5099FA00FF0AA3 /* Build configuration list for PBXNativeTarget "Box42" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DE018BC32A5099FA00FF0AA3 /* Debug */, + DE018BC42A5099FA00FF0AA3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + DE018BB62A5099F900FF0AA3 /* Box42.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + DE018BB72A5099F900FF0AA3 /* Box42.xcdatamodel */, + ); + currentVersion = DE018BB72A5099F900FF0AA3 /* Box42.xcdatamodel */; + path = Box42.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = DE018BA72A5099F900FF0AA3 /* Project object */; +} diff --git a/Box42.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Box42.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Box42.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Box42.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Box42.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Box42.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Box42.xcodeproj/project.xcworkspace/xcuserdata/chanheki.xcuserdatad/UserInterfaceState.xcuserstate b/Box42.xcodeproj/project.xcworkspace/xcuserdata/chanheki.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..6643712 Binary files /dev/null and b/Box42.xcodeproj/project.xcworkspace/xcuserdata/chanheki.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Box42.xcodeproj/xcuserdata/chanheki.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Box42.xcodeproj/xcuserdata/chanheki.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..955e565 --- /dev/null +++ b/Box42.xcodeproj/xcuserdata/chanheki.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/Box42.xcodeproj/xcuserdata/chanheki.xcuserdatad/xcschemes/xcschememanagement.plist b/Box42.xcodeproj/xcuserdata/chanheki.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..2d4f387 --- /dev/null +++ b/Box42.xcodeproj/xcuserdata/chanheki.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Box42.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Box42/Preferences/PreferencesController.swift b/Box42/Preferences/PreferencesController.swift index 60f6151..1b9139b 100644 --- a/Box42/Preferences/PreferencesController.swift +++ b/Box42/Preferences/PreferencesController.swift @@ -6,16 +6,18 @@ // import Cocoa +import Foundation class PreferencesViewController: NSViewController { - + let menubarVC = MenubarViewController() private var stackView: NSStackView! private var rightView: NSView! + private var outputView: NSTextView! override func loadView() { self.view = NSView() self.stackView = NSStackView() - self.stackView.orientation = .horizontal + self.stackView.orientation = .vertical self.stackView.distribution = .fillEqually self.stackView.spacing = 20 self.view.addSubview(stackView) @@ -32,10 +34,39 @@ class PreferencesViewController: NSViewController { self.stackView.addArrangedSubview(leftView) self.stackView.addArrangedSubview(rightView) - let iconButton = NSButton(title: "Change Icon", target: self, action: #selector(changeIconButtonPressed)) - let cronButton = NSButton(title: "Cron Script", target: self, action: #selector(cronButtonPressed)) + outputView = NSTextView() + outputView.translatesAutoresizingMaskIntoConstraints = false + rightView.addSubview(outputView) + + NSLayoutConstraint.activate([ + outputView.topAnchor.constraint(equalTo: rightView.topAnchor), + outputView.leadingAnchor.constraint(equalTo: rightView.leadingAnchor), + outputView.trailingAnchor.constraint(equalTo: rightView.trailingAnchor), + outputView.bottomAnchor.constraint(equalTo: rightView.bottomAnchor) + ]) + + + var stackBox: [NSView] = [] + + let icons = iconModel().icon + icons.forEach { (icon) in + stackBox.append(NSButton(title: "Change \(icon) Icon", target: self, action: #selector(changeIconButtonPressed))) + } + + let scripts = Scripts().info + scripts.forEach { (script) in + stackBox.append(NSButton(title: "\(script.name) Script: \(script.description)", target: self, action: #selector(scriptButtonPressed))) + + } + +// let scriptButton = NSButton(title: "Script", target: self, action: #selector(scriptButtonPressed)) + let appleScriptButton = NSButton(title: "Apple Script", target: self, action: #selector(scriptButtonPressed)) let etcButton = NSButton(title: "Etc.", target: self, action: #selector(etcButtonPressed)) - let buttonStackView = NSStackView(views: [iconButton, cronButton, etcButton]) + +// stackBox.append(scriptButton) + stackBox.append(appleScriptButton) + stackBox.append(etcButton) + let buttonStackView = NSStackView(views: stackBox) buttonStackView.orientation = .vertical buttonStackView.distribution = .fillEqually buttonStackView.spacing = 20 @@ -49,12 +80,69 @@ class PreferencesViewController: NSViewController { ]) } - @objc func changeIconButtonPressed() { + @objc func changeIconButtonPressed(_ sender: NSButton) { // Change the content of the right view for icon changing + let icon = sender.title.split(separator: " ").map{String($0)} + print(icon[1]) + menubarVC.menubarStopRunning() + menubarVC.buttonImageChange(icon[1]) + menubarVC.menubarStartRunning() } - @objc func cronButtonPressed() { - // Change the content of the right view for cron script selection + @objc func scriptButtonPressed(_ sender: NSButton) { + let script = sender.title.split(separator: " ").map{String($0)} + if script[1] == "Script:" { + if let scriptPath = Bundle.main.path(forResource: script[0], ofType: "sh") { + let task = Process() + task.launchPath = "/bin/sh" + task.arguments = [scriptPath] + + let outputPipe = Pipe() + task.standardOutput = outputPipe + task.standardError = outputPipe + + + task.standardError = outputPipe + + outputPipe.fileHandleForReading.readabilityHandler = { [weak self] fileHandle in + if #available(OSX 10.15.4, *) { + if let data = try? fileHandle.readToEnd(), let output = String(data: data, encoding: .utf8) { + DispatchQueue.main.async { + if let outputView = self?.outputView { + outputView.string += "\(output)" + } else { + print("outputView is nil") + } + } + } + } else { + // Fallback on earlier versions + } + } + + + task.launch() + task.waitUntilExit() + +// let outputData = outputPipe.fileHandleForReading.readDataToEndOfFile() +// let output = String(data: outputData, encoding: .utf8) ?? "" +// print("Output: \(output)") + } else { + print("Script not found") + } + } else if sender.title == "Apple Script" { + let appleScriptCode = "display dialog \"Hello, World!\"" + + if let appleScript = NSAppleScript(source: appleScriptCode) { + var errorDict: NSDictionary? = nil + appleScript.executeAndReturnError(&errorDict) + + if let error = errorDict { + print("Error: \(error)") + } + } + + } } @objc func etcButtonPressed() { diff --git a/Box42/Resources/Main.storyboard b/Box42/Resources/Main.storyboard index dbd2ec4..0a9696b 100644 --- a/Box42/Resources/Main.storyboard +++ b/Box42/Resources/Main.storyboard @@ -173,67 +173,17 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + - + @@ -266,14 +216,10 @@ - - - - - + diff --git a/Box42/Scripts/Scripts.swift b/Box42/Scripts/Scripts.swift new file mode 100644 index 0000000..96323f7 --- /dev/null +++ b/Box42/Scripts/Scripts.swift @@ -0,0 +1,25 @@ +// +// Scripts.swift +// Box42 +// +// Created by Chanhee Kim on 8/11/23. +// + +import Foundation + +struct Scripts { + var info: [(name: String, description: String)] = [("cleanCache", "cleaning cache"), ("brewInGoinfre", + "brew download in goinfre")] +} + +struct Script { + var id: UUID + var name: String + var description: String + + init(name: String, description: String) { + self.id = UUID() + self.name = name + self.description = description + } +} diff --git a/Box42/Scripts/sh/brewInGoinfre.sh b/Box42/Scripts/sh/brewInGoinfre.sh new file mode 100644 index 0000000..c97c200 --- /dev/null +++ b/Box42/Scripts/sh/brewInGoinfre.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +#42Box: https://github.com/42Box +#Author: chanheki +#Date: 2023/08/10 + +# BOXY FOX +echo "" +echo "\033[38;5;208m Boxy Fox, Brew download in goinfre" +echo "" +echo " ████████" +echo " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒" +echo " ████ ██████" +echo " ██ ████" +echo " ██ ██" +echo " ██ ░░░░░░░░░░░░░░██ ██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░██ ██████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░██ ██████ ██████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░████ ██████████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░░░░░░░░░████ ████████████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░░░░░░░░░░░░░░░░░████ ████████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░████▒▒▒▒░░░░░░░░░░░░░░░░████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒██▓▓▓▓" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░██▒▒████░░░░░░░░░░░░░░░░████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████▒▒██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░████░░░░░░░░░░░░░░████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░████░░░░░░░░░░██████████████░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░▒▒▒▒████░░░░░░██████▒▒▒▒████████░░░░░░░░░░░░░░████▒▒▒▒░░░░░░░░░░██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░████░░░░████░░░░░░██████████░░░░░░████░░░░░░░░░░ ░░░░██" +echo " ░░▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓████▓▓░░░░▒▒████████▓▓▓▓▓▓▓▓▒▒░░░░░░░░░░ ░░░░██" +echo " ░░██░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒██████░░░░░░▒▒▒▒██████▒▒▒▒░░░░░░░░ ░░░░░░░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒████░░░░░░████▒▒ ░░░░░░ ░░░░ ░░░░██" +echo " ░░▓▓▓▓░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▓▓▓▓▓▓▓▓▒▒▒▒░░ ░░░░░░░░░░░░ ░░░░██" +echo " ░░░░▓▓▓▓░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓██▒▒░░░░░░░░░░░░░░ ░░░░ ░░██" +echo " ████░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░ ░░░░░░ ██ ░░██" +echo " ████░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░ ░░░░ ████ ░░██" +echo " ░░░░▓▓▓▓▓▓▓▓██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░ ░░░░ ████ ░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ██ ░░░░ ███▒ ░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ▒▒██ ░░░░ ▒▒▒▒ ░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ████ ░░░░ ██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ████ ██ ██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ██ ████ ██" +echo " ██████ ░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ██" +echo " ████░░████ ░░░░░░░░░░░░░░░░░░░░░░██░░░░ ░░░░░░ ████" +echo " ████░░██░░██████ ░░░░░░░░░░░░░░░░░░██░░░░ ░░░░ ████" +echo " ██░░██░░░░██████████ ░░░░░░░░░░░░░░██░░░░ ██████████" +echo " ██████████████████████ ░░░░░░░░░░██░░░░ ████████████████" +echo " ██████████ ████ ░░░░░░██░░░░ ██████████████████████" +echo " ████ ░░██░░ ████ ████████████████" +echo " ████ ██ ██████████ ██████████" +echo " ████ ██ ████████████████ ██████" +echo " ████ ██ ██████████████████████" +echo " ██████ ████████████████" +echo " ██████████" +echo " ░░██████░░" +echo "" + +brew --version || echo "export PATH=/goinfre/.brew/bin:$PATH" >> ~/.zshrc && brew --version || git clone --depth=1 https://github.com/Homebrew/brew /goinfre/.brew && export PATH=/goinfre/.brew/bin:$PATH && brew update && ln -s /goinfre/.brew ~/.brew + +echo "Download Complete" diff --git a/Box42/Scripts/sh/cleanCache.sh b/Box42/Scripts/sh/cleanCache.sh new file mode 100755 index 0000000..4e0024f --- /dev/null +++ b/Box42/Scripts/sh/cleanCache.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +#42Box: https://github.com/42Box +#Author: chanheki +#Date: 2023/08/10 + +# BOXY FOX +echo "" +echo "\033[38;5;208m Boxy Fox Cleaning Cache" +echo "" +echo " ████████" +echo " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒" +echo " ████ ██████" +echo " ██ ████" +echo " ██ ██" +echo " ██ ░░░░░░░░░░░░░░██ ██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░██ ██████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░██ ██████ ██████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░████ ██████████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░░░░░░░░░████ ████████████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░░░░░░░░░░░░░░░░░████ ████████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░████▒▒▒▒░░░░░░░░░░░░░░░░████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒██▓▓▓▓" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░██▒▒████░░░░░░░░░░░░░░░░████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████▒▒██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░████░░░░░░░░░░░░░░████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░████░░░░░░░░░░██████████████░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░▒▒▒▒████░░░░░░██████▒▒▒▒████████░░░░░░░░░░░░░░████▒▒▒▒░░░░░░░░░░██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░████░░░░████░░░░░░██████████░░░░░░████░░░░░░░░░░ ░░░░██" +echo " ░░▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓████▓▓░░░░▒▒████████▓▓▓▓▓▓▓▓▒▒░░░░░░░░░░ ░░░░██" +echo " ░░██░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒██████░░░░░░▒▒▒▒██████▒▒▒▒░░░░░░░░ ░░░░░░░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒████░░░░░░████▒▒ ░░░░░░ ░░░░ ░░░░██" +echo " ░░▓▓▓▓░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▓▓▓▓▓▓▓▓▒▒▒▒░░ ░░░░░░░░░░░░ ░░░░██" +echo " ░░░░▓▓▓▓░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓██▒▒░░░░░░░░░░░░░░ ░░░░ ░░██" +echo " ████░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░ ░░░░░░ ██ ░░██" +echo " ████░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░ ░░░░ ████ ░░██" +echo " ░░░░▓▓▓▓▓▓▓▓██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░ ░░░░ ████ ░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ██ ░░░░ ███▒ ░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ▒▒██ ░░░░ ▒▒▒▒ ░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ████ ░░░░ ██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ████ ██ ██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ██ ████ ██" +echo " ██████ ░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ██" +echo " ████░░████ ░░░░░░░░░░░░░░░░░░░░░░██░░░░ ░░░░░░ ████" +echo " ████░░██░░██████ ░░░░░░░░░░░░░░░░░░██░░░░ ░░░░ ████" +echo " ██░░██░░░░██████████ ░░░░░░░░░░░░░░██░░░░ ██████████" +echo " ██████████████████████ ░░░░░░░░░░██░░░░ ████████████████" +echo " ██████████ ████ ░░░░░░██░░░░ ██████████████████████" +echo " ████ ░░██░░ ████ ████████████████" +echo " ████ ██ ██████████ ██████████" +echo " ████ ██ ████████████████ ██████" +echo " ████ ██ ██████████████████████" +echo " ██████ ████████████████" +echo " ██████████" +echo " ░░██████░░" +echo "" + +# Command +RED="\033[31m" +GREEN="\033[32m" +YELLOW="\033[33m" +BLUE="\033[34m" +ORANGE="\033[38;5;208m" +# DELINE="\033[K" +# CURSUP="\033[A" +MAGENTA="\033[35m" +CYAN="\033[36m" +RESET="\033[0m" + +# Currently Size +Size=$(df -h ~ | grep ~ | awk '{print($2)}' | tr 'i' 'B') + +# Currently used capacity +Used=$(df -h ~ | grep ~ | awk '{print($3)}' | tr 'i' 'B') + +# Currently available capacity +Avail=$(df -h ~ | grep ~ | awk '{print($4)}' | tr 'i' 'B') +if [ "$Avail" == "0BB" ]; +then + Avail="0B" +fi + +echo "$CYAN Currently used capacity $Used/$Size $RESET\n" + +echo "$MAGENTA Clearing 🧹 cache ... $DELINE $RESET $CURSUP " + +# Trash +echo "$RED Clearing 🧹 trash can ...$DELINE $RESET $CURSUP " +rm -rf ~/.Trash/* &>/dev/null + +# 42 Caches +echo "$RED Clearing 🧹 42Cache ...$DELINE $RESET $CURSUP" +rm -rf ~/Library/*.42* &>/dev/null +rm -rf ~/*.42* &>/dev/null +rm -rf ~/.zcompdump* &>/dev/null +rm -rf ~/.cocoapods.42_cache_bak* &>/dev/null + +# General Caches +echo "$RED Clearing 🧹 Library ...$DELINE $RESET $CURSUP" +chmod -R 644 ~/Library/Caches/Homebrew &>/dev/null +rm -rf ~/Library/Caches/* &>/dev/null +rm -rf ~/Library/Application\ Support/Caches/* &>/dev/null + +echo "$RED Clearing 🧹 Slack ...$DELINE $RESET $CURSUP" +rm -rf ~/Library/Application\ Support/Slack/Service\ Worker/CacheAvail/* &>/dev/null +rm -rf ~/Library/Application\ Support/Slack/Cache/* &>/dev/null + +echo "$RED Clearing 🧹 Discord ...$DELINE $RESET $CURSUP" +rm -rf ~/Library/Application\ Support/discord/Cache/* &>/dev/null +rm -rf ~/Library/Application\ Support/discord/Code\ Cache/js* &>/dev/null +rm -rf ~/Library/Application\ Support/discord/Crashpad/completed/* &>/dev/null + +echo "$RED Clearing 🧹 VS Code ...$DELINE $RESET $CURSUP" +rm -rf ~/Library/Application\ Support/Code/Cache/* &>/dev/null +rm -rf ~/Library/Application\ Support/Code/CachedData/* &>/dev/null +rm -rf ~/Library/Application\ Support/Code/CachedExtensionVSIXs/* &>/dev/null +rm -rf ~/Library/Application\ Support/Code/Crashpad/completed/* &>/dev/null +rm -rf ~/Library/Application\ Support/Code/User/workspaceAvail/* &>/dev/null + +echo "$RED Clearing 🧹 Chrome ...$DELINE $RESET $CURSUP" +rm -rf ~/Library/Application\ Support/Google/Chrome/Profile\ [0-9]/Service\ Worker/CacheAvail/* &>/dev/null +rm -rf ~/Library/Application\ Support/Google/Chrome/Default/Service\ Worker/CacheAvail/* &>/dev/null +rm -rf ~/Library/Application\ Support/Google/Chrome/Profile\ [0-9]/Application\ Cache/* &>/dev/null +rm -rf ~/Library/Application\ Support/Google/Chrome/Default/Application\ Cache/* &>/dev/null +rm -rf ~/Library/Application\ Support/Google/Chrome/Crashpad/completed/* &>/dev/null +# tmp downloaded files with browsers +rm -rf ~/Library/Application\ Support/Chromium/Default/File\ System &>/dev/null +rm -rf ~/Library/Application\ Support/Chromium/Profile\ [0-9]/File\ System &>/dev/null +rm -rf ~/Library/Application\ Support/Google/Chrome/Default/File\ System &>/dev/null +rm -rf ~/Library/Application\ Support/Google/Chrome/Profile\ [0-9]/File\ System &>/dev/null + +# .DS_Store files +#echo "$RED Clearing 🧹 All .DS_Store ...$DELINE $RESET $CURSUP" +#find ~ -name .DS_Store -depth -exec rm {} \; &>/dev/null + +# Delete desktop +rm -rf ~/Desktop/Relocated Items &>/dev/null + +# Calculate usage after cleaning +Used=$(df -h ~ | grep ~ | awk '{print($3)}' | tr 'i' 'B') + +# Calculate usage after cleaning +Avail2=$(df -h ~ | grep ~ | awk '{print($4)}' | tr 'i' 'B') +if [ "$Avail2" == "0BB" ]; +then + Avail2="0B" +fi + +# Output the result +echo "\n$MAGENTA ✨ Complete Clearing cache ✨ $RESET \n" +echo "$GREEN Available/"$RED"Used/"$BLUE"Size "$GREEN"$Avail2/"$RED"$Used/"$BLUE"$Size $RESET\n" +echo "📦: https://github.com/42Box" +echo "🦊: chanheki in 42Box" +echo "" diff --git a/Box42/Scripts/sh/exportMacOSInfo.sh b/Box42/Scripts/sh/exportMacOSInfo.sh new file mode 100644 index 0000000..32eed6b --- /dev/null +++ b/Box42/Scripts/sh/exportMacOSInfo.sh @@ -0,0 +1 @@ +defaults export -g ~/.mysettings.plist diff --git a/Box42/Scripts/sh/importMacOSInfo.sh b/Box42/Scripts/sh/importMacOSInfo.sh new file mode 100644 index 0000000..070f87a --- /dev/null +++ b/Box42/Scripts/sh/importMacOSInfo.sh @@ -0,0 +1 @@ +defaults -currentHost import ~/.mysettings.plist diff --git a/Box42/Scripts/sh/keyMapping.sh b/Box42/Scripts/sh/keyMapping.sh new file mode 100644 index 0000000..3d8010f --- /dev/null +++ b/Box42/Scripts/sh/keyMapping.sh @@ -0,0 +1,146 @@ +#!/bin/sh + +# keyMapping.sh +# Box42 +# +# Created by Chanhee Kim on 8/13/23. +# + +mac_old=(0 0xff00000005 0xff00000004 0xff0100000010 0xff010004 0xff00000009 0xff00000008 0xc000000b4 0xc000000cd 0xc000000b3 0xc000000e2 0xc000000ea 0xc000000e9) +mac_new=(0 0xff00000005 0xff00000004 0xff0100000010 0xc00000221 0xc000000cf 0x10000009b 0xc000000b4 0xc000000cd 0xc000000b3 0xc000000e2 0xc000000ea 0xc000000e9) + +this_mac=(${mac_new[@]}) # change based on "old" or "new" mac / magic keyboard layout + +fn_keys=(0 0x70000003a 0x70000003b 0x70000003c 0x70000003d 0x70000003e 0x70000003f 0x700000040 0x700000041 0x700000042 0x700000043 0x700000044 0x700000045 0x700000068 0x700000069 0x70000006a 0x70000006b 0x70000006c 0x70000006d 0x70000006e) +fn_bri_dec=0xff0100000021 # or 0xc00000070 +fn_bri_inc=0xff0100000020 # or 0xc0000006f +fn_missionc=0xff0100000010 +fn_spotl=0xff0100000001 # or 0xc00000221 +fn_dict=0xc000000cf +fn_dnd=0x10000009b +fn_rew=0xc000000b4 +fn_play=0xc000000cd +fn_fwd=0xc000000b3 +fn_mute=0xc000000e2 +fn_vol_inc=0xc000000ea +fn_vol_dec=0xc000000e9 +fn_kbd_inc=0xff00000008 +fn_kbd_dec=0xff00000009 +fn_launchp=0xff0100000004 +fn_globe=0xff0100000030 +fn_desktop=0x700000044 # or f11 +fn_num_div=0x700000054 +fn_num_mul=0x700000055 +fn_num_sub=0x700000056 +fn_num_add=0x700000057 +fn_num_enter=0x700000058 +fn_num1=0x700000059 +fn_num2=0x70000005a +fn_num3=0x70000005b +fn_num4=0x70000005c +fn_num5=0x70000005d +fn_num6=0x70000005e +fn_num7=0x70000005f +fn_num8=0x700000060 +fn_num9=0x700000061 +fn_num0=0x700000062 +fn_num_dot=0x700000063 +fn_num_equ=0x700000067 + +function help() { + echo "$LESS_TERMCAP_mb$0 $LESS_TERMCAP_md[command]$LESS_TERMCAP_me + where $LESS_TERMCAP_md[command]$LESS_TERMCAP_me is one of: + show display the current user key map + export output the current user key map for creating a LaunchAgent + reset reset user key map to default + default display the default key map (from ioreg) +$LESS_TERMCAP_mb$0 $LESS_TERMCAP_md[n=keycode ...]$LESS_TERMCAP_me + where ${LESS_TERMCAP_us}n$LESS_TERMCAP_ue is 1 to 12 for thefunction key, and + ${LESS_TERMCAP_us}keycode$LESS_TERMCAP_ue is a hex key code starting with 0x +$LESS_TERMCAP_mb$0 $LESS_TERMCAP_md[n=function ...]$LESS_TERMCAP_me + where ${LESS_TERMCAP_us}n$LESS_TERMCAP_ue is 1 to 12 for the function key, and + ${LESS_TERMCAP_us}function$LESS_TERMCAP_ue is one of: + bri_dec | bri_inc decrease / increase display brightness + kbd_dec | kbd_inc decrease / increase keyboard backlight brightness + missionc | launchp show mission control / launchpad + spotl | dict spotlight search / dictation (hold for Siri) + dnd | mute toggle do not disturb / mute + rew | play | fwd rewind / play or pause / fast-forward media + vol_dec | vol_inc decrease / increase volume + globe | desktop show emoji / desktop (same as F11) + num0 to num9 number pad keys, along with: + num_add | num_sub | num_mul | num_div | num_dot | num_equ | num_enter +" +} +function show() { + echo Current user key map + hidutil property -g UserKeyMapping +} +function reset() { + echo Reset user key map + hidutil property -s "{\"UserKeyMapping\":[]}" >/dev/null +} +function default() { + echo Show default key map + ioreg -l | grep -o "\"FnFunctionUsageMap\" = .*" +} +function export() { + x=$(hidutil property -g UserKeyMapping | sed -E "s/(HIDKeyboardModifierMappingDst) = (.*);/\"\1\": \2,/g;s/(HIDKeyboardModifierMappingSrc) = (.*);/\"\1\": \2/g;s/\(/[/;s/\)/]/") + echo ' + + + + Label + com.local.KeyRemapping + ProgramArguments + + /usr/bin/hidutil + property + --set + {"UserKeyMapping":'"$x"' + } + + RunAtLoad + + +' +} +function map() { + y="" + for x in "$@"; do + x=(${x//=/ }) + x0=${x[0]} + x1=${x[1]} + if [[ ${#x[@]} -eq 2 && ( $x0 == [1-9] || $x0 == 1[012]) ]]; then + fn=${this_mac[$x0]} + [[ "$fn" == "" ]] && echo "Error no such key F$x0" && exit -1 + if [[ "$x1" == f[1-9] || "$x1" == f1[0-9] ]]; then + kc=${x1:1} + kc=${fn_keys[$kc]} + [[ "$kc" == "" ]] && echo "Error mapping F$x0 [$fn] to unknown $x1" && exit -1 + echo "Mapping F$x0 [$fn] to HID $x1 [$kc]" + y="{\"HIDKeyboardModifierMappingSrc\":$fn,\"HIDKeyboardModifierMappingDst\":$kc},$y" + elif [[ "$kc" == 0x[0-9A-Fa-f]* && ( ${#kc} -ge 11 && ${#kc} -le 14 ) ]]; then + echo "Mapping F$x0 [$fn] to HID hex code [$kc]" + y="{\"HIDKeyboardModifierMappingSrc\":$fn,\"HIDKeyboardModifierMappingDst\":$kc},$y" + else + kc=fn_$x1 + kc=${!kc} + [[ "$kc" == "" ]] && echo "Error mapping F$x0 [$fn] to unknown $x1" && exit -1 + echo "Mapping F$x0 [$fn] to HID $x1 [$kc]" + y="{\"HIDKeyboardModifierMappingSrc\":$fn,\"HIDKeyboardModifierMappingDst\":$kc},$y" + fi + fi + hidutil property -s "{\"UserKeyMapping\":[${y%?}]}" >/dev/null + done +} +function kbd() { + map 4=kbd_dec 5=kbd_inc +} +if [[ ${#@} -eq 1 && "$1" != *=* ]]; then + [[ $(LC_ALL=C type -t "$1") == "function" && "$1" != "map" ]] && $1 && exit $? +elif [[ ${#@} -ge 1 ]]; then + map "$@" + exit $? +fi +help diff --git a/Box42/Scripts/sh/nodeInstall.sh b/Box42/Scripts/sh/nodeInstall.sh new file mode 100644 index 0000000..767a31a --- /dev/null +++ b/Box42/Scripts/sh/nodeInstall.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +#42Box: https://github.com/42Box +#Author: chanheki +#Date: 2023/08/10 + +# BOXY FOX +echo "" +echo "\033[38;5;208m Boxy Fox Node install" +echo "" +echo " ████████" +echo " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒" +echo " ████ ██████" +echo " ██ ████" +echo " ██ ██" +echo " ██ ░░░░░░░░░░░░░░██ ██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░██ ██████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░██ ██████ ██████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░████ ██████████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░░░░░░░░░████ ████████████" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░░░░░░░░░░░░░░░░░████ ████████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██ ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████" +echo "░░██ ░░░░░░░░░░░░░░░░░░░░░░░░░░████▒▒▒▒░░░░░░░░░░░░░░░░████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒██▓▓▓▓" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░██▒▒████░░░░░░░░░░░░░░░░████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████▒▒██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░████░░░░░░░░░░░░░░████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░████░░░░░░░░░░██████████████░░░░░░░░░░░░░░░░░░░░░░████░░░░░░░░░░██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░▒▒▒▒████░░░░░░██████▒▒▒▒████████░░░░░░░░░░░░░░████▒▒▒▒░░░░░░░░░░██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░████░░░░████░░░░░░██████████░░░░░░████░░░░░░░░░░ ░░░░██" +echo " ░░▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓████▓▓░░░░▒▒████████▓▓▓▓▓▓▓▓▒▒░░░░░░░░░░ ░░░░██" +echo " ░░██░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒██████░░░░░░▒▒▒▒██████▒▒▒▒░░░░░░░░ ░░░░░░░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒████░░░░░░████▒▒ ░░░░░░ ░░░░ ░░░░██" +echo " ░░▓▓▓▓░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▓▓▓▓▓▓▓▓▒▒▒▒░░ ░░░░░░░░░░░░ ░░░░██" +echo " ░░░░▓▓▓▓░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓██▒▒░░░░░░░░░░░░░░ ░░░░ ░░██" +echo " ████░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░ ░░░░░░ ██ ░░██" +echo " ████░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░ ░░░░ ████ ░░██" +echo " ░░░░▓▓▓▓▓▓▓▓██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░ ░░░░ ████ ░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ██ ░░░░ ███▒ ░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ▒▒██ ░░░░ ▒▒▒▒ ░░██" +echo " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ████ ░░░░ ██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ████ ██ ██" +echo " ██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ██ ████ ██" +echo " ██████ ░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░ ██" +echo " ████░░████ ░░░░░░░░░░░░░░░░░░░░░░██░░░░ ░░░░░░ ████" +echo " ████░░██░░██████ ░░░░░░░░░░░░░░░░░░██░░░░ ░░░░ ████" +echo " ██░░██░░░░██████████ ░░░░░░░░░░░░░░██░░░░ ██████████" +echo " ██████████████████████ ░░░░░░░░░░██░░░░ ████████████████" +echo " ██████████ ████ ░░░░░░██░░░░ ██████████████████████" +echo " ████ ░░██░░ ████ ████████████████" +echo " ████ ██ ██████████ ██████████" +echo " ████ ██ ████████████████ ██████" +echo " ████ ██ ██████████████████████" +echo " ██████ ████████████████" +echo " ██████████" +echo " ░░██████░░" +echo "" + + +export N_PREFIX=/goinfre +curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s lts +echo "# bin folder for node.js">>~/.zshrc +echo 'export PATH="$PATH:$HOME/bin"' >> ~/.zshrc +export PATH=/goinfre/bin:$PATH +ln -s /goinfre/bin ~/bin + +echo "Download Complete"