Skip to content

Commit 713f4df

Browse files
committed
added StatusMenu. Del from Dock.
1 parent 65e3d67 commit 713f4df

7 files changed

Lines changed: 53 additions & 29 deletions

File tree

MTMR/AppDelegate.swift

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,34 @@ import Cocoa
1010

1111
@NSApplicationMain
1212
class AppDelegate: NSObject, NSApplicationDelegate {
13-
13+
let statusItem = NSStatusBar.system.statusItem(withLength:NSStatusItem.squareLength)
14+
1415
func applicationDidFinishLaunching(_ aNotification: Notification) {
15-
TouchBarController.shared.setupControlStripPresence()
1616
// Insert code here to initialize your application
17+
TouchBarController.shared.setupControlStripPresence()
18+
19+
if let button = statusItem.button {
20+
button.image = #imageLiteral(resourceName: "StatusImage")
21+
}
22+
createMenu()
1723
}
1824

1925
func applicationWillTerminate(_ aNotification: Notification) {
2026
// Insert code here to tear down your application
2127
}
22-
28+
29+
@objc func testFn(_ sender: Any?) {
30+
let quoteText = "You click on menu"
31+
print(quoteText)
32+
}
33+
34+
func createMenu() {
35+
let menu = NSMenu()
36+
menu.addItem(withTitle: "Preferences", action: #selector(testFn(_:)), keyEquivalent: ",")
37+
menu.addItem(NSMenuItem.separator())
38+
menu.addItem(withTitle: "Quit", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q")
39+
statusItem.menu = menu
40+
}
2341

2442
}
2543

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "StatusImage.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
},
21+
"properties" : {
22+
"template-rendering-intent" : "template"
23+
}
24+
}
1.99 KB
Loading

MTMR/Base.lproj/Main.storyboard

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
4+
<deployment identifier="macosx"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14109"/>
56
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
67
</dependencies>
78
<scenes>
@@ -680,27 +681,6 @@
680681
</objects>
681682
<point key="canvasLocation" x="75" y="0.0"/>
682683
</scene>
683-
<!--Window Controller-->
684-
<scene sceneID="R2V-B0-nI4">
685-
<objects>
686-
<windowController id="B8D-0N-5wS" customClass="WindowController" customModule="MTMR" customModuleProvider="target" sceneMemberID="viewController">
687-
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
688-
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
689-
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
690-
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
691-
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
692-
<connections>
693-
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
694-
</connections>
695-
</window>
696-
<connections>
697-
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
698-
</connections>
699-
</windowController>
700-
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
701-
</objects>
702-
<point key="canvasLocation" x="75" y="250"/>
703-
</scene>
704684
<!--View Controller-->
705685
<scene sceneID="hIz-AP-VOD">
706686
<objects>

MTMR/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>LSUIElement</key>
6+
<true/>
57
<key>CFBundleDevelopmentRegion</key>
68
<string>$(DEVELOPMENT_LANGUAGE)</string>
79
<key>CFBundleExecutable</key>

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ My the idea is to create the program like a platform for plugins for customizati
2020
- [x] First the weather plugin
2121
- [x] Find how to open full-screen TouchBar without the cross and stripe menu
2222
- [x] Find how to add haptic feedback
23+
- [x] Add icon and menu in StatusBar
24+
- [x] Hide from Dock
25+
- [x] Status menu: "preferences", "quit"
2326
- [ ] JSON or another approch for save preset and plugins maybe in `~/mtmr`
2427
- [ ] Layout: [always left, NSSliderView for center, always right]
2528
- [ ] Custom buttons size, actions by click in settings
26-
- [ ] Add icon and menu in StatusBar
27-
- [ ] Hide from Dock
28-
- [ ] Status menu: "preferences", "quit"
2929
- [ ] System for autoupdate (maybe https://sparkle-project.org/)
3030

3131
Settings:

Resources/MTMRicon.sketch

-7.32 KB
Binary file not shown.

0 commit comments

Comments
 (0)