diff --git a/sources/SquirrelApplicationDelegate.swift b/sources/SquirrelApplicationDelegate.swift index d955ab701..cc677e93f 100644 --- a/sources/SquirrelApplicationDelegate.swift +++ b/sources/SquirrelApplicationDelegate.swift @@ -261,13 +261,11 @@ private func notificationHandler(contextObject: UnsafeMutableRawPointer?, sessio if !delegate.enableNotifications { return } - // schema change + if messageType == "schema", let messageValue = messageValue, let schemaName = try? /^[^\/]*\/(.*)$/.firstMatch(in: messageValue)?.output.1 { delegate.showStatusMessage(msgTextLong: String(schemaName), msgTextShort: String(schemaName)) return - } - // option change - if messageType == "option" { + } else if messageType == "option" { let state = messageValue?.first != "!" let optionName = if state { messageValue @@ -280,7 +278,9 @@ private func notificationHandler(contextObject: UnsafeMutableRawPointer?, sessio let stateLabelShort = delegate.rimeAPI.get_state_label_abbreviated(sessionId, name, state, true) let longLabel = stateLabelLong.str.map { String(cString: $0) } let shortLabel = stateLabelShort.str.map { String(cString: $0) } - delegate.showStatusMessage(msgTextLong: longLabel, msgTextShort: shortLabel) + if longLabel != nil || shortLabel != nil { + delegate.showStatusMessage(msgTextLong: longLabel, msgTextShort: shortLabel) + } } } }