Merge lp:~sprataa/terminator/layoutsonsteroids into lp:terminator/gtk3
Status: | Needs review |
---|---|
Proposed branch: | lp:~sprataa/terminator/layoutsonsteroids |
Merge into: | lp:terminator/gtk3 |
Diff against target: |
283 lines (+126/-2) 6 files modified
terminatorlib/ipc.py (+21/-0) terminatorlib/preferences.glade (+27/-0) terminatorlib/prefseditor.py (+23/-0) terminatorlib/terminal.py (+45/-2) terminatorlib/terminal_popup_menu.py (+4/-0) terminatorlib/terminator.py (+6/-0) |
To merge this branch: | bzr merge lp:~sprataa/terminator/layoutsonsteroids |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Terminator | Pending | ||
Review via email: mp+357667@code.launchpad.net |
Commit message
This commit is a PoC on how to improve Layout Saving mechanism further and allow automation;
Changelog:
Added virtualenvwrapper Virtual Environment setting to Terminal Layout;
Added Save Layout shortcut to Popup/Context Menu;
Saving a Layout now detects shell child processes and saves it in "Custom Command" field;
Changed "Custom Command" mechanism in order to be ran in child shell via input instead of using -c "command";
Improved PWD/CWD detection;
Added save_layout and push_environment to IPC/DBus Methods;
Description of the change
Example DBUS shell functions and usage:
function push_environment {
if [ TERMINATOR_UUID ]
then
env=`env | egrep "TERMINATOR_
dbus-send --session --type=method_call --dest=
fi
}
function save_layout {
if [ TERMINATOR_UUID ]
then
push_environment
dbus-send --session --type=method_call --dest=
fi
}
push_environment needs to be called from each terminal's child shell in order to inform terminator of the current environment.
The only place where you can access the current shell's environment. TERMINATOR_UUID needs to be sent in order to determine where it came from.
I currently have push_environment ran every time my shell's prompt is redrawn but this is optional.
You can run push_environment on each terminal you wish to update Virtual Environment and Working Directory.
Be advised that you still need to call save_layout function, "Save Layout" via the context menu or press "Save" in Layout Preferences window.
Unmerged revisions
- 1808. By Sérgio Prata Almeida
-
This commit is a PoC on how to improve Layout Saving mechanism further and allow automation;
Changelog:
Added virtualenvwrapper Virtual Environment setting to Terminal Layout;
Added Save Layout shortcut to Popup/Context Menu;
Saving a Layout now detects shell child processes and saves it in "Custom Command" field;
Changed "Custom Command" mechanism in order to be ran in child shell via input instead of using -c "command";
Improved PWD/CWD detection;
Added save_layout and push_environment to IPC/DBus Methods;-------
------- ------- ------- ------- ------- ----- Example DBUS shell functions and usage:
function push_environment {
if [ TERMINATOR_UUID ]
then
env=`env | egrep "TERMINATOR_UUID|VIRTUAL_ ENV|PWD" `
dbus-send --session --type=method_call --dest=$TERMINATOR_ DBUS_NAME /net/tenshu/ Terminator2 $TERMINATOR_ DBUS_NAME. push_environmen t string:"$env" &>/dev/null
fi
}function save_layout {
if [ TERMINATOR_UUID ]
then
push_environme nt
dbus-send --session --type=method_call --dest=$TERMINATOR_ DBUS_NAME /net/tenshu/ Terminator2 $TERMINATOR_ DBUS_NAME. save_layout &>/dev/null
fi
}push_environment needs to be called from each terminal's child shell in order to inform terminator of the current environment.
The only place where you can access the current shell's environment. TERMINATOR_UUID needs to be sent in order to determine where it came from.I currently have push_environment ran every time my shell's prompt is redrawn but this is optional.
You can run push_environment on each terminal you wish to update Virtual Environment and Working Directory.
Be advised that you still need to call save_layout function, "Save Layout" via the context menu or press "Save" in Layout Preferences window.
Greetings! First of all, thank you all for allowing Terminator to thrive!
These changes have been thoroughly tested and are being used daily for a week or so. I confess, mostly with the 'default' profile. Other than the 'default' profile have also been tested but now so much.
Totally changed mine and a couple of co-worker's lives for the better. Saving/Restoring SSH Sessions without having to dial it in manually every time has become priceless - especially because Preferences- Layouts- Save clears the Working Directory and Custom Command fields - not cool.
With these small changes, we turned our static profiles into dynamic, ever-evolving and self updating profiles. Auto-saving should also be present (there is a guy that wants it because he forgets to save) but I didn't want to break Terminator's architecture further before discussing the best way to do it with Terminator's team. Ideally we should add an option to auto-save and define the interval. Well, save_layout can also be called on every prompt but it makes every prompt significantly slower this we are all currently saving it manually either via the context menu or by running the save_layout function in a shell. push_environment on every prompt is unnoticeable for all of us. My suggested shell push_environment function is not optimal but it does the job.
Yes, every user has to add the functions and the every prompt behaviour manually to it's bashrc/zshrc. Examples:
[ ${ZSH_VERSION} ] && precmd() { push_environment; } COMMAND= push_environmen t
[ ${BASH_VERSION} ] && PROMPT_
We can also create a profile. d/XX-terminator .sh to be included that adds these hooks automatically when TERMINATOR_UUID is present. This behavior could also be controlled via Terminator' Preferences and propagated to child shells by using an extra environment variable such as TERMINATOR_ AUTO_REFRESH that the profile. d/XX-terminator .sh would interpret and act accordingly.
Please let me know what you think about my approach and let us work together to make this possible.
Cheers!