From 323a96b4ee3d730708cde90af2e36d698185ae88 Mon Sep 17 00:00:00 2001 From: Sasha Blashenkov Date: Fri, 12 May 2023 01:09:55 +0200 Subject: [PATCH] Ssshh!!! Secret flag to force colorful toolbar even when one project is open (cherry picked from commit 6fe9ebaf6d5b68edb4c9a5e3d10d698479e46e09) GitOrigin-RevId: 66b4affb93c67eb181baa3a03ef4151e83870ab7 --- .../com/intellij/ide/ProjectWindowCustomizerService.kt | 8 ++++++-- platform/util/resources/misc/registry.properties | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ProjectWindowCustomizerService.kt b/platform/platform-impl/src/com/intellij/ide/ProjectWindowCustomizerService.kt index 72dacdcdba57..be6a75ab279d 100644 --- a/platform/platform-impl/src/com/intellij/ide/ProjectWindowCustomizerService.kt +++ b/platform/platform-impl/src/com/intellij/ide/ProjectWindowCustomizerService.kt @@ -12,6 +12,7 @@ import com.intellij.openapi.project.ProjectManager import com.intellij.openapi.project.ex.ProjectManagerEx import com.intellij.openapi.startup.ProjectActivity import com.intellij.openapi.util.Disposer +import com.intellij.openapi.util.registry.Registry import com.intellij.openapi.wm.ex.WindowManagerEx import com.intellij.openapi.wm.impl.ProjectFrameHelper import com.intellij.ui.GotItTooltip @@ -50,7 +51,7 @@ class ProjectWindowCustomizerService : Disposable { internal fun update(newValue: Boolean) { if (newValue != ourSettingsValue) { ourSettingsValue = newValue - wasGradientPainted = newValue && ProjectManager.getInstance().openProjects.size > 1 + wasGradientPainted = newValue && conditionToEnable() fireUpdate() } } @@ -71,12 +72,14 @@ class ProjectWindowCustomizerService : Disposable { } fun enableIfNeeded() { - if (ProjectManagerEx.getOpenProjects().size > 1 && !wasGradientPainted) { + if (conditionToEnable() && !wasGradientPainted) { wasGradientPainted = true fireUpdate() } } + private fun conditionToEnable() = ProjectManagerEx.getOpenProjects().size > 1 || Registry.`is`("ide.colorful.toolbar.force") + fun addListener(disposable: Disposable, fireFirstTime: Boolean, listener: (Boolean) -> Unit) { if (fireFirstTime) { listener(isActive()) @@ -92,6 +95,7 @@ class ProjectWindowCustomizerService : Disposable { } fun shouldShowGotIt() = !gotItShown + private fun recordGotItShown() { gotItShown = true } diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index dc46ca7c8bbd..f140d17286e5 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -2337,5 +2337,9 @@ ide.speed.search.allow.custom.location.description=Allow using SpeedSearchSupply ide.log.coroutine.pce=true ide.log.coroutine.pce.description=Log PCEs occurring in coroutines. \ These exceptions are treated as failure by coroutine framework, and should be reported as such. + +ide.colorful.toolbar.force=false +ide.colorful.toolbar.force.description=Show 'Colorful toolbar' even if there is one project open (works only if the feature is enabled). \ + Reopen project or restart IDE to apply the setting # please leave this note as last line # TODO please use EP com.intellij.registryKey for plugin/product specific keys