Major improvements and bug fixes for v1.1.0
Some checks failed
Build and Release / Build DMG for arm64 (push) Has been cancelled
Build and Release / Build DMG for x86_64 (push) Has been cancelled
Build and Release / Create Release (push) Has been cancelled

Features:
- Add auto-enable on startup based on config
- Add enabled state persistence in config.json
- Add limitations notice in GUI menu
- Simplify logging to single file (uskey.log)
- Change "Open Logs Folder" to "Open Config Folder"

Bug Fixes:
- Fix GUI status display mismatch on startup
- Fix first toggle click not working issue
- Revert password field changes that caused key blocking

UI Changes:
- Add ⚠️ emoji to "About Limitations" menu item
- Remove button action to fix menu refresh

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
loveuer
2025-12-05 13:48:15 +08:00
parent 99bbbbc73a
commit 6285cabdd1
6 changed files with 94 additions and 51 deletions

View File

@@ -54,10 +54,12 @@ struct MappingConfig: Codable {
struct Config: Codable {
let log: LogConfig
let mapping: MappingConfig
let enabled: Bool
init(log: LogConfig = LogConfig(), mapping: MappingConfig = MappingConfig()) {
init(log: LogConfig = LogConfig(), mapping: MappingConfig = MappingConfig(), enabled: Bool = true) {
self.log = log
self.mapping = mapping
self.enabled = enabled
}
static func load(from path: String) throws -> Config {
@@ -67,13 +69,21 @@ struct Config: Codable {
return try decoder.decode(Config.self, from: data)
}
static func save(_ config: Config, to path: String) throws {
let encoder = JSONEncoder()
encoder.outputFormatting = [.prettyPrinted, .sortedKeys]
let data = try encoder.encode(config)
try data.write(to: URL(fileURLWithPath: path))
}
static func createDefault(at path: String) throws {
let defaultConfig = Config(
log: LogConfig(level: .info),
mapping: MappingConfig(mappings: [
"backslash2backspace": KeyMapping(from: 42, to: 51),
"backspace2backslash": KeyMapping(from: 51, to: 42)
])
]),
enabled: true
)
let encoder = JSONEncoder()
@@ -90,4 +100,4 @@ struct Config: Codable {
return configDir.appendingPathComponent("config.json").path
}
}
}