Hello Jarno,
> Boris, your patch sound good. I did not try it yet, because I am not used to
> building Xfce software from source.
> Another approach is that terminal has its own session management independent
> of xfce session like
> many web browsers do, so it would remember tabs, current directories and
> history for each tab.
> Possibly user could save several sessions and open them. Maybe that would not
> work well together
> with xfce session, though.
Thanks for the reply. To be honest I've tried to rely as much as
possible on existing code.
> Why not tie history per terminal tab? I guess shells HISTFILE variable could
> be used for that.
Thanks for the idea. I tried it further and at first glance it seems to work
pretty well - now I have shell history per terminal/tab along with the
scrollback history and all of this is restored across reboots. And this by
simply adding a small snippet to .bashrc:
PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
if [ ! -z "$TAB_ID" ]; then
HISTFILE_DIR=$HOME/shell_history
HISTFILE_ARCHIVE_DIR=$HISTFILE_DIR/archive
mkdir -m 700 -p $HISTFILE_DIR
mkdir -m 700 -p $HISTFILE_ARCHIVE_DIR
HISTFILE_DEST=$HISTFILE_DIR/$TAB_ID
HISTFILE_ARCHIVE_DEST=$HISTFILE_ARCHIVE_DIR/$TAB_ID
function pop_shell_history {
if [ -f "$HISTFILE_ARCHIVE_DEST" ]; then
# revive from archive
mv $HISTFILE_ARCHIVE_DEST $HISTFILE_DEST
elif [ ! -f $HISTFILE_DEST ]; then
# combine history from all existing tabs
# or we'll start with an empty list but
# it's slightly better to have history from
# recent tabs
for hist in $(find $HISTFILE_DIR -maxdepth 1 -type f)
do
cat $hist >> $HISTFILE_DEST
done
fi
HISTFILE=$HISTFILE_DEST
}
# peek at archive
pop_shell_history
function push_shell_history {
history -a; mv $HISTFILE_DEST $HISTFILE_ARCHIVE_DIR
}
# on exit save shell history in the archive
trap push_shell_history EXIT
fi
A rough edge is that archive are not deleted if a terminal is closed.
This may be easily adapted to other shells.
Apart from the edges it's nice to fully restore your workspace across reboots!
No engineer throws workspace at the end of the day just to start from scratch
tomorrow.
Regards
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1550898
Title:
xfce4-terminal remembers only history of one tab when restoring saved
session
To manage notifications about this bug go to:
https://bugs.launchpad.net/xfce4-terminal/+bug/1550898/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs