Skip to content
This repository was archived by the owner on Oct 22, 2022. It is now read-only.

Commit e86dd3c

Browse files
committed
Merge branch 'release/1.0.0'
* release/1.0.0: (38 commits) Bump CFBundleShortVersionString to 1.0.0 Read version values from Info.plist Update "Things to complete" Update screenshots to latest layout Minor package and workspace cleanup Bring window to front on showWindow() calls Add Menu Item to open the Pi-hole dashboard Add missing enable/disable time values and their action handler Ignore local pi-hole data created by docker Minor Xcode configuration update Update README.md with screenshot Add MIT license Remove unused cocoa pods integration Fixed invalid description position Add links to project repository and the pi-hole project Add application description to readme and about window Minor package refactor and cleanup Add AboutWindow to display copyright acknowledges, references and links Make NSColor usages consistent Add missing about application action handling ...
2 parents 93fb9da + 3f8f76f commit e86dd3c

34 files changed

+1727
-1509
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11

22
# Created by https://www.gitignore.io/api/xcode,macos,cocoapods
33

4+
### Pi-hole docker data ###
5+
dnsmasq.d/
6+
pihole/
7+
48
### CocoaPods ###
59
## CocoaPods GitIgnore Template
610

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
MIT License
3+
4+
Copyright (c) 2018 Lukas Wolfsteiner <lukas@wolfsteiner.media>
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

Podfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

Podfile.lock

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,46 @@
1-
# Shortcuts for Pi-hole
1+
# Shortcuts for Pi-hole
2+
3+
Shortcuts for Pi-hole is a small menu bar application that lives in your status bar. It provides quick actions for managing and monitoring your Pi-hole® instance.
4+
5+
<img src="Screenshots/Overview.png"/>
6+
7+
General Preferences | Connection Preferences
8+
:-------------------------:|:-------------------------:
9+
<img src="Screenshots/GeneralPreferences.png"/> | <img src="Screenshots/ConnectionPreferences.png"/>
10+
11+
## Things to complete
12+
13+
- [ ] Application icon
14+
- [ ] Update mechanism (using the [Spark Framework](https://sparkle-project.org/))
15+
- [ ] Implement Unit-/Testing
16+
- [ ] Create as cask
17+
18+
## Copyright acknowledges and credits
19+
20+
Big thanks to the whole Pi-hole userspace for developing and maintaining the Pi-hole project. Visit [pi-hole.net](https://pi-hole.net/) for more information. This application uses the Pi-hole API and it's logo as menu bar icon.
21+
22+
**Pi-hole® is a registered trademark of Pi-hole LLC**
23+
24+
## Source code license
25+
26+
MIT License
27+
28+
Copyright (c) 2018 Lukas Wolfsteiner <lukas@wolfsteiner.media>
29+
30+
Permission is hereby granted, free of charge, to any person obtaining a copy
31+
of this software and associated documentation files (the "Software"), to deal
32+
in the Software without restriction, including without limitation the rights
33+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34+
copies of the Software, and to permit persons to whom the Software is
35+
furnished to do so, subject to the following conditions:
36+
37+
The above copyright notice and this permission notice shall be included in all
38+
copies or substantial portions of the Software.
39+
40+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46+
SOFTWARE.

Screenshots/ConnectionPreferences.png

107 KB
Loading

Screenshots/GeneralPreferences.png

112 KB
Loading

Screenshots/Overview.png

413 KB
Loading

Shortcuts for Pi-hole.xcodeproj/project.pbxproj

Lines changed: 96 additions & 90 deletions
Large diffs are not rendered by default.

Shortcuts for Pi-hole.xcodeproj/xcuserdata/lukas.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>Shortcuts for Pi-hole.xcscheme</key>
88
<dict>
99
<key>orderHint</key>
10-
<integer>2</integer>
10+
<integer>0</integer>
1111
</dict>
1212
</dict>
1313
</dict>

Shortcuts for Pi-hole.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 10 deletions
This file was deleted.

Shortcuts for Pi-hole.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// AboutViewController.swift
3+
// Shortcuts for Pi-hole
4+
//
5+
// Created by Lukas Wolfsteiner on 21.10.18.
6+
// Copyright © 2018 Lukas Wolfsteiner. All rights reserved.
7+
//
8+
9+
import Cocoa
10+
11+
class AboutViewController: NSViewController {
12+
13+
@IBOutlet weak var versionTextField: NSTextField!
14+
15+
@IBAction func viewSourceCodeActionHandler(_ sender: NSButton) {
16+
NSWorkspace.shared.open(URL(string: "https://github.com/dotWee/macOS-PiholeShortcuts")!)
17+
}
18+
19+
@IBAction func visitPiHoleProjectActionHandler(_ sender: NSButton) {
20+
NSWorkspace.shared.open(URL(string: "https://pi-hole.net")!)
21+
}
22+
23+
override func viewDidLoad() {
24+
super.viewDidLoad()
25+
26+
// Do view setup here.
27+
print("AboutViewController: viewDidLoad()")
28+
29+
let versionValue = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
30+
let bundleValue = Bundle.main.infoDictionary?["CFBundleVersion"] as? String
31+
versionTextField.stringValue = "Version: \(versionValue!) (Bundle No. #\(bundleValue!))";
32+
}
33+
34+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// AboutWindowController.swift
3+
// Shortcuts for Pi-hole
4+
//
5+
// Created by Lukas Wolfsteiner on 21.10.18.
6+
// Copyright © 2018 Lukas Wolfsteiner. All rights reserved.
7+
//
8+
9+
import Cocoa
10+
11+
class AboutWindowController: NSWindowController {
12+
13+
@IBOutlet weak var aboutWindow: NSWindow!
14+
15+
override func showWindow(_ sender: Any?) {
16+
super.showWindow(sender)
17+
18+
AppDelegate.bringToFront(window: self.window!)
19+
}
20+
21+
override func windowDidLoad() {
22+
super.windowDidLoad()
23+
24+
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
25+
}
26+
}

Shortcuts for Pi-hole/AppDelegate.swift

Lines changed: 4 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -7,76 +7,22 @@
77
//
88

99
import Cocoa
10-
import Preferences
1110

1211
@NSApplicationMain
1312
class AppDelegate: NSObject, NSApplicationDelegate {
14-
15-
static let menuItems = [AppDelegate.menuItemStatus, AppKit.NSMenuItem.separator(), AppDelegate.menuItemEnable, AppDelegate.menuItemDisable, AppKit.NSMenuItem.separator(), AppDelegate.menuItemPreferences, AppKit.NSMenuItem.separator(), AppDelegate.menuItemQuit]
16-
17-
static let menuItemStatus = NSMenuItem(title: "Status", action: nil, keyEquivalent: "", isEnabled: false)
18-
@objc func menuItemStatusActionHandler(_ sender: Any?) {
19-
20-
}
21-
22-
static let menuItemEnable = NSMenuItem(title: "Enable", action: #selector(AppDelegate.menuItemEnableActionHandler(_:)), keyEquivalent: "E", isEnabled: true)
23-
@objc func menuItemEnableActionHandler(_ sender: Any?) {
24-
25-
}
26-
27-
static let menuItemDisable = NSMenuItem(title: "Disable", action: #selector(AppDelegate.menuItemDisableActionHandler(_:)), keyEquivalent: "D", isEnabled: true)
28-
@objc func menuItemDisableActionHandler(_ sender: Any?) {
29-
30-
}
31-
32-
static let menuItemPreferences = NSMenuItem(title: "Preferences", action: #selector(AppDelegate.menuItemPreferenceActionHandler(_:)), keyEquivalent: "P", isEnabled: true)
33-
@objc func menuItemPreferenceActionHandler(_ sender: Any?) {
34-
preferencesWindowController.showWindow()
35-
}
36-
37-
static let menuItemQuit = NSMenuItem(title: "Quit " + (Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String ?? ""), action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q", isEnabled: true)
38-
39-
@IBOutlet weak var window: NSWindow!
40-
41-
let statusBarItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
42-
@objc func statusBarItemActionHandler(_ sender: NSStatusBarButton) {
43-
44-
}
45-
46-
let preferencesWindowController = PreferencesWindowController(viewControllers: [GeneralPreferenceViewController()])
4713

4814
func applicationDidFinishLaunching(_ aNotification: Notification) {
4915
// Insert code here to initialize your application
50-
preferencesWindowController.showWindow()
51-
if let button = statusBarItem.button {
52-
button.image = NSImage(named:"StatusBarButtonImage")
53-
button.action = #selector(self.statusBarItemActionHandler(_:))
54-
button.target = self
55-
}
56-
57-
let menu = NSMenu()
58-
59-
AppDelegate.menuItems.forEach { menuItem in menu.addItem(menuItem) }
60-
statusBarItem.menu = menu
61-
}
62-
63-
func applicationWillFinishLaunching(_ notification: Notification) {
64-
window.orderOut(self)
6516
}
6617

6718
func applicationWillTerminate(_ aNotification: Notification) {
6819
// Insert code here to tear down your application
69-
preferencesWindowController.close()
70-
}
71-
72-
@IBAction func preferencesMenuItemActionHandler(_ sender: Any) {
73-
preferencesWindowController.showWindow()
7420
}
7521

76-
static func NSMenuItem(title: String, action selector: Selector?, keyEquivalent charCode: String, isEnabled: Bool) -> NSMenuItem {
77-
let menuItem = AppKit.NSMenuItem(title: title, action: selector, keyEquivalent: charCode)
78-
menuItem.isEnabled = isEnabled
79-
return menuItem
22+
public static func bringToFront(window: NSWindow) {
23+
window.center()
24+
window.makeKeyAndOrderFront(nil)
25+
NSApp.activate(ignoringOtherApps: true)
8026
}
8127
}
8228

0 commit comments

Comments
 (0)