Giter Club home page Giter Club logo

statusitemcontroller's Introduction

StatusItemController CI

A "view controller" for menu bar Mac apps


About

This library provides a StatusItemController component that you can use to create menu bar apps, or apps with menu bar items in macOS.

This component is used in Red Eye and Lucifer.

Usage

  1. Subclass StatusItemController
  2. Implement the following methods:
    1. buildMenu() -> NSMenu
    2. leftClickAction()
    3. rightClickAction()
  3. Create an instance of your StatusItemController subclass in your NSApplicationDelegate.

Requirements

  • macOS 11.0+
  • Swift 5.9+
  • Xcode 15.0+
  • SwiftLint

Installation

pod 'StatusItemController', '~> 2.0.0'

Add StatusItemController to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/hexedbits/StatusItemController", from: "2.0.0")
]

Alternatively, you can add the package directly via Xcode.

Documentation

You can read the documentation here. Generated with jazzy. Hosted by GitHub Pages.

Notes on Testing

Unfortunately, StatusItemController cannot be tested directly. Attempting to create an NSStatusItem outside of an app context throws an assert, which makes sense. Thus, in order to test StatusItemController it must be embedded in an app. Tests can be found in the Example App test suite. See #15 for more details.

Contributing

Interested in making contributions to this project? Please review the guides below.

Also consider sponsoring this project or buying my apps! ✌️

Credits

Created and maintained by Jesse Squires.

License

Released under the MIT License. See LICENSE for details.

Copyright © 2020-present Jesse Squires.

statusitemcontroller's People

Contributors

dependabot[bot] avatar hisaac avatar jessesquires avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

statusitemcontroller's Issues

Will this work for Mac Catalyst to create system menu

Guidelines

  • I agree to follow this project's Contributing Guidelines.

Description

Will this work for Mac Catalyst to create system menu. Also can we refresh the menu in a way to have dynamic menu

Problem

I need to create system menu for Mac Catalyst

Proposed Solution

Alternatives Considered

Unit tests crash with Xcode 12.5 + Big Sur

Problem

For some reason, unit tests just crash on Xcode 12.5+ during StatusItemController.init:

self.statusItem = NSStatusBar.system.statusItem(withLength: length)

The issue is with NSStatusBar.system 🤷🏼

EDIT: The issue seems to be with Big Sur. Crashes also occur with Xcode 12.4 on Big Sur...

Example logs

https://github.com/hexedbits/StatusItemController/runs/3064104921?check_suite_focus=true

Workaround

Using Xcode 12.4 and macOS 10.15 for now — only for ci.yml

See: #14

Notes

No idea why this is happening. See like an AppKit bug or something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.