mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
chore: improve wsl
This commit is contained in:
@@ -2,9 +2,10 @@ package app.termora
|
|||||||
|
|
||||||
import com.formdev.flatlaf.extras.FlatSVGIcon
|
import com.formdev.flatlaf.extras.FlatSVGIcon
|
||||||
|
|
||||||
open class DynamicIcon(name: String, private val darkName: String) : FlatSVGIcon(name) {
|
open class DynamicIcon(name: String, private val darkName: String, val allowColorFilter: Boolean = true) :
|
||||||
|
FlatSVGIcon(name) {
|
||||||
constructor(name: String) : this(name, name)
|
constructor(name: String) : this(name, name)
|
||||||
|
|
||||||
val dark by lazy { DynamicIcon(darkName, name) }
|
val dark by lazy { DynamicIcon(darkName, name, allowColorFilter) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,12 @@ object Icons {
|
|||||||
val error by lazy { DynamicIcon("icons/error.svg", "icons/error_dark.svg") }
|
val error by lazy { DynamicIcon("icons/error.svg", "icons/error_dark.svg") }
|
||||||
val cwmUsers by lazy { DynamicIcon("icons/cwmUsers.svg", "icons/cwmUsers_dark.svg") }
|
val cwmUsers by lazy { DynamicIcon("icons/cwmUsers.svg", "icons/cwmUsers_dark.svg") }
|
||||||
val cwmPermissions by lazy { DynamicIcon("icons/cwmPermissions.svg", "icons/cwmPermissions_dark.svg") }
|
val cwmPermissions by lazy { DynamicIcon("icons/cwmPermissions.svg", "icons/cwmPermissions_dark.svg") }
|
||||||
val warningIntroduction by lazy { DynamicIcon("icons/warningIntroduction.svg", "icons/warningIntroduction_dark.svg") }
|
val warningIntroduction by lazy {
|
||||||
|
DynamicIcon(
|
||||||
|
"icons/warningIntroduction.svg",
|
||||||
|
"icons/warningIntroduction_dark.svg"
|
||||||
|
)
|
||||||
|
}
|
||||||
val networkPolicy by lazy { DynamicIcon("icons/networkPolicy.svg", "icons/networkPolicy_dark.svg") }
|
val networkPolicy by lazy { DynamicIcon("icons/networkPolicy.svg", "icons/networkPolicy_dark.svg") }
|
||||||
val clusterRole by lazy { DynamicIcon("icons/clusterRole.svg", "icons/clusterRole_dark.svg") }
|
val clusterRole by lazy { DynamicIcon("icons/clusterRole.svg", "icons/clusterRole_dark.svg") }
|
||||||
val daemonSets by lazy { DynamicIcon("icons/daemonSets.svg", "icons/daemonSets_dark.svg") }
|
val daemonSets by lazy { DynamicIcon("icons/daemonSets.svg", "icons/daemonSets_dark.svg") }
|
||||||
@@ -91,7 +96,7 @@ object Icons {
|
|||||||
val digitalocean by lazy { DynamicIcon("icons/digitalocean.svg", "icons/digitalocean_dark.svg") }
|
val digitalocean by lazy { DynamicIcon("icons/digitalocean.svg", "icons/digitalocean_dark.svg") }
|
||||||
val terminalUnread by lazy { DynamicIcon("icons/terminalUnread.svg", "icons/terminalUnread_dark.svg") }
|
val terminalUnread by lazy { DynamicIcon("icons/terminalUnread.svg", "icons/terminalUnread_dark.svg") }
|
||||||
val dbPrimitive by lazy { DynamicIcon("icons/dbPrimitive.svg", "icons/dbPrimitive_dark.svg") }
|
val dbPrimitive by lazy { DynamicIcon("icons/dbPrimitive.svg", "icons/dbPrimitive_dark.svg") }
|
||||||
val linux by lazy { DynamicIcon("icons/linux.svg", "icons/linux_dark.svg") }
|
val linux by lazy { DynamicIcon("icons/linux.svg", "icons/linux_dark.svg", false) }
|
||||||
val debian by lazy { DynamicIcon("icons/debian.svg") }
|
val debian by lazy { DynamicIcon("icons/debian.svg") }
|
||||||
val fedora by lazy { DynamicIcon("icons/fedora.svg") }
|
val fedora by lazy { DynamicIcon("icons/fedora.svg") }
|
||||||
val almalinux by lazy { DynamicIcon("icons/almalinux.svg") }
|
val almalinux by lazy { DynamicIcon("icons/almalinux.svg") }
|
||||||
|
|||||||
@@ -29,12 +29,14 @@ internal open class WSLHostOptionsPane : OptionsPane() {
|
|||||||
open fun getHost(): Host {
|
open fun getHost(): Host {
|
||||||
val name = generalOption.nameTextField.text
|
val name = generalOption.nameTextField.text
|
||||||
val protocol = WSLProtocolProvider.PROTOCOL
|
val protocol = WSLProtocolProvider.PROTOCOL
|
||||||
val host = (generalOption.hostComboBox.selectedItem as WSLDistribution).distributionName
|
val wsl = generalOption.hostComboBox.selectedItem as WSLDistribution
|
||||||
|
val host = wsl.distributionName
|
||||||
|
|
||||||
val options = Options.Companion.Default.copy(
|
val options = Options.Companion.Default.copy(
|
||||||
encoding = terminalOption.charsetComboBox.selectedItem as String,
|
encoding = terminalOption.charsetComboBox.selectedItem as String,
|
||||||
env = terminalOption.environmentTextArea.text,
|
env = terminalOption.environmentTextArea.text,
|
||||||
startupCommand = terminalOption.startupCommandTextField.text,
|
startupCommand = terminalOption.startupCommandTextField.text,
|
||||||
|
extras = mutableMapOf("wsl-guid" to wsl.guid, "wsl-flavor" to wsl.flavor)
|
||||||
)
|
)
|
||||||
|
|
||||||
return Host(
|
return Host(
|
||||||
|
|||||||
@@ -85,11 +85,11 @@ open class SimpleTreeCellRenderer : DefaultTreeCellRenderer() {
|
|||||||
if (c is DefaultTreeCellRenderer) {
|
if (c is DefaultTreeCellRenderer) {
|
||||||
if (g.color == c.textSelectionColor) {
|
if (g.color == c.textSelectionColor) {
|
||||||
val icon = this.icon
|
val icon = this.icon
|
||||||
if (icon is DynamicIcon && FlatLaf.isLafDark().not()) {
|
if (icon is DynamicIcon && icon.allowColorFilter && FlatLaf.isLafDark().not()) {
|
||||||
val oldColorFilter = icon.colorFilter
|
val oldColorFilter = icon.colorFilter
|
||||||
// icon.colorFilter = colorFilter
|
icon.colorFilter = colorFilter
|
||||||
icon.paintIcon(c, g, x, y)
|
icon.paintIcon(c, g, x, y)
|
||||||
// icon.colorFilter = oldColorFilter
|
icon.colorFilter = oldColorFilter
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user