Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Stegic committed Jan 10, 2021
2 parents 23de6f7 + 6dc5461 commit 4d83a51
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 15 deletions.
28 changes: 17 additions & 11 deletions Menu Bar DNS/Menu Bar DNS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import Cocoa
class AppDelegate: NSObject, NSApplicationDelegate {

var statusItem: NSStatusItem?



@IBOutlet weak var menu: NSMenu?
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}
Expand All @@ -27,17 +27,23 @@ class AppDelegate: NSObject, NSApplicationDelegate {
super.awakeFromNib()

statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)

let itemImage = NSImage(named: "menubar-icon")
statusItem?.button?.image = itemImage
statusItem?.button?.target = self
statusItem?.button?.action = #selector(didClickMenubar)

statusItem?.button?.image = statusItemImage()
statusItem?.menu = menu
}

@objc func didClickMenubar() {
NSApp.terminate(self)
func statusItemImage() -> NSImage? {
let image:NSImage? = NSImage(named: NSImage.Name("menubar-icon"))
image?.isTemplate = true
return image;
}

@IBAction func didClickMenuHelp(_ sender: Any) {
let url: URL? = URL.init(string: "https://ivanstegic.com/menu-bar-dns/")
NSWorkspace.shared.open(url!)
}

@IBAction func didClickMenuQuitMenuBarDNS(_ sender: Any) {
NSApp.terminate(self)
}
}

Original file line number Diff line number Diff line change
@@ -1,51 +1,61 @@
{
"images" : [
{
"filename" : "icon_16x16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "icon_32x32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "icon_128x128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "icon_256x256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "icon_512x512.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
"images" : [
{
"filename" : "barcode-box-fill.svg",
"idiom" : "universal"
"idiom" : "mac"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
30 changes: 27 additions & 3 deletions Menu Bar DNS/Menu Bar DNS/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17156"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
</dependencies>
<scenes>
<!--Application-->
Expand Down Expand Up @@ -674,9 +674,33 @@
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
</connections>
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Menu_Bar_DNS" customModuleProvider="target"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Menu_Bar_DNS" customModuleProvider="target">
<connections>
<outlet property="menu" destination="aMu-0C-oAQ" id="tRt-qx-HA8"/>
</connections>
</customObject>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
<menu id="aMu-0C-oAQ">
<items>
<menuItem title="Hello!" enabled="NO" id="nIA-hy-Cjy">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="enb-RI-VSD"/>
<menuItem title="Help" id="IH0-1S-4na">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="didClickMenuHelp" target="Voe-Tx-rLC" id="NhS-FU-ADL"/>
</connections>
</menuItem>
<menuItem title="Quit Menu Bar DNS" id="nT2-ZC-eeb">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="didClickMenuQuitMenuBarDNS" target="Voe-Tx-rLC" id="Lxg-cs-jHm"/>
</connections>
</menuItem>
</items>
</menu>
</objects>
<point key="canvasLocation" x="75" y="0.0"/>
</scene>
Expand Down

0 comments on commit 4d83a51

Please sign in to comment.