Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
eugenov opened this issue Jul 12, 2022 · 2 comments
Open

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

eugenov opened this issue Jul 12, 2022 · 2 comments
Assignees
Labels
feature New feature

Comments

@eugenov
Copy link

eugenov commented Jul 12, 2022

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!

@kingToolbox
Copy link
Owner

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 kingToolbox self-assigned this Jul 13, 2022
@kingToolbox kingToolbox added the feature New feature label Jul 13, 2022
@eugenov
Copy link
Author

eugenov commented Jul 14, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

No branches or pull requests

2 participants