Skip to content

Commit

Permalink
feat: add licence to about page
Browse files Browse the repository at this point in the history
Also use data from Info.plist to make it more DRY
  • Loading branch information
louis.pontoise authored and lwouis committed Mar 10, 2020
1 parent efc9bd3 commit cb66b79
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion alt-tab-macos/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<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>
<string>NSApplication</string>
<key>LSUIElement</key>
Expand Down
5 changes: 3 additions & 2 deletions alt-tab-macos/ui/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import Darwin
let cgsMainConnectionId = CGSMainConnectionID()

class App: NSApplication, NSApplicationDelegate, NSWindowDelegate {
static let name = "AltTab"
static let version = "#VERSION#"
static let name = Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as! String
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"
var statusItem: NSStatusItem?
var thumbnailsPanel: ThumbnailsPanel?
Expand Down
2 changes: 1 addition & 1 deletion alt-tab-macos/ui/Menubar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Cocoa
class Menubar {
static func make(_ app: App) -> NSStatusItem {
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
item.button!.title = App.name
item.button!.title = "AltTab"
item.menu = NSMenu()
item.menu!.addItem(
withTitle: "Show",
Expand Down
8 changes: 5 additions & 3 deletions alt-tab-macos/ui/preferences-window/tabs/AboutTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ class AboutTab: NSObject {

static func makeView() -> NSGridView {
let appIcon = NSImageView(image: App.shared.applicationIconImage)
appIcon.fit(128, 128)
appIcon.fit(150, 150)
let appText = NSStackView(views: [
BoldLabel(App.name),
NSTextField(wrappingLabelWithString: "Version \(App.version)"),
NSTextField(wrappingLabelWithString: "Version " + App.version),
NSTextField(wrappingLabelWithString: App.licence),
HyperlinkLabel("Source code repository", App.repository),
HyperlinkLabel("Latest releases", App.repository + "/releases"),
])
appText.orientation = .vertical
appText.alignment = .left
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])
appInfo.spacing = GridView.interPadding
let view = GridView.make([
Expand Down
2 changes: 0 additions & 2 deletions ci/set_version_in_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
set -exu

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
sed -i '' -e "s/#VERSION#/$version/" alt-tab-macos/Info.plist

0 comments on commit cb66b79

Please sign in to comment.