File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
src/main/kotlin/com/jetpackduba/gitnuro Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ import com.jetpackduba.gitnuro.ui.AppTab
48
48
import com.jetpackduba.gitnuro.ui.TabsManager
49
49
import com.jetpackduba.gitnuro.ui.components.RepositoriesTabPanel
50
50
import com.jetpackduba.gitnuro.ui.components.TabInformation
51
+ import com.jetpackduba.gitnuro.ui.components.TabInformation.Companion.NEW_TAB_DEFAULT_NAME
51
52
import com.jetpackduba.gitnuro.ui.context_menu.AppPopupMenu
52
53
import com.jetpackduba.gitnuro.ui.dialogs.settings.ProxyType
53
54
import kotlinx.coroutines.launch
@@ -64,6 +65,7 @@ import javax.inject.Inject
64
65
65
66
66
67
private const val TAG = " App"
68
+ private const val MAX_CHARS_CURRENT_TAB_NAME = 250
67
69
68
70
69
71
class App {
@@ -145,9 +147,13 @@ class App {
145
147
// Save window state for next time the Window is started
146
148
appSettingsRepository.windowPlacement = windowState.placement.preferenceValue
147
149
150
+ val currentTab = tabsManager.currentTab.collectAsState().value
151
+
152
+ val currentTabName = (currentTab?.tabName?.value ? : NEW_TAB_DEFAULT_NAME ).take(MAX_CHARS_CURRENT_TAB_NAME )
153
+
148
154
if (isOpen) {
149
155
Window (
150
- title = System .getenv(" title" ) ? : AppConstants .APP_NAME ,
156
+ title = " ${ System .getenv(" title" ) ? : AppConstants .APP_NAME } - $currentTabName " ,
151
157
onCloseRequest = {
152
158
isOpen = false
153
159
},
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ class TabsManager @Inject constructor(
136
136
}
137
137
138
138
private fun newAppTab (
139
- tabName : MutableState <String > = mutableStateOf(TabInformation .DEFAULT_NAME ),
139
+ tabName : MutableState <String > = mutableStateOf(TabInformation .NEW_TAB_DEFAULT_NAME ),
140
140
path : String? = null,
141
141
): TabInformation {
142
142
return TabInformation (
Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ class TabInformation(
272
272
this .path = newPath
273
273
274
274
if (newPath == null ) {
275
- tabName.value = DEFAULT_NAME
275
+ tabName.value = NEW_TAB_DEFAULT_NAME
276
276
} else {
277
277
tabName.value = Path (newPath).name
278
278
appStateManager.repositoryTabChanged(newPath)
@@ -290,7 +290,7 @@ class TabInformation(
290
290
}
291
291
292
292
companion object {
293
- const val DEFAULT_NAME = " New tab"
293
+ const val NEW_TAB_DEFAULT_NAME = " New tab"
294
294
}
295
295
}
296
296
You can’t perform that action at this time.
0 commit comments