├── 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 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | Default 530 | 531 | 532 | 533 | 534 | 535 | 536 | Left to Right 537 | 538 | 539 | 540 | 541 | 542 | 543 | Right to Left 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | Default 555 | 556 | 557 | 558 | 559 | 560 | 561 | Left to Right 562 | 563 | 564 | 565 | 566 | 567 | 568 | Right to Left 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 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 | --------------------------------------------------------------------------------