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

Add new-window command functionality #145

Merged
merged 21 commits into from
May 16, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added session-level history suppression.
  • Loading branch information
kmactavish committed May 12, 2016
commit 67e9a2f6e2cc31c8a4323767885740e43c42f462
19 changes: 19 additions & 0 deletions doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,25 @@ JSON
.. literalinclude:: ../examples/focus-window-and-panes.json
:language: json

Terminal History
----------------

tmuxp allows ``suppress_history: false`` to override the default command /
suppression when building the workspace.
This will add the ``shell_command`` to the bash history in the pane.

YAML
~~~~

.. literalinclude:: ../examples/suppress-history.yaml
:language: yaml

JSON
~~~~

.. literalinclude:: ../examples/suppress-history.json
:language: json

Window Index
------------

Expand Down
14 changes: 8 additions & 6 deletions examples/suppress-history.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,43 @@
"windows": [
{
"panes": [
"echo 'in the history!'"
"echo 'window in the history!'"
],
"focus": true,
"suppress_history": false,
"window_name": "appended"
},
{
"panes": [
"echo 'not in the history!'"
"echo 'window not in the history!'"
],
"suppress_history": true,
"window_name": "suppressed"
},
{
"panes": [
"echo 'default not in the history!'"
"echo 'session in the history!'"
],
"window_name": "default"
},
{
"panes": [
{
"shell_command": "echo 'in the history!'",
"shell_command": "echo 'command in the history!'",
"suppress_history": false
},
{
"shell_command": "echo 'not in the history!'",
"shell_command": "echo 'command not in the history!'",
"suppress_history": true
},
{
"shell_command": "echo 'default not in the history!'"
"shell_command": "echo 'window not in the history!'"
}
],
"suppress_history": true,
"window_name": "mixed"
}
],
"suppress_history": false,
"session_name": "suppress"
}
14 changes: 8 additions & 6 deletions examples/suppress-history.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
session_name: suppress
suppress_history: false
windows:
- window_name: appended
focus: true
suppress_history: false
panes:
- echo "in the history!"
- echo "window in the history!"

- window_name: suppressed
suppress_history: true
panes:
- echo "not in the history!"
- echo "window not in the history!"

- window_name: default
panes:
- echo "default not in the history!"
- echo "session in the history!"

- window_name: mixed
suppress_history: false
panes:
- shell_command:
- echo "in the history!"
- echo "command in the history!"
suppress_history: false
- shell_command:
- echo "not in the history!"
- echo "command not in the history!"
suppress_history: true
- shell_command:
- echo "default not in the history!"
- echo "window in the history!"
10 changes: 10 additions & 0 deletions tmuxp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ def trickle(sconf):
else:
session_start_directory = None

if 'suppress_history' in sconf:
suppress_history = sconf['suppress_history']
else:
suppress_history = None

for windowconfig in sconf['windows']:

# Prepend start_directory to relative window commands
Expand All @@ -325,6 +330,11 @@ def trickle(sconf):
)
windowconfig['start_directory'] = window_start_path

# We only need to trickle to the window, workspace builder checks wconf
if suppress_history is not None:
if not 'suppress_history' in windowconfig:
windowconfig['suppress_history'] = suppress_history

for paneconfig in windowconfig['panes']:
commands_before = []

Expand Down