Skip to content

Commit a34d1dd

Browse files
committed
impl: setting to configure the title source on the main page
This commit adds a option `useAppNameAsTitle` that allows users to specify whether or not they want to use the application name visible in the dashboard as Tbx main tile instead of the URL. Default is to use the URL.
1 parent 186630f commit a34d1dd

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/main/kotlin/com/coder/toolbox/settings/ReadOnlyCoderSettings.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ interface ReadOnlyCoderSettings {
1919
*/
2020
val defaultURL: String
2121

22+
/**
23+
* Whether to display the application name instead of the URL
24+
* in the main screen. Defaults to URL
25+
*/
26+
val useAppNameAsTitle: Boolean
27+
2228
/**
2329
* Used to download the Coder CLI which is necessary to proxy SSH
2430
* connections. The If-None-Match header will be set to the SHA1 of the CLI

src/main/kotlin/com/coder/toolbox/store/CoderSettingsStore.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class CoderSettingsStore(
3838
// Properties implementation
3939
override val lastDeploymentURL: String? get() = store[LAST_USED_URL]
4040
override val defaultURL: String get() = store[DEFAULT_URL] ?: "https://dev.coder.com"
41+
override val useAppNameAsTitle: Boolean = store[APP_NAME_AS_TITLE]?.toBooleanStrictOrNull() ?: false
4142
override val binarySource: String? get() = store[BINARY_SOURCE]
4243
override val binaryDirectory: String? get() = store[BINARY_DIRECTORY]
4344
override val disableSignatureVerification: Boolean
@@ -165,6 +166,10 @@ class CoderSettingsStore(
165166
store[LAST_USED_URL] = url.toString()
166167
}
167168

169+
fun updateUseAppNameAsTitle(appNameAsTitle: Boolean) {
170+
store[APP_NAME_AS_TITLE] = appNameAsTitle.toString()
171+
}
172+
168173
fun updateBinarySource(source: String) {
169174
store[BINARY_SOURCE] = source
170175
}

src/main/kotlin/com/coder/toolbox/store/StoreKeys.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ internal const val LAST_USED_URL = "lastDeploymentURL"
66

77
internal const val DEFAULT_URL = "defaultURL"
88

9+
internal const val APP_NAME_AS_TITLE = "useAppNameAsTitle"
10+
911
internal const val BINARY_SOURCE = "binarySource"
1012

1113
internal const val BINARY_DIRECTORY = "binaryDirectory"

0 commit comments

Comments
 (0)