Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ jobs:
capture dark -ShowPreferencesAtStartUp NO -CalendarSize 2 -Appearance 2
capture light -ShowPreferencesAtStartUp NO -CalendarSize 2 -Appearance 1
capture settings -ShowPreferencesAtStartUp YES -CalendarSize 1
capture shortcuts -ShowPreferencesAtStartUp YES -CalendarSize 1 -BlotterSettingsPane 1
capture german -ShowPreferencesAtStartUp YES -CalendarSize 1 -AppleLanguages '(de)' -AppleLocale de_DE
capture japanese -ShowPreferencesAtStartUp NO -CalendarSize 2 -AppleLanguages '(ja)' -AppleLocale ja_JP

Expand Down
52 changes: 28 additions & 24 deletions Blotter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,31 @@
/* Begin PBXBuildFile section */
0F067637F911CF1DDC9A3C5D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80C499315086814D391D635A /* AppDelegate.swift */; };
100B504297BA7059B4E2EC40 /* InfoPlist.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 9B6889B3E2DEF68A35EEC29A /* InfoPlist.xcstrings */; };
2259160724D8D7DA438C541E /* HotkeyCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F226DBE68F9BACBB08BF3513 /* HotkeyCenter.swift */; };
25F8097CC5B71C517B410C1A /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 8613B4D32EB797DCEADA9EBA /* Localizable.xcstrings */; };
3C8EA796A679C613BD1C448D /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66A7A9DC1B15CDD7E970CA6 /* CalendarView.swift */; };
442D214084AF2836CF976F75 /* Hotkeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = B211D3CFF1CF666A5F50D14C /* Hotkeys.swift */; };
48B139E9DCFBDE48B2C62CFD /* DemoData.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB7A450502CE85C6BF89C323 /* DemoData.swift */; };
589284774E0F9533914DBCBF /* LegacyMigrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20900949505E9C73E04E0F5B /* LegacyMigrationTests.swift */; };
62E5BD8B91F24BBE502341D4 /* ComposerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2F95875A337A64EF513DDB9 /* ComposerWindowController.swift */; };
649567E2B91E6D41ACCCFB17 /* Clock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90F72FD8B73B39494A9C9FE9 /* Clock.swift */; };
74C6F98F86BDE2069821F3CB /* CalendarStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81CE91210C85B61F088A0AC4 /* CalendarStateTests.swift */; };
76B8D9596745BE7BCFBF5AD8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 29CD7860A7C064170B3BC70A /* Assets.xcassets */; };
7F2217B81DFF4859B64BC3EF /* HotkeyStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB45FEF8F88436D9CCC33C00 /* HotkeyStoreTests.swift */; };
8047A43C7378E43FC4250379 /* SettingsWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB683E77DDC787880B51001 /* SettingsWindowController.swift */; };
89FFC6AE9E0F45805D1F4D8B /* LegacyMigration.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6D0D42B1162F2BFFD870E82 /* LegacyMigration.swift */; };
8B730ECAEBDB0E789EB49529 /* ComposerViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CBA1F507173A58E28FD0006 /* ComposerViews.swift */; };
8B8F993846BC3DB10860C6CA /* InfoViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91B70DC5796F2B4D55503295 /* InfoViews.swift */; };
9F1874D017783F8E938059E1 /* WeekView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F275E2017E8E1506200D7B7 /* WeekView.swift */; };
A06C756DA1FEF9036405FE7B /* KeyDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = F295C55491DEEBCD13265AA7 /* KeyDisplay.swift */; };
A5C39BC08481288BE9563EAD /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACC0D721D056789B08A7C0DE /* Theme.swift */; };
B3DE0A8BF9FDD5C65C1E21FC /* AppDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30C967ACBAB06423F7509CB1 /* AppDefaults.swift */; };
B460AA9811021F708D266309 /* BlotterKit in Frameworks */ = {isa = PBXBuildFile; productRef = A05D578AF9F493704490E60A /* BlotterKit */; };
BD012D4BBD49E5A642CF76F7 /* BlotterMain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5719D4CC691B0544A94AC097 /* BlotterMain.swift */; };
BD74D6850EE8C07A670FCF67 /* ShortcutRecorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A39698276C7238569CDCC103 /* ShortcutRecorder.swift */; };
E13EDFD8F4F82C977321ED53 /* StatusItemController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47AC6B698EAA0DC67950116E /* StatusItemController.swift */; };
EC1BC7C15297CB1756BC2998 /* KeyboardShortcuts in Frameworks */ = {isa = PBXBuildFile; productRef = 98098395C7A5423B6F6F05E6 /* KeyboardShortcuts */; };
F09447040C05C93E8A3474C8 /* SettingsPanes.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5BD3CEA2ED40D9181113154 /* SettingsPanes.swift */; };
F47715D32AB8DB8C35B5835C /* CalendarState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 214B34242C2F6721CFC12155 /* CalendarState.swift */; };
F4BB0039B457AD3889DB733F /* HotkeyStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B60C660B24FCF34477469B7 /* HotkeyStore.swift */; };
F778A8F301C3B001F00160A1 /* CalendarStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 099D7023BF02F6A4AFCC7DC5 /* CalendarStore.swift */; };
F948C6E955A84B0DB0DACB6C /* DesktopWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A457F5005D2B31C85D1B396B /* DesktopWindowController.swift */; };
/* End PBXBuildFile section */
Expand All @@ -57,22 +60,26 @@
5719D4CC691B0544A94AC097 /* BlotterMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlotterMain.swift; sourceTree = "<group>"; };
5B826CB6F57FDC8DC10CBAF5 /* BlotterKit */ = {isa = PBXFileReference; lastKnownFileType = folder; name = BlotterKit; path = BlotterKit; sourceTree = SOURCE_ROOT; };
68D711593EEC0A6D2F558722 /* Blotter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Blotter.app; sourceTree = BUILT_PRODUCTS_DIR; };
6B60C660B24FCF34477469B7 /* HotkeyStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HotkeyStore.swift; sourceTree = "<group>"; };
7CBA1F507173A58E28FD0006 /* ComposerViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposerViews.swift; sourceTree = "<group>"; };
80C499315086814D391D635A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
81CE91210C85B61F088A0AC4 /* CalendarStateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarStateTests.swift; sourceTree = "<group>"; };
8613B4D32EB797DCEADA9EBA /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
90F72FD8B73B39494A9C9FE9 /* Clock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Clock.swift; sourceTree = "<group>"; };
91B70DC5796F2B4D55503295 /* InfoViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoViews.swift; sourceTree = "<group>"; };
9B6889B3E2DEF68A35EEC29A /* InfoPlist.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = InfoPlist.xcstrings; sourceTree = "<group>"; };
A39698276C7238569CDCC103 /* ShortcutRecorder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortcutRecorder.swift; sourceTree = "<group>"; };
A457F5005D2B31C85D1B396B /* DesktopWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesktopWindowController.swift; sourceTree = "<group>"; };
A5BD3CEA2ED40D9181113154 /* SettingsPanes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsPanes.swift; sourceTree = "<group>"; };
AB45FEF8F88436D9CCC33C00 /* HotkeyStoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HotkeyStoreTests.swift; sourceTree = "<group>"; };
ACC0D721D056789B08A7C0DE /* Theme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = "<group>"; };
B211D3CFF1CF666A5F50D14C /* Hotkeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Hotkeys.swift; sourceTree = "<group>"; };
B2F95875A337A64EF513DDB9 /* ComposerWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposerWindowController.swift; sourceTree = "<group>"; };
B6D0D42B1162F2BFFD870E82 /* LegacyMigration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyMigration.swift; sourceTree = "<group>"; };
D66A7A9DC1B15CDD7E970CA6 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = "<group>"; };
E63D7226AC881AAA873202DA /* Signing.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Signing.xcconfig; sourceTree = "<group>"; };
EAB683E77DDC787880B51001 /* SettingsWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsWindowController.swift; sourceTree = "<group>"; };
F226DBE68F9BACBB08BF3513 /* HotkeyCenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HotkeyCenter.swift; sourceTree = "<group>"; };
F295C55491DEEBCD13265AA7 /* KeyDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyDisplay.swift; sourceTree = "<group>"; };
FB7A450502CE85C6BF89C323 /* DemoData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoData.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -82,7 +89,6 @@
buildActionMask = 2147483647;
files = (
B460AA9811021F708D266309 /* BlotterKit in Frameworks */,
EC1BC7C15297CB1756BC2998 /* KeyboardShortcuts in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -102,11 +108,23 @@
isa = PBXGroup;
children = (
81CE91210C85B61F088A0AC4 /* CalendarStateTests.swift */,
AB45FEF8F88436D9CCC33C00 /* HotkeyStoreTests.swift */,
20900949505E9C73E04E0F5B /* LegacyMigrationTests.swift */,
);
path = BlotterTests;
sourceTree = "<group>";
};
343DFA2E11E28DD752B369BB /* Hotkeys */ = {
isa = PBXGroup;
children = (
F226DBE68F9BACBB08BF3513 /* HotkeyCenter.swift */,
6B60C660B24FCF34477469B7 /* HotkeyStore.swift */,
F295C55491DEEBCD13265AA7 /* KeyDisplay.swift */,
A39698276C7238569CDCC103 /* ShortcutRecorder.swift */,
);
path = Hotkeys;
sourceTree = "<group>";
};
3A9DB0295A512720FAA772B8 /* Packages */ = {
isa = PBXGroup;
children = (
Expand All @@ -122,6 +140,7 @@
79D433668AE6E7346B5300E2 /* Calendar */,
041961520AA3B1CA7F14D59A /* Composer */,
78147C34C97A52FBF66B4F8C /* Desktop */,
343DFA2E11E28DD752B369BB /* Hotkeys */,
C6E5478AEC73A419F93421C3 /* Resources */,
AB103A4A20F55DFF2852C558 /* Settings */,
5CDA618EF0B2547C7FC33531 /* Views */,
Expand All @@ -144,7 +163,6 @@
isa = PBXGroup;
children = (
A457F5005D2B31C85D1B396B /* DesktopWindowController.swift */,
B211D3CFF1CF666A5F50D14C /* Hotkeys.swift */,
47AC6B698EAA0DC67950116E /* StatusItemController.swift */,
);
path = Desktop;
Expand Down Expand Up @@ -255,7 +273,6 @@
name = Blotter;
packageProductDependencies = (
A05D578AF9F493704490E60A /* BlotterKit */,
98098395C7A5423B6F6F05E6 /* KeyboardShortcuts */,
);
productName = Blotter;
productReference = 68D711593EEC0A6D2F558722 /* Blotter.app */;
Expand Down Expand Up @@ -298,7 +315,6 @@
mainGroup = 8369A2CF3DFCCED04249107F;
minimizedProjectReferenceProxies = 1;
packageReferences = (
DE91A13C0C0E8CE6B438FA0E /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */,
7CFD05BFCEF3B5A7D4C8B93D /* XCLocalSwiftPackageReference "BlotterKit" */,
);
preferredProjectObjectVersion = 77;
Expand Down Expand Up @@ -330,6 +346,7 @@
buildActionMask = 2147483647;
files = (
74C6F98F86BDE2069821F3CB /* CalendarStateTests.swift in Sources */,
7F2217B81DFF4859B64BC3EF /* HotkeyStoreTests.swift in Sources */,
589284774E0F9533914DBCBF /* LegacyMigrationTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -349,11 +366,14 @@
62E5BD8B91F24BBE502341D4 /* ComposerWindowController.swift in Sources */,
48B139E9DCFBDE48B2C62CFD /* DemoData.swift in Sources */,
F948C6E955A84B0DB0DACB6C /* DesktopWindowController.swift in Sources */,
442D214084AF2836CF976F75 /* Hotkeys.swift in Sources */,
2259160724D8D7DA438C541E /* HotkeyCenter.swift in Sources */,
F4BB0039B457AD3889DB733F /* HotkeyStore.swift in Sources */,
8B8F993846BC3DB10860C6CA /* InfoViews.swift in Sources */,
A06C756DA1FEF9036405FE7B /* KeyDisplay.swift in Sources */,
89FFC6AE9E0F45805D1F4D8B /* LegacyMigration.swift in Sources */,
F09447040C05C93E8A3474C8 /* SettingsPanes.swift in Sources */,
8047A43C7378E43FC4250379 /* SettingsWindowController.swift in Sources */,
BD74D6850EE8C07A670FCF67 /* ShortcutRecorder.swift in Sources */,
E13EDFD8F4F82C977321ED53 /* StatusItemController.swift in Sources */,
A5C39BC08481288BE9563EAD /* Theme.swift in Sources */,
9F1874D017783F8E938059E1 /* WeekView.swift in Sources */,
Expand Down Expand Up @@ -619,23 +639,7 @@
};
/* End XCLocalSwiftPackageReference section */

/* Begin XCRemoteSwiftPackageReference section */
DE91A13C0C0E8CE6B438FA0E /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sindresorhus/KeyboardShortcuts";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 3.1.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
98098395C7A5423B6F6F05E6 /* KeyboardShortcuts */ = {
isa = XCSwiftPackageProductDependency;
package = DE91A13C0C0E8CE6B438FA0E /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */;
productName = KeyboardShortcuts;
};
A05D578AF9F493704490E60A /* BlotterKit */ = {
isa = XCSwiftPackageProductDependency;
productName = BlotterKit;
Expand Down

This file was deleted.

21 changes: 19 additions & 2 deletions Blotter/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,21 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
self.desktopWindow = desktopWindow

statusItem = StatusItemController(actions: self, state: state)
Hotkeys.install(actions: self)
HotkeyCenter.shared.start(store: HotkeyStore.shared) { [weak self] action in
self?.perform(action)
}
state.noteActivity()

store.requestAccess()

let defaults = UserDefaults.standard
if defaults.bool(forKey: AppDefaults.showsSettingsAtLaunch) {
defaults.set(false, forKey: AppDefaults.showsSettingsAtLaunch)
showSettings()
// `-BlotterSettingsPane <n>` opens a specific pane, for screenshots.
let pane = SettingsWindowController.Pane(rawValue: defaults.integer(forKey: "BlotterSettingsPane"))
state.noteActivity()
settingsWindow.show(pane: pane)
activate()
}
}

Expand Down Expand Up @@ -116,6 +122,17 @@ extension AppDelegate: CalendarActions {
}
}

private func perform(_ action: HotkeyAction) {
switch action {
case .toggleFront: toggleFront()
case .newEvent: showNewEvent()
case .newReminder: showNewReminder()
case .nextWeek: showNextWeek()
case .previousWeek: showPreviousWeek()
case .currentWeek: showCurrentWeek()
}
}

func showNextWeek() { state.navigate(to: state.weekOffset + 1) }

func showPreviousWeek() { state.navigate(to: state.weekOffset - 1) }
Expand Down
20 changes: 8 additions & 12 deletions Blotter/App/LegacyMigration.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import AppKit
import BlotterKit
import KeyboardShortcuts
import OSLog
import ServiceManagement

Expand Down Expand Up @@ -40,7 +39,7 @@ enum LegacyMigration {

// MARK: Shortcuts

private static let legacyShortcuts: [(key: String, name: KeyboardShortcuts.Name)] = [
private static let legacyShortcuts: [(key: String, action: HotkeyAction)] = [
("shortcutBringToFront", .toggleFront),
("shortcutNewEvent", .newEvent),
("shortcutNewTask", .newReminder),
Expand All @@ -50,18 +49,15 @@ enum LegacyMigration {
]

/// 2.x stored ShortcutRecorder's `SRShortcut`, keyed-archived, under the same names.
static func migrateShortcuts(defaults: UserDefaults) {
for (key, name) in legacyShortcuts {
guard KeyboardShortcuts.getShortcut(for: name) == nil,
static func migrateShortcuts(defaults: UserDefaults, store: HotkeyStore = .shared) {
for (key, action) in legacyShortcuts {
guard store.combo(for: action) == nil,
let data = defaults.data(forKey: key),
let legacy = LegacyShortcut.unarchive(data)
let legacy = LegacyShortcut.unarchive(data),
let combo = KeyCombo(legacyKeyCode: legacy.keyCode, modifierFlags: legacy.modifierFlags),
KeyCombo.conflict(for: combo, assigningTo: action, in: store.combos) == nil
else { continue }
KeyboardShortcuts.setShortcut(
KeyboardShortcuts.Shortcut(
KeyboardShortcuts.Key(rawValue: legacy.keyCode),
modifiers: NSEvent.ModifierFlags(rawValue: legacy.modifierFlags)
.intersection(.deviceIndependentFlagsMask)),
for: name)
store.set(combo, for: action)
}
}

Expand Down
22 changes: 0 additions & 22 deletions Blotter/Desktop/Hotkeys.swift

This file was deleted.

Loading
Loading