WindTerm icon indicating copy to clipboard operation
WindTerm copied to clipboard

Keymap change "Window.ShowPane*" to "Window.TogglePane*"

Open eugenov opened this issue 1 year ago • 2 comments

Hello! Could you replace behavior "Show" with "Toggle"? Shortcut only opens pane, does not close it, and it is not too convenient. Or add new class of "TogglePane" shortcuts. For example "Window.ShowPaneSession" -> "Window.TogglePaneSession" Thanks!

eugenov avatar Jul 12 '22 07:07 eugenov

Sure, I will evaluate this requirement and implement it in 2.5.0 version if possible. The reason why the shortcut key can only open and not close the pane is because I am worried that someone may accidentally close the pane by pressing the shortcut key multiple times.

BTW: You can also do this yourself by following the steps below:

  • Open WindTerm_installed_path/global/wind.actions and insert:
  "Window.TogglePaneExplorer" : {
    "text"      : "Toggle &Explorer",
    "icon"      : "king::explorerPane",
    "script"    : "() => {
      if (window.activeKit.isPaneVisible('ExplorerPane')) {
        window.activeKit.hidePane('ExplorerPane');
      } else {
        window.activeKit.showPane('ExplorerPane');
      }
    }"
  },
  • Open WindTerm_installed_path/global/wind.keymaps and change:
  { "keys": "<Alt+W><Alt+E>",
    "when": "window.isScope('terminal.*')",
    "action": "Window.ShowPaneExplorer"
  },

to:

  { "keys": "<Alt+W><Alt+E>",
    "when": "window.isScope('terminal.*')",
    "action": "Window.TogglePaneExplorer"
  },
  • Done.

kingToolbox avatar Jul 13 '22 18:07 kingToolbox

Thank you for your answers! What was done:

  1. created file WindTerm_installed_path\.wind\profiles\default.v10\user.actions with content:
{
  "Window.TogglePaneSession" : {
    "text"      : "Toggle &Session",
    "icon"      : "king::sessionPane",
    "script"    : "() => {
      if (window.activeKit.isPaneVisible('SessionPane')) {
        window.activeKit.hidePane('SessionPane');
      } else {
        window.activeKit.showPane('SessionPane');
      }
    }"
  }
}
  1. replaced in WindTerm_installed_path\.wind\profiles\default.v10\user.keymaps
  { "keys": "<Alt+S>",
    "when": "window.isScope('terminal.*')",
    "action": "Window.ShowPaneSession"
  },

with

  { "keys": "<Alt+S>",
    "when": "window.isScope('terminal.*')",
    "action": "Window.TogglePaneSession"
  },

Results of experiments:

  1. I toggle session pane with Alt+S, pane opens (right) 1
  2. I toggle session pane with Alt+S, pane remains in its place, but empty (wrong) 2

What I expected to see: 3 Could you make pane hide when it becomes empty (when all panes inside it are "unchecked")?

Or am I doing something wrong?

eugenov avatar Jul 14 '22 07:07 eugenov