├── Surtainly Not
├── Assets.xcassets
│ ├── Contents.json
│ ├── Untitled.imageset
│ │ ├── Untitled.png
│ │ └── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── WindowController.swift
├── Surtainly_Not.entitlements
├── AppDelegate.swift
├── Window.swift
├── Info.plist
├── MenuItemTextField.swift
├── ViewController.swift
└── Base.lproj
│ └── Main.storyboard
├── README.md
├── Surtainly Not.xcodeproj
├── xcuserdata
│ └── thall.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── project.pbxproj
└── LICENSE.md
/Surtainly Not/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Surtainly Not/Assets.xcassets/Untitled.imageset/Untitled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylerhall/SurtainlyNot/master/Surtainly Not/Assets.xcassets/Untitled.imageset/Untitled.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Surtainly Not is a tiny macOS app that makes Big Sur's menu bar opaque.
2 |
3 | It's really just a dumb joke to prove a point.
4 |
5 | [You can read the story behind the app on my blog](https://tyler.io/surtainly-not/).
6 |
--------------------------------------------------------------------------------
/Surtainly Not.xcodeproj/xcuserdata/thall.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/Surtainly Not.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Surtainly Not/WindowController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // WindowController.swift
3 | // Surtainly Not
4 | //
5 | // Created by Tyler Hall on 9/5/20.
6 | // Copyright © 2020 Tyler Hall. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 |
11 | class WindowController: NSWindowController {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/Surtainly Not/Surtainly_Not.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.automation.apple-events
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Surtainly Not.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Surtainly Not/Assets.xcassets/Untitled.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "filename" : "Untitled.png",
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "author" : "xcode",
19 | "version" : 1
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Surtainly Not/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // Surtainly Not
4 | //
5 | // Created by Tyler Hall on 9/5/20.
6 | // Copyright © 2020 Tyler Hall. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 |
11 | @NSApplicationMain
12 | class AppDelegate: NSObject, NSApplicationDelegate {
13 |
14 | func applicationDidFinishLaunching(_ aNotification: Notification) {
15 | // Insert code here to initialize your application
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/Surtainly Not.xcodeproj/xcuserdata/thall.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Surtainly Not.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 | Surtainly Not.xcscheme_^#shared#^_
13 |
14 | orderHint
15 | 0
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Surtainly Not/Window.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Window.swift
3 | // Surtainly Not
4 | //
5 | // Created by Tyler Hall on 9/5/20.
6 | // Copyright © 2020 Tyler Hall. All rights reserved.
7 | //
8 |
9 | import AppKit
10 |
11 | class Window: NSWindow {
12 |
13 | var theFrame: NSRect {
14 | guard let screen = NSScreen.main else { return .zero }
15 | let height: CGFloat = 24
16 | return NSRect(x: 0, y: screen.frame.size.height - height, width: screen.frame.size.width, height: height)
17 | }
18 |
19 | override func awakeFromNib() {
20 | backgroundColor = .windowBackgroundColor
21 | ignoresMouseEvents = true
22 | styleMask = [.borderless]
23 | styleMask.remove(.titled)
24 | orderBack(nil)
25 | level = NSWindow.Level.init(Int(CGWindowLevelForKey(CGWindowLevelKey.mainMenuWindow)))
26 | setFrame(theFrame, display: true)
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | This software is licensed under the [MIT License](https://opensource.org/licenses/MIT).
2 |
3 | Copyright 2020 Tyler Hall.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/Surtainly Not/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "scale" : "1x",
6 | "size" : "16x16"
7 | },
8 | {
9 | "idiom" : "mac",
10 | "scale" : "2x",
11 | "size" : "16x16"
12 | },
13 | {
14 | "idiom" : "mac",
15 | "scale" : "1x",
16 | "size" : "32x32"
17 | },
18 | {
19 | "idiom" : "mac",
20 | "scale" : "2x",
21 | "size" : "32x32"
22 | },
23 | {
24 | "idiom" : "mac",
25 | "scale" : "1x",
26 | "size" : "128x128"
27 | },
28 | {
29 | "idiom" : "mac",
30 | "scale" : "2x",
31 | "size" : "128x128"
32 | },
33 | {
34 | "idiom" : "mac",
35 | "scale" : "1x",
36 | "size" : "256x256"
37 | },
38 | {
39 | "idiom" : "mac",
40 | "scale" : "2x",
41 | "size" : "256x256"
42 | },
43 | {
44 | "idiom" : "mac",
45 | "scale" : "1x",
46 | "size" : "512x512"
47 | },
48 | {
49 | "idiom" : "mac",
50 | "scale" : "2x",
51 | "size" : "512x512"
52 | }
53 | ],
54 | "info" : {
55 | "author" : "xcode",
56 | "version" : 1
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Surtainly Not/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSApplicationCategoryType
24 | public.app-category.utilities
25 | LSMinimumSystemVersion
26 | $(MACOSX_DEPLOYMENT_TARGET)
27 | LSUIElement
28 |
29 | NSAppleEventsUsageDescription
30 | Allow Surtainly Not to read your menu bar.
31 | NSHumanReadableCopyright
32 | Copyright © 2020 Tyler Hall. All rights reserved.
33 | NSMainStoryboardFile
34 | Main
35 | NSPrincipalClass
36 | NSApplication
37 | NSSupportsAutomaticTermination
38 |
39 | NSSupportsSuddenTermination
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Surtainly Not/MenuItemTextField.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MenuItemTextField.swift
3 | // Surtainly Not
4 | //
5 | // Created by Tyler Hall on 9/5/20.
6 | // Copyright © 2020 Tyler Hall. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 |
11 | class MenuItemLabel: NSView {
12 |
13 | var text = ""
14 | var textColor: NSColor = .labelColor
15 | var font = NSFont.systemFont(ofSize: 13)
16 |
17 | var backgroundColor: NSColor = .clear {
18 | didSet {
19 | setNeedsDisplay(bounds)
20 | }
21 | }
22 |
23 | var attrs: [NSAttributedString.Key: Any] {
24 | return [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.backgroundColor: NSColor.clear]
25 | }
26 |
27 | override func draw(_ dirtyRect: NSRect) {
28 | backgroundColor.setFill()
29 | NSBezierPath(rect: bounds).fill()
30 |
31 | let size = (text as NSString).size(withAttributes: attrs)
32 | let iSize = intrinsicContentSize
33 | let point = CGPoint(x: iSize.width / 2 - size.width / 2, y: iSize.height / 2 - size.height / 2)
34 | (text as NSString).draw(at: point, withAttributes: attrs)
35 | }
36 |
37 | override var intrinsicContentSize: NSSize {
38 | let size = (text as NSString).size(withAttributes: attrs)
39 | return NSSize(width: size.width + 20, height: 25)
40 | }
41 |
42 | func track() {
43 | let area = NSTrackingArea(rect: NSRect(origin: .zero, size: intrinsicContentSize), options: [.activeAlways, .mouseEnteredAndExited], owner: self, userInfo: nil)
44 | addTrackingArea(area)
45 | }
46 |
47 | override func mouseEntered(with event: NSEvent) {
48 | super.mouseEntered(with: event)
49 | if NSEvent.pressedMouseButtons > 0 {
50 | backgroundColor = .selectedMenuItemColor
51 | } else {
52 | backgroundColor = .clear
53 | }
54 | }
55 |
56 | override func mouseMoved(with event: NSEvent) {
57 | super.mouseMoved(with: event)
58 | if NSEvent.pressedMouseButtons > 0 {
59 | backgroundColor = .selectedMenuItemColor
60 | } else {
61 | backgroundColor = .clear
62 | }
63 | }
64 |
65 | override func mouseExited(with event: NSEvent) {
66 | super.mouseExited(with: event)
67 | backgroundColor = .clear
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Surtainly Not/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // Surtainly Not
4 | //
5 | // Created by Tyler Hall on 9/5/20.
6 | // Copyright © 2020 Tyler Hall. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 |
11 | class ViewController: NSViewController {
12 |
13 | @IBOutlet weak var stackView: NSStackView!
14 |
15 | lazy var scriptMenuItems: NSAppleScript = {
16 | let script = """
17 | try
18 | tell application "System Events"
19 | set output to ""
20 | set frontmostProcess to first process where it is frontmost
21 | tell frontmostProcess
22 | get every menu bar
23 | tell menu bar 1
24 | repeat with mbitem in every menu bar item
25 | set theTitle to title of mbitem
26 | set output to output & theTitle & "|||"
27 | end repeat
28 | end tell
29 | end tell
30 | end tell
31 | on error errMsg
32 |
33 | end try
34 | """
35 | let appleScript = NSAppleScript(source: script)
36 | appleScript?.compileAndReturnError(nil)
37 | return appleScript!
38 | }()
39 |
40 | override func viewDidLoad() {
41 | NSWorkspace.shared.notificationCenter.addObserver(self, selector: #selector(activeAppDidChange), name: NSWorkspace.didActivateApplicationNotification, object: nil)
42 | activeAppDidChange()
43 | }
44 |
45 | @objc func activeAppDidChange() {
46 | guard let str = scriptMenuItems.executeAndReturnError(nil).stringValue else { return }
47 | var items = str.components(separatedBy: "|||")
48 | guard items.count > 1 else { return }
49 |
50 | for view in stackView.arrangedSubviews {
51 | stackView.removeArrangedSubview(view)
52 | view.removeFromSuperview()
53 | }
54 |
55 | items.remove(at: 0)
56 | items.insert("", at: 0)
57 |
58 | var views = [NSView]()
59 | for i in 0..
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
--------------------------------------------------------------------------------