Skip to content

Commit

Permalink
Merge pull request #22 from siropkin/develop
Browse files Browse the repository at this point in the history
v1.4.0
  • Loading branch information
siropkin authored Nov 4, 2024
2 parents 15d96f4 + 842c2e1 commit de25ff1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
## [Unreleased]


## [1.4.0] - 2024-11-04
### Changed
- #18: Added support for "Squirrel Method" (Chinese) (https://rime.im) on macOS.
- #20: Added support for "Russian - PC" on macOS.
- #21: Fixed color settings save bug; color settings now save correctly.


## [1.3.1] - 2024-08-26
### Changed
- Fix NullPointerException for Windows users.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This feature is particularly beneficial for developers juggling multiple languag
- **🔒 Caps Lock Indicator:** Shows the Caps Lock status on the cursor.
- **🔧 Customization:** Customize the language indicator's font, size, opacity, and position.
- **🖥️ Supported Operating Systems:** Available on Windows, Mac, and Linux.
- **🌐 Supported Languages And Input Methods:** Supports multiple languages and input methods, including Sogou Pinyin Method (Chinese) for macOS.
- **🌐 Supported Languages And Input Methods:** Supports a wide range of languages and input methods, including Chinese Sogou Pinyin and Squirrel Methods on macOS.


## Usage
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = com.github.siropkin.kursor
pluginName = Kursor
pluginRepositoryUrl = https://github.com/siropkin/kursor
# SemVer format -> https://semver.org
pluginVersion = 1.3.1
pluginVersion = 1.4.0

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 232
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/com/github/siropkin/kursor/KeyboardLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ private val windowsKeyboardVariantMap = mapOf(
)

private val macKeyboardVariantMap = mapOf(
"UserDefined_com.sogou.inputmethod.pinyin" to "ZH" // https://pinyin.sogou.com/mac
"UserDefined_19458" to "RU", // Russian
"UserDefined_com.sogou.inputmethod.pinyin" to "ZH", // Sogou Pinyin: https://pinyin.sogou.com/mac
"UserDefined_im.rime.inputmethod.Squirrel.Hans" to "ZH", // Squirrel - Simplified: https://rime.im
"UserDefined_im.rime.inputmethod.Squirrel.Hant" to "ZH" // Squirrel - Traditional: https://rime.im
)

class KeyboardLayoutInfo(private val language: String, private val country: String, private val variant: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.util.xmlb.Converter
import com.intellij.util.xmlb.XmlSerializerUtil
import com.intellij.util.xmlb.annotations.OptionTag
import java.awt.Color
import java.awt.Font

Expand All @@ -19,6 +21,7 @@ class KursorSettings : PersistentStateComponent<KursorSettings> {
var defaultLanguage: String = "us"

var changeColorOnNonDefaultLanguage: Boolean = true
@OptionTag("colorOnNonDefaultLanguage_", converter = ColorConverter::class)
var colorOnNonDefaultLanguage: Color = Color(255, 140, 0)

var showTextIndicator: Boolean = true
Expand Down Expand Up @@ -48,3 +51,14 @@ class KursorSettings : PersistentStateComponent<KursorSettings> {
}
}
}

class ColorConverter : Converter<Color>() {
override fun fromString(value: String): Color {
val parts = value.split(",")
return Color(parts[0].toInt(), parts[1].toInt(), parts[2].toInt(), parts[3].toInt())
}

override fun toString(value: Color): String {
return "${value.red},${value.green},${value.blue},${value.alpha}"
}
}

0 comments on commit de25ff1

Please sign in to comment.