Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
icecreammachine committed Nov 19, 2024
1 parent bfa5e6d commit f2d2db0
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 101 deletions.
72 changes: 20 additions & 52 deletions Bluesnooze.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 77;
objects = {

/* Begin PBXBuildFile section */
4F229ABE243CC29500B1784C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F229ABD243CC29500B1784C /* AppDelegate.swift */; };
4F229AC0243CC29600B1784C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4F229ABF243CC29600B1784C /* Assets.xcassets */; };
4F229AC3243CC29600B1784C /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4F229AC1243CC29600B1784C /* MainMenu.xib */; };
4FDC9C13243DCC0300FB0C4E /* LaunchAtLogin.framework.dSYM in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4FDC9C12243DCC0300FB0C4E /* LaunchAtLogin.framework.dSYM */; };
4FDC9C14243DCC6B00FB0C4E /* LaunchAtLogin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FDC9C0E243DCB7B00FB0C4E /* LaunchAtLogin.framework */; };
4FDC9C15243DCC6B00FB0C4E /* LaunchAtLogin.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4FDC9C0E243DCB7B00FB0C4E /* LaunchAtLogin.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -22,7 +19,6 @@
dstPath = "";
dstSubfolderSpec = 16;
files = (
4FDC9C13243DCC0300FB0C4E /* LaunchAtLogin.framework.dSYM in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -32,7 +28,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
4FDC9C15243DCC6B00FB0C4E /* LaunchAtLogin.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -47,16 +42,13 @@
4F229AC4243CC29600B1784C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
4F229AC5243CC29600B1784C /* Bluesnooze.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Bluesnooze.entitlements; sourceTree = "<group>"; };
4F229ACB243CC72800B1784C /* Bluesnooze-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bluesnooze-Bridging-Header.h"; sourceTree = "<group>"; };
4FDC9C0E243DCB7B00FB0C4E /* LaunchAtLogin.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LaunchAtLogin.framework; path = Carthage/Build/Mac/LaunchAtLogin.framework; sourceTree = "<group>"; };
4FDC9C12243DCC0300FB0C4E /* LaunchAtLogin.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = LaunchAtLogin.framework.dSYM; path = Carthage/Build/Mac/LaunchAtLogin.framework.dSYM; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
4F229AB7243CC29500B1784C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4FDC9C14243DCC6B00FB0C4E /* LaunchAtLogin.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -96,8 +88,6 @@
4FDC9C0D243DCB7B00FB0C4E /* Frameworks */ = {
isa = PBXGroup;
children = (
4FDC9C12243DCC0300FB0C4E /* LaunchAtLogin.framework.dSYM */,
4FDC9C0E243DCB7B00FB0C4E /* LaunchAtLogin.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -115,7 +105,6 @@
4F229AB8243CC29500B1784C /* Resources */,
4FDC9C0C243DCB0B00FB0C4E /* CopyFiles */,
4FDC9C16243DCC6B00FB0C4E /* Embed Frameworks */,
4FDC9C11243DCBD700FB0C4E /* Run Script */,
);
buildRules = (
);
Expand Down Expand Up @@ -144,14 +133,14 @@
};
};
buildConfigurationList = 4F229AB5243CC29500B1784C /* Build configuration list for PBXProject "Bluesnooze" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 4F229AB1243CC29500B1784C;
preferredProjectObjectVersion = 77;
productRefGroup = 4F229ABB243CC29500B1784C /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -192,25 +181,6 @@
shellPath = /bin/sh;
shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\n\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
4FDC9C11243DCBD700FB0C4E /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Script";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh\"\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -288,7 +258,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -344,7 +314,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
Expand All @@ -359,27 +329,26 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Bluesnooze/Bluesnooze.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 7X3FR535W8;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
FRAMEWORK_SEARCH_PATHS = "";
INFOPLIST_FILE = Bluesnooze/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.2;
PRODUCT_BUNDLE_IDENTIFIER = com.oliverpeate.Bluesnooze;
MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = com.icecreammachine.Bluesnooze;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Bluesnooze/Bluesnooze-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
};
name = Debug;
};
Expand All @@ -389,26 +358,25 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Bluesnooze/Bluesnooze.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 7X3FR535W8;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
FRAMEWORK_SEARCH_PATHS = "";
INFOPLIST_FILE = Bluesnooze/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.2;
PRODUCT_BUNDLE_IDENTIFIER = com.oliverpeate.Bluesnooze;
MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = com.icecreammachine.Bluesnooze;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Bluesnooze/Bluesnooze-Bridging-Header.h";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand Down
17 changes: 2 additions & 15 deletions Bluesnooze/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

import Cocoa
import IOBluetooth
import LaunchAtLogin

@NSApplicationMain
@main
class AppDelegate: NSObject, NSApplicationDelegate {

@IBOutlet weak var statusMenu: NSMenu!
Expand All @@ -20,18 +19,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {

func applicationDidFinishLaunching(_ aNotification: Notification) {
initStatusItem()
setLaunchAtLoginState()
setupNotificationHandlers()
setBluetooth(powerOn: true)
}

// MARK: Click handlers

@IBAction func launchAtLoginClicked(_ sender: NSMenuItem) {
LaunchAtLogin.isEnabled = !LaunchAtLogin.isEnabled
setLaunchAtLoginState()
}

@IBAction func quitClicked(_ sender: NSMenuItem) {
NSApplication.shared.terminate(self)
}
Expand Down Expand Up @@ -62,7 +54,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {

// MARK: UI state

private func initStatusItem() {
@MainActor private func initStatusItem() {
if UserDefaults.standard.bool(forKey: "hideIcon") {
return
}
Expand All @@ -75,9 +67,4 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
statusItem.menu = statusMenu
}

private func setLaunchAtLoginState() {
let state = LaunchAtLogin.isEnabled ? NSControl.StateValue.on : NSControl.StateValue.off
launchAtLoginMenuItem.state = state
}
}
11 changes: 2 additions & 9 deletions Bluesnooze/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23094" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23094"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
Expand All @@ -14,19 +14,12 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Bluesnooze" customModuleProvider="target">
<connections>
<outlet property="launchAtLoginMenuItem" destination="I9E-pI-lLm" id="DFX-bS-N3m"/>
<outlet property="statusMenu" destination="AEO-aA-1fp" id="ueI-UR-7ba"/>
</connections>
</customObject>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu id="AEO-aA-1fp">
<items>
<menuItem title="Launch at login" id="I9E-pI-lLm" userLabel="Launch At Login Menu Item">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="launchAtLoginClicked:" target="Voe-Tx-rLC" id="ooK-DW-6Kn"/>
</connections>
</menuItem>
<menuItem title="Quit" id="0IH-xa-Tvk">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
Expand Down
2 changes: 2 additions & 0 deletions Bluesnooze/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@
<true/>
<key>NSSupportsSuddenTermination</key>
<true/>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>This app uses Bluetooth to connect to devices and transfer data.</string>
</dict>
</plist>
1 change: 0 additions & 1 deletion Cartfile

This file was deleted.

1 change: 0 additions & 1 deletion Cartfile.resolved

This file was deleted.

25 changes: 2 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,7 @@

# Bluesnooze

[Download the latest release][download-latest] or install via Homebrew:

```sh
brew install bluesnooze
```

Please note the latest release requires MacOS Monterey (12.0) or higher.

## Enjoying Bluesnooze? ❤️

Perhaps you could [buy me a coffee](https://www.buymeacoffee.com/odlp) to say thanks :coffee:
Please note the latest release requires MacOS Sequoia (15.0) or higher.

## About

Expand All @@ -24,31 +14,20 @@ With Bluesnooze the Bluetooth connection is switched off when your Mac sleeps, a

![Screenshot showing Bluesnooze in the status bar](images/screenshot.png)

You might also want to check-out Whisper – [the volume limiter for MacOS](https://apps.apple.com/gb/app/whisper-volume-limiter/id1438132944?mt=12).

## Installation

1. Download `Bluesnooze.zip` from the [latest release][download-latest]
1. In Finder, open `Bluesnooze.zip` in your `Downloads` directory
1. Drag `Bluesnooze.app` to your `Applications` directory
1. *Optional*: Configure 'Launch at login'

## Caveats

- Please note this app is not compatible with the “Allow your Apple Watch to unlock your Mac” feature.
- Unfortunately this app can't be distributed via the App Store because it uses a private API to switch Bluetooth on/off (but the release version is notarized by Apple).

[download-latest]: https://github.com/odlp/bluesnooze/releases/latest
[download-latest]: https://github.com/icecreammachine/bluesnooze/releases

## FAQs

### Can you add support for selectively disconnecting certain devices?

Bluesnooze is a really simple app which toggles the Bluetooth power on/off.
Disconnecting specific devices would require a complete rewrite, and I don't
need this functionality or the complexity it brings. Please feel free to fork &
experiment as you like ✌️

### How can I hide the Bluesnooze icon?

In your terminal run the following command:
Expand Down

0 comments on commit f2d2db0

Please sign in to comment.