Skip to content

Commit

Permalink
Added icon v1
Browse files Browse the repository at this point in the history
- Fixed status item menu
  • Loading branch information
NSGolova committed Jan 14, 2021
1 parent 260b3f3 commit d9b2900
Show file tree
Hide file tree
Showing 37 changed files with 226,134 additions and 92 deletions.
20 changes: 20 additions & 0 deletions Clippr/Clippr/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,35 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {

self.windowController?.openWindowAtCenter()
}

menuItem?.shutdownHandler = {
NSRunningApplication.current.forceTerminate()
}

menuItem?.install()

setupShortcut()

if !introShown {
Preferences.launchOnLogin = true
handleOpen()
}
}

func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
let eventDescriptor = NSAppleEventManager.shared().currentAppleEvent?.attributeDescriptor(forKeyword: "why?")

if eventDescriptor?.typeCodeValue == "rest" || // Restart
eventDescriptor?.typeCodeValue == "shut" || // Shutdown
eventDescriptor?.typeCodeValue == "rlgo" { // Logout
return .terminateNow
}
windowController?.close()
NSApp.setActivationPolicy(.accessory)

return .terminateCancel
}

func handleOpen() {
NSApp.setActivationPolicy(.regular)

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.
66 changes: 33 additions & 33 deletions Clippr/Clippr/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
{
"images" : [
{
"size" : "16x16",
"filename" : "AppIcon16.png",
"idiom" : "mac",
"filename" : "clipboard-flat-1.png",
"scale" : "1x"
"scale" : "1x",
"size" : "16x16"
},
{
"size" : "16x16",
"filename" : "[email protected]",
"idiom" : "mac",
"filename" : "clipboard-flat.png",
"scale" : "2x"
"scale" : "2x",
"size" : "16x16"
},
{
"size" : "32x32",
"filename" : "AppIcon32.png",
"idiom" : "mac",
"filename" : "clipboard-flat-2.png",
"scale" : "1x"
"scale" : "1x",
"size" : "32x32"
},
{
"size" : "32x32",
"filename" : "[email protected]",
"idiom" : "mac",
"filename" : "clipboard-flat-3.png",
"scale" : "2x"
"scale" : "2x",
"size" : "32x32"
},
{
"size" : "128x128",
"filename" : "AppIcon128.png",
"idiom" : "mac",
"filename" : "clipboard-flat-6.png",
"scale" : "1x"
"scale" : "1x",
"size" : "128x128"
},
{
"size" : "128x128",
"filename" : "[email protected]",
"idiom" : "mac",
"filename" : "clipboard-flat-7.png",
"scale" : "2x"
"scale" : "2x",
"size" : "128x128"
},
{
"size" : "256x256",
"filename" : "AppIcon256.png",
"idiom" : "mac",
"filename" : "clipboard-flat-8.png",
"scale" : "1x"
"scale" : "1x",
"size" : "256x256"
},
{
"size" : "256x256",
"filename" : "[email protected]",
"idiom" : "mac",
"filename" : "clipboard-flat-9.png",
"scale" : "2x"
"scale" : "2x",
"size" : "256x256"
},
{
"size" : "512x512",
"filename" : "AppIcon512.png",
"idiom" : "mac",
"filename" : "clipboard-flat-4.png",
"scale" : "1x"
"scale" : "1x",
"size" : "512x512"
},
{
"size" : "512x512",
"filename" : "[email protected]",
"idiom" : "mac",
"filename" : "clipboard-flat-5.png",
"scale" : "2x"
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions Clippr/Clippr/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
12 changes: 0 additions & 12 deletions Clippr/Clippr/Assets.xcassets/MAC.imageset/Contents.json

This file was deleted.

Binary file removed Clippr/Clippr/Assets.xcassets/MAC.imageset/Imac.pdf
Binary file not shown.
21 changes: 21 additions & 0 deletions Clippr/Clippr/Assets.xcassets/MenuIcon.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "MenuIcon.png",
"idiom" : "mac",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
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.
Binary file not shown.
17 changes: 0 additions & 17 deletions Clippr/Clippr/Assets.xcassets/android.imageset/Contents.json

This file was deleted.

21 changes: 0 additions & 21 deletions Clippr/Clippr/Assets.xcassets/iOS.imageset/Contents.json

This file was deleted.

Binary file not shown.
113,142 changes: 113,142 additions & 0 deletions Clippr/Clippr/Icon.ai

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions Clippr/Clippr/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,5 @@
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticTermination</key>
<true/>
<key>NSSupportsSuddenTermination</key>
<true/>
</dict>
</plist>
14 changes: 12 additions & 2 deletions Clippr/Clippr/MainUI/Menu/MenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,25 @@ class MenuItem {
private lazy var statusItem = NSStatusBar.system.statusItem(withLength: 32)
var openHandler: (() -> Void)?
var clipboardHandler: (() -> Void)?
var shutdownHandler: (() -> Void)?

func install() {
self.statusItem.image = #imageLiteral(resourceName: "MAC")
self.statusItem.image = #imageLiteral(resourceName: "MenuIcon")

let menu = NSMenu()

let windowItem = NSMenuItem(title: NSLocalizedString("Open Clippr!", comment: ""), action: #selector(self.window(sender:)), keyEquivalent: "")
let windowItem = NSMenuItem(title: NSLocalizedString("Open Clippr", comment: ""), action: #selector(self.window(sender:)), keyEquivalent: "")
windowItem.target = self
menu.addItem(windowItem)

let clipboardItem = NSMenuItem(title: NSLocalizedString("Clipboard history", comment: ""), action: #selector(self.clipboard(sender:)), keyEquivalent: "")
clipboardItem.target = self
menu.addItem(clipboardItem)

let shutdownItem = NSMenuItem(title: NSLocalizedString("Shut down", comment: ""), action: #selector(self.shutdown(sender:)), keyEquivalent: "")
shutdownItem.target = self
menu.addItem(shutdownItem)

self.statusItem.menu = menu
}

Expand All @@ -38,4 +43,9 @@ class MenuItem {
func clipboard(sender: Any) {
clipboardHandler?()
}

@objc private
func shutdown(sender: Any) {
shutdownHandler?()
}
}
Loading

0 comments on commit d9b2900

Please sign in to comment.