fix: app was broken for new installs because of the tab keyCode

Bug was introduced in b6e4826e40
This commit is contained in:
Louis Pontoise committed 2019-10-26 01:12:25 +09:00
1 parent e51379a575
commit 51e9aeef05
3 files changed
+8 -8

No files matched your search

+1 -1
View File
@@ -2,10 +2,10 @@ import Cocoa
// Apple doesn't provide an enum for this, strangely
enum KeyCode: UInt16 {
case tab = 48
case escape = 53
case command = 55
case capsLock = 57
case tab = 58
case control = 59
case function = 63
case leftArrow = 123
+5 -5
View File
@@ -3,12 +3,12 @@ import Cocoa
class Preferences {
static var defaults: [String: String] = [
"version": "1", // bump this anytime the dictionary is changed
"maxScreenUsage": "0.8",
"version": "2", // bump this anytime the dictionary is changed
"maxScreenUsage": "80",
"maxThumbnailsPerRow": "4",
"iconSize": "32",
"fontHeight": "15",
"tabKey": String(KeyCode.tab.rawValue),
"tabKeyCode": String(KeyCode.tab.rawValue),
"metaKey": metaKeyMacro.macros[0].label,
"windowDisplayDelay": "0",
"theme": themeMacro.macros[0].label
@@ -67,7 +67,7 @@ class Preferences {
static func updateAndValidateFromString(_ valueName: String, _ value: String) throws {
switch valueName {
case "maxScreenUsage":
maxScreenUsage = try CGFloat(value).orThrow()
maxScreenUsage = try CGFloat(CGFloat(value).orThrow() / 100)
case "maxThumbnailsPerRow":
maxThumbnailsPerRow = try CGFloat(value).orThrow()
case "iconSize":
@@ -75,7 +75,7 @@ class Preferences {
case "fontHeight":
fontHeight = try CGFloat(value).orThrow()
font = NSFont.systemFont(ofSize: fontHeight!)
case "tabKey":
case "tabKeyCode":
tabKeyCode = try UInt16(value).orThrow()
case "metaKey":
let p = try metaKeyMacro.labelToMacro[value].orThrow()
+2 -2
View File
@@ -11,7 +11,7 @@ class PreferencesPanel: NSPanel, NSTextViewDelegate {
var iconSize: NSTextView?
var fontHeight: NSTextView?
var interItemPadding: NSTextView?
var tabKey: NSTextView?
var tabKeyCode: NSTextView?
var windowDisplayDelay: NSTextView?
var metaKey: NSPopUpButton?
var theme: NSPopUpButton?
@@ -28,7 +28,7 @@ class PreferencesPanel: NSPanel, NSTextViewDelegate {
[
makeLabelWithDropdown(\PreferencesPanel.theme, "Main window theme", "theme", Preferences.themeMacro.labels),
makeLabelWithDropdown(\PreferencesPanel.metaKey, "Meta key to activate the app", "metaKey", Preferences.metaKeyMacro.labels),
makeLabelWithInput(\PreferencesPanel.tabKey, "Tab key (NSEvent.keyCode)", "tabKey"),
makeLabelWithInput(\PreferencesPanel.tabKeyCode, "Tab key (NSEvent.keyCode)", "tabKeyCode"),
makeLabelWithInput(\PreferencesPanel.maxScreenUsage, "Max window size (screen %)", "maxScreenUsage"),
makeLabelWithInput(\PreferencesPanel.maxThumbnailsPerRow, "Max thumbnails per row", "maxThumbnailsPerRow"),
makeLabelWithInput(\PreferencesPanel.iconSize, "Apps icon size (px)", "iconSize"),