Skip to content

Instantly share code, notes, and snippets.

@dkandalov
Created October 30, 2024 18:32
Show Gist options
  • Save dkandalov/d326df86849a2a097d169b781ffbc0a4 to your computer and use it in GitHub Desktop.
Save dkandalov/d326df86849a2a097d169b781ffbc0a4 to your computer and use it in GitHub Desktop.
import com.intellij.openapi.wm.impl.ProjectFrameHelper
import com.intellij.openapi.wm.impl.status.InfoAndProgressPanel
import liveplugin.getProperty
import liveplugin.invoke
import liveplugin.registerAction
import java.awt.KeyboardFocusManager
// https://youtrack.jetbrains.com/issue/IDEA-216058/Return-focus-from-Background-Tasks-window-to-IDE-via-keyboard
registerAction("Show Background Process Window", keyStroke = "meta shift B") {
val window = KeyboardFocusManager.getCurrentKeyboardFocusManager().focusedWindow
val statusBar = ProjectFrameHelper.getFrameHelper(window)?.statusBar ?: return@registerAction
val panel = statusBar.getProperty<InfoAndProgressPanel>("infoAndProgressPanel")
if (statusBar.isProcessWindowOpen) {
panel.invoke("hideProcessPopup")
} else {
panel.invoke("openProcessPopup", /*requestFocus*/ false)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment