diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 0fd97602..6fc19fe2 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -24,7 +24,7 @@ body: description: A clear and concise description of what you want to happen. - type: textarea validations: - required: true + required: false attributes: label: Describe alternatives you've considered description: A clear and concise description of any alternative solutions or features you've considered. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f26a34d..d1c65585 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,21 +9,42 @@ concurrency: env: projname: SlimHUD + beta-channel-name: "beta" jobs: - release: - if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/release') && github.event.comment.user.login == github.repository_owner }} - name: "Create Release" - runs-on: macos-12 - environment: sparkle-release + preparation: + name: Preparation job + if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/release') && github.event.comment.user.login == github.repository_owner }} + runs-on: ubuntu-latest steps: + - name: Check if beta + id: check-beta + run: | + if [[ "${{ contains(github.event.comment.body, 'beta') }}" == "true" ]]; then + echo "env=deploy-beta" >> $GITHUB_OUTPUT + else + echo "env=deploy-release" >> $GITHUB_OUTPUT + fi + - name: start deployment + uses: bobheadxi/deployments@v1.3.0 + id: deployment + with: + step: start + token: ${{ secrets.GITHUB_TOKEN }} + env: ${{ steps.check-beta.outputs.env }} + - name: Save deployment id to file + run: echo ${{ steps.deployment.outputs.deployment_id }} > deployment_id + - name: Save deployment id + uses: actions/upload-artifact@master + with: + path: deployment_id + name: deployment_id - name: Add reactions # adding reactions to the comment to show that the action is running uses: peter-evans/create-or-update-comment@v2 with: comment-id: ${{ github.event.comment.id }} reactions: eyes - uses: actions/github-script@v6 # check if the PR is ready to be merged - id: get-run with: result-encoding: string script: | @@ -45,9 +66,6 @@ jobs: id: latest_changes run: | python3 ./Configuration/generate_latest_changes.py - echo "new_version=$(cat new_version)" >> $GITHUB_OUTPUT - echo "old_version=$(cat new_version)" >> $GITHUB_OUTPUT - echo "title=$(cat title)" >> $GITHUB_OUTPUT - name: Check if version already released # prevent releasing the same version twice run: | if [[ $(xcrun agvtool what-version -terse) == $(cat new_version) ]]; then @@ -60,9 +78,49 @@ jobs: echo "Release notes are empty" >> $GITHUB_STEP_SUMMARY exit 1 fi + - name: Save generated info + uses: actions/upload-artifact@master + with: + path: | + new_version + title + latest_changes + - name: Clean up generated files for sync + run: | + rm latest_changes + rm title + rm new_version + - name: Sync branch + uses: devmasx/merge-branch@master + with: + type: now + from_branch: ${{ steps.comment-branch.outputs.base_ref }} + target_branch: ${{ steps.comment-branch.outputs.head_ref }} + github_token: ${{ github.token }} + message: "Sync branch" + + archive: + name: Build and export app + runs-on: macos-12 + needs: preparation + steps: + - uses: actions/download-artifact@master # download all previously generated artifacts + with: + path: artifacts + - name: Parse info generated in preparation job + id: info + run: | + echo "new_version=$(cat artifacts/artifact/new_version)" >> $GITHUB_OUTPUT + echo "title=$(cat artifacts/artifact/title)" >> $GITHUB_OUTPUT + - uses: xt0rted/pull-request-comment-branch@v1 # check out branch of PR + id: comment-branch + - uses: actions/checkout@v3 + if: success() + with: + ref: ${{ steps.comment-branch.outputs.head_ref }} - name: Override versions in project # set new version in project run: | - sed -i '' "s/_VERSION = $(xcrun agvtool what-version -terse)/_VERSION = ${{ steps.latest_changes.outputs.new_version }}/g" ${{ env.projname }}.xcodeproj/project.pbxproj; + sed -i '' "s/_VERSION = $(xcrun agvtool what-version -terse)/_VERSION = ${{ steps.info.outputs.new_version }}/g" ${{ env.projname }}.xcodeproj/project.pbxproj; - name: Install the Apple certificate and provisioning profile # install the Apple certificate and provisioning profile # following https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development @@ -105,76 +163,222 @@ jobs: run: | cd Release ditto -c -k --sequesterRsrc --keepParent ${{ env.projname }}.app ${{ env.projname }}.zip - cd .. + - name: Upload achived app + uses: actions/upload-artifact@master + with: + name: app + path: Release/${{ env.projname }}.zip + + pre-release: + name: Create pre-release + runs-on: macos-12 + environment: deploy-beta + needs: archive + if: ${{ contains(github.event.comment.body, 'beta') }} + steps: + - uses: xt0rted/pull-request-comment-branch@v1 # check out branch of PR + id: comment-branch + - uses: actions/checkout@v3 + if: success() + with: + ref: ${{ steps.comment-branch.outputs.head_ref }} + - uses: actions/download-artifact@master # download all previously generated artifacts + with: + path: artifacts + - name: Parse info generated in preparation job + id: info + run: | + echo "new_version=$(cat artifacts/artifact/new_version)" >> $GITHUB_OUTPUT + echo "title=$(cat artifacts/artifact/title)" >> $GITHUB_OUTPUT + mv artifacts/artifact/new_version new_version + mv artifacts/artifact/title title + mv artifacts/artifact/latest_changes latest_changes + mkdir Release + mv artifacts/app/${{ env.projname }}.zip Release/ - name: Prepare Sparkle update creation # Import Sparkle private key, remove unnecessary files in Release folder env: PRIVATE_SPARKLE_KEY: ${{ secrets.PRIVATE_SPARKLE_KEY }} run: | + echo -n "$PRIVATE_SPARKLE_KEY" > ./Configuration/sparkle_private_key + - name: Generate Sparkle notes # generate Sparkle release notes (convert Markdown to HTML) + run: | + pip3 install -r Configuration/requirements.txt + python3 ./Configuration/generate_html_for_sparkle_release.py + mv Release/latest_changes.html Release/${{ env.projname }}.html + - name: Update appcast # generate / update appcast.xml with edDSA key + run: | + ./Configuration/generate_appcast \ + --ed-key-file Configuration/sparkle_private_key \ + --link https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases \ + --download-url-prefix https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases/download/v${{ steps.info.outputs.new_version }}-beta/ \ + --channel ${{ env.beta-channel-name }} \ + -o docs/Support/appcast.xml \ + Release/ + - name: Save generated appcast + uses: actions/upload-artifact@master + with: + name: appcast + path: docs/Support/appcast.xml + - name: Create GitHub beta release # Upload .zip to GitHub release + uses: softprops/action-gh-release@v1 + with: + name: v${{ steps.info.outputs.new_version }}b - ${{ steps.info.outputs.title }} + tag_name: v${{ steps.info.outputs.new_version }}-beta + fail_on_unmatched_files: true + body_path: latest_changes + files: Release/${{ env.projname }}.zip + prerelease: true + draft: false + - name: Create summary # create summary for PR + run: | + echo "Beta Release v${{ steps.info.outputs.new_version }} created" > $GITHUB_STEP_SUMMARY + - uses: actions/checkout@v3 # checkout on the branch used by GH Pages + if: success() + with: + ref: ${{ steps.comment-branch.outputs.base_ref }} # in this case it's 'master' + - name: Remove old appcast # remove old appcast + run: rm -rf docs/Support/appcast.xml + - name: Retrieve previously generated appcast + uses: actions/download-artifact@master + with: + name: appcast + path: docs/Support + - name: Saving appcast # commits only appcast to main + uses: stefanzweifel/git-auto-commit-action@v4 + id: commit-appcast + with: + file_pattern: docs/Support/appcast.xml + commit_message: "Update appcast with beta release for v${{ steps.info.outputs.new_version }}" + + release: + name: "Create Release" + runs-on: macos-latest + environment: deploy-release + needs: archive + if: ${{ !contains(github.event.comment.body, 'beta') }} + steps: + - uses: xt0rted/pull-request-comment-branch@v1 # check out branch of PR + id: comment-branch + - uses: actions/checkout@v3 + if: success() + with: + ref: ${{ steps.comment-branch.outputs.head_ref }} + - uses: actions/download-artifact@master # download all previously generated artifacts + with: + path: artifacts + - name: Parse info generated in preparation job + id: info + run: | + echo "new_version=$(cat artifacts/artifact/new_version)" >> $GITHUB_OUTPUT + echo "title=$(cat artifacts/artifact/title)" >> $GITHUB_OUTPUT + mv artifacts/artifact/new_version new_version + mv artifacts/artifact/title title + mv artifacts/artifact/latest_changes latest_changes + mkdir Release + mv artifacts/app/${{ env.projname }}.zip Release/ + - name: Prepare Sparkle update creation # Import Sparkle private key, remove unnecessary files in Release folder + env: + PRIVATE_SPARKLE_KEY: ${{ secrets.PRIVATE_SPARKLE_KEY }} + run: | + echo -n "$PRIVATE_SPARKLE_KEY" > ./Configuration/sparkle_private_key rm -rf Release/*.app rm -rf Release/*.log rm -rf Release/*.plist - - name: Generate Sparkle notes # generate Sparkle release notes (convert Markdown to HTML) + - name: Preparate Sparkle # generate Sparkle release notes (convert Markdown to HTML), remove beta item if present run: | pip3 install -r Configuration/requirements.txt python3 ./Configuration/generate_html_for_sparkle_release.py mv Release/latest_changes.html Release/${{ env.projname }}.html + python3 ./Configuration/remove_last_item_appcast.py - name: Update appcast # generate / update appcast.xml with edDSA key run: | - echo "$PRIVATE_SPARKLE_KEY" | ./Configuration/generate_appcast \ - --ed-key-file - \ + ./Configuration/generate_appcast \ + --ed-key-file Configuration/sparkle_private_key \ --link https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases \ - --download-url-prefix https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases/download/v${{ steps.latest_changes.outputs.new_version }}/ \ + --download-url-prefix https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases/download/v${{ steps.info.outputs.new_version }}/ \ -o docs/Support/appcast.xml \ Release/ - name: Create GitHub release # Upload .zip to GitHub release uses: softprops/action-gh-release@v1 with: - name: ${{ steps.latest_changes.outputs.title }} - tag_name: v${{ steps.latest_changes.outputs.new_version }} + name: v${{ steps.info.outputs.new_version }} - ${{ steps.info.outputs.title }} + tag_name: v${{ steps.info.outputs.new_version }} fail_on_unmatched_files: true body_path: latest_changes + files: Release/${{ env.projname }}.zip draft: false - files: | - Release/${{ env.projname }}.zip - - name: Cleanup # remove all build files, keys, etc. - run: | - rm -rf Release - rm -rf ${{ env.projname }}.xcarchive - rm -rf ${{ env.projname }}.zip - rm -rf latest_changes - rm -rf new_version - rm -rf old_version - rm -rf title + prerelease: ${{ steps.channel.outputs.prerelease }} - name: Saving changes # commits changes to branch (version bump, appcast.xml) uses: stefanzweifel/git-auto-commit-action@v4 with: - commit_message: "Update version to v${{ steps.latest_changes.outputs.new_version }}" + file_pattern: | + docs/Support/appcast.xml + ${{ env.projname }}.xcodeproj/project.pbxproj + commit_message: "Update version to v${{ steps.info.outputs.new_version }}" - name: Create summary # create summary for PR run: | - echo "Release v${{ steps.latest_changes.outputs.new_version }} created" >> $GITHUB_STEP_SUMMARY - - uses: xt0rted/pull-request-comment-branch@v1 # checkout again, because the previous checkout is detached - id: comment-branch-2 - - uses: actions/checkout@v3 - if: success() + echo "Release v${{ steps.info.outputs.new_version }} created." > $GITHUB_STEP_SUMMARY + + ending: + name: Ending job + if: always() + runs-on: ubuntu-latest + needs: [pre-release, release] + steps: + - uses: xt0rted/pull-request-comment-branch@v1 # check out branch of PR + id: comment-branch + - uses: actions/checkout@v3 # checkout again, because the previous checkout is detached with: - ref: ${{ steps.comment-branch-2.outputs.head_ref }} + ref: ${{ steps.comment-branch.outputs.head_ref }} - name: Merge PR # merge PR - uses: "pascalgn/automerge-action@v0.15.5" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - MERGE_COMMIT_MESSAGE: "Release version v${{ steps.latest_changes.outputs.new_version }}" - MERGE_FILTER_AUTHOR: "${{ github.repository_owner }}" - MERGE_ERROR_FAIL: true - MERGE_LABELS: "" # no labels necessary for the PR to be merged + uses: devmasx/merge-branch@master + if: ${{ contains(join(needs.*.result, ','), 'success') && !contains(github.event.comment.body, 'beta') }} + with: + type: now + from_branch: ${{ steps.comment-branch.outputs.head_ref }} + target_branch: ${{ steps.comment-branch.outputs.base_ref }} + github_token: ${{ github.token }} + message: "Release version v${{ steps.info.outputs.new_version }}" + - name: Download artifacts # download deployment-id + uses: actions/download-artifact@master + with: + name: deployment_id + - uses: geekyeggo/delete-artifact@v2 # delete artifacts + with: + name: "*" - name: Add success reactions # Adding reactions to comment depending on result + if: ${{ contains(join(needs.*.result, ','), 'success') }} uses: peter-evans/create-or-update-comment@v2 with: comment-id: ${{ github.event.comment.id }} reactions: rocket - name: Add negative reaction - if: failure() + if: ${{ contains(join(needs.*.result, ','), 'failure') }} uses: peter-evans/create-or-update-comment@v2 with: comment-id: ${{ github.event.comment.id }} reactions: confused + - name: update deployment status + uses: bobheadxi/deployments@v1.3.0 + if: ${{ always() && !contains(github.event.comment.body, 'beta') }} + with: + step: finish + token: ${{ secrets.GITHUB_TOKEN }} + status: ${{ needs.release.status }} + env: deploy-release + deployment_id: $(cat artifacts/artifact/deployment_id) + - name: Output jobs output + if: ${{ always() && contains(github.event.comment.body, 'beta') }} + run: | + echo $(cat artifacts/artifact/deployment_id) + echo ${{ needs.pre-release.status }} + - name: update deployment status + uses: bobheadxi/deployments@v1.3.0 + if: ${{ always() && contains(github.event.comment.body, 'beta') }} + with: + step: finish + token: ${{ secrets.GITHUB_TOKEN }} + status: ${{ needs.pre-release.status }} + env: deploy-beta + deployment_id: $(cat artifacts/artifact/deployment_id) diff --git a/.github/workflows/xcode-build.yml b/.github/workflows/xcode-build.yml index e2874c6f..0995c960 100644 --- a/.github/workflows/xcode-build.yml +++ b/.github/workflows/xcode-build.yml @@ -41,19 +41,11 @@ jobs: title: ${{ env.test-results-check-name }} upload-bundles: never show-code-coverage: true - - wait-for-results-creation: - runs-on: ubuntu-latest - needs: unit-tests-run - if: success() || failure() - steps: - - name: Wait 15 seconds - run: sleep 15 create-comment-unit-tests-with-coverage: runs-on: ubuntu-latest - needs: wait-for-results-creation - if: github.event_name == 'pull_request' + needs: unit-tests-run + if: github.event_name == 'pull_request' && (success() || failure()) steps: - uses: actions/github-script@v6 id: get-run diff --git a/Release_Notes.md b/Release_Notes.md index afaa6aff..30bc1477 100644 --- a/Release_Notes.md +++ b/Release_Notes.md @@ -2,7 +2,7 @@ * Add option to make inside bar flat or round * Fix bug: icons not centered * Fix bug: HUDs not resizable -* FIx bug: popovers memory leak in settings window +* Fix bug: popovers memory leak in settings window # 1.4.0 - Fixes * Fix bug: hud too near to the screen edge diff --git a/SlimHUD.xcodeproj/project.pbxproj b/SlimHUD.xcodeproj/project.pbxproj index 9a1c1fd3..b60d2806 100644 --- a/SlimHUD.xcodeproj/project.pbxproj +++ b/SlimHUD.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ FA64B5A72966579D00600F85 /* swift-lint.yml in Resources */ = {isa = PBXBuildFile; fileRef = FA64B5A32966579D00600F85 /* swift-lint.yml */; }; FA64B5A82966579D00600F85 /* xcode-ui-tests.yml in Resources */ = {isa = PBXBuildFile; fileRef = FA64B5A42966579D00600F85 /* xcode-ui-tests.yml */; }; FA64B5AB2966645100600F85 /* SinglePopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA64B5AA2966645100600F85 /* SinglePopover.swift */; }; + FA7899C9296E36AB00120000 /* SparkleUpdaterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7899C8296E36AB00120000 /* SparkleUpdaterDelegate.swift */; }; FA95EDF52956FCBF005B39CD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA95EDF42956FCBF005B39CD /* AppDelegate.swift */; }; FA95EDF92956FCC1005B39CD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA95EDF82956FCC1005B39CD /* Assets.xcassets */; }; FA95EE132956FCC1005B39CD /* SlimHUDUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA95EE122956FCC1005B39CD /* SlimHUDUITestsLaunchTests.swift */; }; @@ -102,6 +103,7 @@ FA64B5A32966579D00600F85 /* swift-lint.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.yaml; path = "swift-lint.yml"; sourceTree = ""; }; FA64B5A42966579D00600F85 /* xcode-ui-tests.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.yaml; path = "xcode-ui-tests.yml"; sourceTree = ""; }; FA64B5AA2966645100600F85 /* SinglePopover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SinglePopover.swift; sourceTree = ""; }; + FA7899C8296E36AB00120000 /* SparkleUpdaterDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SparkleUpdaterDelegate.swift; sourceTree = ""; }; FA95EDF12956FCBF005B39CD /* SlimHUD.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SlimHUD.app; sourceTree = BUILT_PRODUCTS_DIR; }; FA95EDF42956FCBF005B39CD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; FA95EDF82956FCC1005B39CD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -304,6 +306,7 @@ FA95EE452956FE2A005B39CD /* PositionManager.swift */, FA95EE472956FE37005B39CD /* Displayer.swift */, FA95EE492956FE44005B39CD /* SettingsManager.swift */, + FA7899C8296E36AB00120000 /* SparkleUpdaterDelegate.swift */, ); path = Services; sourceTree = ""; @@ -592,6 +595,7 @@ FA95EE4F2956FE69005B39CD /* NSViewExtension.swift in Sources */, FA95EE4D2956FE5D005B39CD /* EnabledBars.swift in Sources */, FA95EE552956FE86005B39CD /* NSImageExtension.swift in Sources */, + FA7899C9296E36AB00120000 /* SparkleUpdaterDelegate.swift in Sources */, FA95EE402956FE06005B39CD /* UserDefaultsManager.swift in Sources */, FA95EE6829573EEF005B39CD /* BarView.swift in Sources */, FA95EE612956FED6005B39CD /* SensorError.swift in Sources */, diff --git a/SlimHUD/Controllers/SettingsViewController/SettingsViewController.swift b/SlimHUD/Controllers/SettingsViewController/SettingsViewController.swift index ddde6b28..ba567855 100644 --- a/SlimHUD/Controllers/SettingsViewController/SettingsViewController.swift +++ b/SlimHUD/Controllers/SettingsViewController/SettingsViewController.swift @@ -8,7 +8,7 @@ import Cocoa import Sparkle -class SettingsViewController: NSViewController { +class SettingsViewController: NSViewController, SPUUpdaterDelegate { let loginItemsList = LoginItemsList() var settingsManager: SettingsManager = SettingsManager.getInstance() @@ -16,6 +16,15 @@ class SettingsViewController: NSViewController { weak var delegate: HudsControllerInterface? @IBOutlet var spuStandardUpdaterController: SPUStandardUpdaterController! + @IBOutlet weak var checkBetaUpdatesOutlet: NSButton! + func allowedChannels(for updater: SPUUpdater) -> Set { + if checkBetaUpdatesOutlet.boolValue() { + return Set(["beta"]) + } else { + return Set() + } + } + override func awakeFromNib() { super.awakeFromNib() // swiftlint:disable:next force_cast diff --git a/SlimHUD/Extensions/NSImageExtension.swift b/SlimHUD/Extensions/NSImageExtension.swift index b775de52..f5d75a8d 100644 --- a/SlimHUD/Extensions/NSImageExtension.swift +++ b/SlimHUD/Extensions/NSImageExtension.swift @@ -21,7 +21,7 @@ extension NSImage { let image = self.copy() as! NSImage self.lockFocus() color.set() - let srcSpacePortionRect = NSRect(origin: NSZeroPoint, size: image.size) + let srcSpacePortionRect = NSRect(origin: NSPoint.zero, size: image.size) srcSpacePortionRect.fill(using: .sourceAtop) self.unlockFocus() return image diff --git a/SlimHUD/Services/Displayer.swift b/SlimHUD/Services/Displayer.swift index 3532a67f..0c51ad21 100644 --- a/SlimHUD/Services/Displayer.swift +++ b/SlimHUD/Services/Displayer.swift @@ -202,7 +202,7 @@ class Displayer: HudsControllerInterface { barView.bar.layer?.cornerRadius = thickness/2 // setting up outer layer barView.bar.frame.size.width = thickness } - + @available(OSX 10.14, *) func setVolumeIconsTint(_ color: NSColor) { getIcon(hud: volumeHud).contentTintColor = color diff --git a/SlimHUD/Services/SparkleUpdaterDelegate.swift b/SlimHUD/Services/SparkleUpdaterDelegate.swift new file mode 100644 index 00000000..faf50bf3 --- /dev/null +++ b/SlimHUD/Services/SparkleUpdaterDelegate.swift @@ -0,0 +1,12 @@ +// +// SparkleUpdaterDelegate.swift +// SlimHUD +// +// Created by Alex Perathoner on 11/01/23. +// + +import Cocoa +import Sparkle + +class SparkleUpdaterDelegate: NSObject { +} diff --git a/SlimHUD/Views/Settings/Settings.storyboard b/SlimHUD/Views/Settings/Settings.storyboard index ffa520a6..cee87b92 100644 --- a/SlimHUD/Views/Settings/Settings.storyboard +++ b/SlimHUD/Views/Settings/Settings.storyboard @@ -152,8 +152,26 @@ + + - + @@ -164,23 +182,13 @@ - + - @@ -202,7 +210,7 @@ - + @@ -217,7 +225,7 @@ - + @@ -803,6 +811,7 @@ + @@ -830,7 +839,12 @@ - + + + + + + @@ -912,7 +926,7 @@ - + diff --git a/SlimHUD/Views/Settings/SettingsView.swift b/SlimHUD/Views/Settings/SettingsView.swift index e001fab5..d2d640fd 100644 --- a/SlimHUD/Views/Settings/SettingsView.swift +++ b/SlimHUD/Views/Settings/SettingsView.swift @@ -53,7 +53,7 @@ class SettingsController: NSView, HudsControllerInterface { keyboardBar.foreground = DefaultColors.Azure setBackgroundColor(color: DefaultColors.DarkGray) } - + @available(OSX 10.14, *) func setupDefaultIconsColors() { settingsManager.volumeIconColor = .white @@ -122,17 +122,17 @@ class SettingsController: NSView, HudsControllerInterface { keyboardView.isHidden = !enabledBars.keyboardBar } } - + // FIXME: changing icons tint in preview only works if instantiation AND tinting are called twice @available(OSX 10.14, *) func setVolumeIconsTint(_ color: NSColor, enabled: Bool) { - if(enabled) { + if enabled { volumeImage.image = NSImage(named: NSImage.VolumeImageFileName) } else { volumeImage.image = NSImage(named: NSImage.NoVolumeImageFileName) } volumeImage.image = volumeImage.image?.tint(with: color) - if(enabled) { + if enabled { volumeImage.image = NSImage(named: NSImage.VolumeImageFileName) } else { volumeImage.image = NSImage(named: NSImage.NoVolumeImageFileName) @@ -168,7 +168,7 @@ class SettingsController: NSView, HudsControllerInterface { setBrightnessColor(color: settingsManager.brightnessColor) setKeyboardColor(color: settingsManager.keyboardColor) setShouldUseAnimation(shouldUseAnimation: settingsManager.shouldUseAnimation) - + if #available(OSX 10.14, *) { setVolumeIconsTint(settingsManager.volumeIconColor) setBrightnessIconsTint(settingsManager.brightnessIconColor)