feat: add licence to about page
Also use data from Info.plist to make it more DRY
This commit is contained in:
1 parent
efc9bd3d3e
commit
cb66b79582
5 files changed
+10
-9
No files matched your search
@@ -23,7 +23,7 @@
|
|||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>GPL-3.0 licence (https://github.com/lwouis/alt-tab-macos/blob/master/LICENCE.md)</string>
|
<string>GPL-3.0 licence</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
<key>LSUIElement</key>
|
<key>LSUIElement</key>
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import Darwin
|
|||||||
let cgsMainConnectionId = CGSMainConnectionID()
|
let cgsMainConnectionId = CGSMainConnectionID()
|
||||||
|
|
||||||
class App: NSApplication, NSApplicationDelegate, NSWindowDelegate {
|
class App: NSApplication, NSApplicationDelegate, NSWindowDelegate {
|
||||||
static let name = "AltTab"
|
static let name = Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as! String
|
||||||
static let version = "#VERSION#"
|
static let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as! String
|
||||||
|
static let licence = Bundle.main.object(forInfoDictionaryKey: "NSHumanReadableCopyright") as! String
|
||||||
static let repository = "https://github.com/lwouis/alt-tab-macos"
|
static let repository = "https://github.com/lwouis/alt-tab-macos"
|
||||||
var statusItem: NSStatusItem?
|
var statusItem: NSStatusItem?
|
||||||
var thumbnailsPanel: ThumbnailsPanel?
|
var thumbnailsPanel: ThumbnailsPanel?
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Cocoa
|
|||||||
class Menubar {
|
class Menubar {
|
||||||
static func make(_ app: App) -> NSStatusItem {
|
static func make(_ app: App) -> NSStatusItem {
|
||||||
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
|
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
|
||||||
item.button!.title = App.name
|
item.button!.title = "AltTab"
|
||||||
item.menu = NSMenu()
|
item.menu = NSMenu()
|
||||||
item.menu!.addItem(
|
item.menu!.addItem(
|
||||||
withTitle: "Show",
|
withTitle: "Show",
|
||||||
|
|||||||
@@ -7,17 +7,19 @@ class AboutTab: NSObject {
|
|||||||
|
|
||||||
static func makeView() -> NSGridView {
|
static func makeView() -> NSGridView {
|
||||||
let appIcon = NSImageView(image: App.shared.applicationIconImage)
|
let appIcon = NSImageView(image: App.shared.applicationIconImage)
|
||||||
appIcon.fit(128, 128)
|
appIcon.fit(150, 150)
|
||||||
let appText = NSStackView(views: [
|
let appText = NSStackView(views: [
|
||||||
BoldLabel(App.name),
|
BoldLabel(App.name),
|
||||||
NSTextField(wrappingLabelWithString: "Version \(App.version)"),
|
NSTextField(wrappingLabelWithString: "Version " + App.version),
|
||||||
|
NSTextField(wrappingLabelWithString: App.licence),
|
||||||
HyperlinkLabel("Source code repository", App.repository),
|
HyperlinkLabel("Source code repository", App.repository),
|
||||||
HyperlinkLabel("Latest releases", App.repository + "/releases"),
|
HyperlinkLabel("Latest releases", App.repository + "/releases"),
|
||||||
])
|
])
|
||||||
appText.orientation = .vertical
|
appText.orientation = .vertical
|
||||||
appText.alignment = .left
|
appText.alignment = .left
|
||||||
appText.spacing = GridView.interPadding / 2
|
appText.spacing = GridView.interPadding / 2
|
||||||
appText.views[2].topAnchor.constraint(equalTo: appText.views[1].bottomAnchor, constant: GridView.interPadding).isActive = true
|
let rowToSeparate = 3
|
||||||
|
appText.views[rowToSeparate].topAnchor.constraint(equalTo: appText.views[rowToSeparate - 1].bottomAnchor, constant: GridView.interPadding).isActive = true
|
||||||
let appInfo = NSStackView(views: [appIcon, appText])
|
let appInfo = NSStackView(views: [appIcon, appText])
|
||||||
appInfo.spacing = GridView.interPadding
|
appInfo.spacing = GridView.interPadding
|
||||||
let view = GridView.make([
|
let view = GridView.make([
|
||||||
|
|||||||
@@ -3,7 +3,5 @@
|
|||||||
set -exu
|
set -exu
|
||||||
|
|
||||||
version="$(cat VERSION.txt)"
|
version="$(cat VERSION.txt)"
|
||||||
# set the version displayed in the app UI
|
|
||||||
sed -i '' -e "s/#VERSION#/$version/" alt-tab-macos/ui/App.swift
|
|
||||||
# set the version in the app meta-data for the AppStore and app "Get Info" panel
|
# set the version in the app meta-data for the AppStore and app "Get Info" panel
|
||||||
sed -i '' -e "s/#VERSION#/$version/" alt-tab-macos/Info.plist
|
sed -i '' -e "s/#VERSION#/$version/" alt-tab-macos/Info.plist
|
||||||
Reference in new issue
Block a user