Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.4.0 #22

Merged
merged 7 commits into from
Nov 4, 2024
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
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 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 Expand Up @@ -201,7 +204,7 @@
val user32 = User32.INSTANCE
val fgWindow: WinDef.HWND? = user32.GetForegroundWindow() // Get the handle of the foreground window

if (fgWindow == null) {

Check notice on line 207 in src/main/kotlin/com/github/siropkin/kursor/KeyboardLayout.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

If-Null return/break/... foldable to '?:'

If-Null return/break/... foldable to '?:'
return KeyboardLayoutInfo(locale.language, locale.country, "")
}

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}"
}
}
Loading