GithubHelp home page GithubHelp logo

anaghsharma / ambar-xamarin Goto Github PK

View Code? Open in Web Editor NEW
64.0 5.0 8.0 533 KB

A macOS Menu Bar app built with Xamarin and C#

License: MIT License

C# 100.00%
macos macosx macos-app macos-menubar xamarin xamarin-mac xamarin-macos popover popup

ambar-xamarin's Introduction

Ambar-Xamarin

Ambar is a macOS Menu Bar app developed with Xamarin and C#. This project aims to show developing a menu bar app for macOS in C#.

Update

Using Ambar as the base, I was able to build Carol - a minimal and beautiful lyrics app for macOS. Check it out.

Why

It is for the folks wanting to start developing for macOS/iOS/tvOS/watchOS but do not want to delve into Swift/Obj-C and are already comfortable with C# and .Net technologies.

Tools Required

  1. Visual Studio for Mac
  2. Xcode

Steps

Here is how you can do it -

  1. In Xcode, delete Window Controller Scene from Main.storyboard and provide Storyboard ID to View Controller.
  2. Add new entry in info.plist - Application is agent (UIElement) with its value set to Yes to make the app behave as a ghost.
  3. Create a Menu Bar status item using CreateStatusItem() method of NSStatusBar.
  4. Handle status bar icon for dark and light theme using Template property of NSImage.
  5. Handle event handling of status item using Selector class of ObjCRuntime.
  6. Show a popover using NSPopover and its Show() method.
  7. Make popover show on demand and hide when user moves on using NSEvent and a custom class.
  8. In Xcode, add a button to View Controller and create an action QuitApplication by control + drag. In VS, call Terminate method of NSApplication.

Unless stated otherwise, everything is done in Visual Studio for Mac.

To-do

  • Add a Contextual Menu to show options.
  • Add a Launch at Login setting.
  • Add a About window.

Contribute

If you think this project can be improved to show more of what can be done using Xamarin and C#, you are welcome to contribute. If you build something epic using it, just let me know.

ambar-xamarin's People

Contributors

anaghsharma 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

Watchers

 avatar  avatar  avatar  avatar  avatar

ambar-xamarin's Issues

Mojave Issue

HI,

under mojave it isnt possible to open the settings menu

NSAppleEventDescriptor result = appleScript.ExecuteAndReturnError(out errors);

returns null

Still under production?

Could you make this project available for latest dotnet dore version and make it more "standalone"?

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.