• Stars
    star
    105
  • Rank 317,589 (Top 7 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 7 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

macOS status bar popups done right ๐Ÿ˜Ž

MBPopup

MBPopup is a macOS framework for easily adding a customizable status bar popup to your apps.

MBPopup is based on Popup by shpakovski, after it had been used in HAPU for 3+ years and incrementally improved on, and is now rewritten for Swift and improved for the Swift era.

More importantly, multiple parts have been rewritten in order to replicate the behavior of system menu bar items:

  • Opens with the right event
  • Closes on escape
  • Allows peeking (hold click to open then release to close)
  • Opens in the correct screen when clicked from a different (in)active screen
  • Changes focus as expected
  • etc.

While also,

  • Reacting to Auto Layout constraints as expected
  • Providing callbacks for user actions
  • Allowing for different states when modifier keys are used

MBPopup is App Store-approved and is currently being used in the app stts:

Usage

(For more examples, check the Example project, or stts' source)

Add MBPopup via Carthage:

Cartfile

github "inket/MBPopup"

or via CocoaPods:

Podfile

pod "MBPopup"

Use MBPopup in your app:

import MBPopup

let myView = NSView(frame: CGRect(x: 0, y: 0, width: 200, height: 300))
let popupController = MBPopupController(contentView: myView)

// Use popupController.statusItem to customize the NSStatusItem, set a title or an image
popupController.statusItem.title = "Test"
popupController.statusItem.length = 70

// Use popupController.backgroundView to customize the popup's background
popupController.backgroundView.backgroundColor = NSColor.windowBackgroundColor // Default value

// Customize animations, view sizes
popupController.openDuration = 0.15 // Default value
popupController.closeDuration = 0.2 // Default value
popupController.arrowSize = CGSize(width: 12, height: 8) // Default value
popupController.contentInset = 1 // Default value

// Use callbacks to user actions (optional)
popupController.shouldOpenPopup = { keys in return true }
popupController.willOpenPopup = { keys in debugPrint("Will open popup!") }
popupController.didOpenPopup = { debugPrint("Opened popup!") }
popupController.willClosePopup = { debugPrint("Will close popup!") }
popupController.didClosePopup = { debugPrint("Closed popup!") }

// Resize your popup to your liking
popupController.resizePopup(width: 300, height: 400)

Contact

@inket / @inket on Twitter / mahdi.jp

More Repositories

1

update_xcode_plugins

No more messing with plugin UUIDs; Plugins on Xcode 8+!
Ruby
1,195
star
2

MacSymbolicator

Symbolicating macOS/iOS crash reports, easily.
Swift
1,018
star
3

stts

A simple macOS app for monitoring the status of cloud services
Swift
508
star
4

Autoclick

A simple Mac app that simulates mouse clicks
Objective-C
380
star
5

cosyTabs

SIMBL plug-in for Safari. Now with macOS Sierra/Safari 10 support. Small tabs like they used to be back in the day.
Objective-C
44
star
6

CustomNC

Personalise your Notification Center banners and alerts. Requires SIMBL/EasySIMBL. (Sierra unsupported)
Objective-C
39
star
7

Transmog

A command-line tool for converting VS Code themes into Xcode themes ๐ŸŽจ๐Ÿ› 
Swift
35
star
8

StartAtLogin

Swifty Start at Login for macOS apps
Objective-C
22
star
9

RubyXDCCGetter

Ruby-based command-line tool for downloading files through XDCC
Ruby
17
star
10

dokku-buildpack-jekyll4-nginx

Jekyll 4 on Dokku
Shell
15
star
11

Mauno

A tiny Mac menubar app that allows you to quickly switch audio from Stereo to Mono
Swift
15
star
12

dominosjp

๐Ÿ•Domino's Pizza Japan CLI ๐Ÿ•
Ruby
13
star
13

MBDropZone

Easy file drag & drop for OS X
Objective-C
13
star
14

terminal-setup

My Terminal theme/settings
12
star
15

GlobalNoWindowTitle

SIMBL plug-in. Hides window titles+icons.
Objective-C
9
star
16

Dim

Mac app for multi-monitor users. Automatically dims secondary screen if a video is fullscreen.
Objective-C
8
star
17

MBVineVideo

Extracts video URL and information from Vine
Objective-C
6
star
18

GlobalNoWindowIcon

SIMBL plug-in. Hides window icons on (almost) all apps.
Objective-C
5
star
19

HAPU-rules

Detection rules for HAPU (http://mahdi.jp/apps/hapu) http://github.com/inket/HAPU-rules
5
star
20

ReflectURL

SIMBL plug-in that makes Safari 8 show the full URL in the address bar.
Objective-C
4
star
21

OpsDeploy

Gem for performing deployment & checks on AWS OpsWorks
Ruby
4
star
22

Duat.terminal

Terminal.app color theme/profile
4
star
23

dsc_extractor

How to use dsc_extractor to extract the dyld_shared_cache
3
star
24

PreciseTwitter

A SIMBL plugin that fixes some of the annoyances on Twitter for Mac 3.0
Objective-C
3
star
25

cargo.rb

Download new TV Shows and movies from direct links.
Ruby
3
star
26

GlobalNoFullscreenButton

SIMBL plug-in. Hides fullscreen button from windows.
Objective-C
2
star
27

DS4

DualShock 4 support on iOS 12 and earlier
Objective-C
2
star
28

smartPins

Proof of concept of customizing Safari's pinned tabs to achieve a minimal look
Objective-C
1
star
29

CinchIRCBot

A Ruby-based IRC bot using Cinch framework; Fetches some links and gives relevant results.
Ruby
1
star
30

Next

Old Mac app for managing a music queue for iTunes
Objective-C
1
star
31

MBAWSSNSManager

Receive Push notifications from Amazon Web Services
Objective-C
1
star
32

FinderMinusFree

Utility automating a tiny Finder mod that shortens the unnecessarily long item info for storage devices on the desktop
Objective-C
1
star