Some way to store extra stuff about terminals
- Dominant language
- Python
- Stars
- 4.7k
- Forks
- 604
- PR merge metrics
- No merged PRs in 30d
Description
We use this script:
```bash
# Copyright (C) 2021 Soni L.
# SPDX-License-Identifier: AGPL-3.0-or-later
# note: consider adding the following to your PS1:
# {$([[ "${HISTFILE#~/.bash_history.}" != "$HISTFILE" ]] && printf "@ " || printf "/ ")${HISTFILE#~/.bash_history.}}
if [[ "$HISTFILE" = ~/.bash_history ]]; then
HISTFILE="$HISTFILE".default
fi
# simple interface to history/"session" management
# usage: session
# switches HISTFILE to ~/.bash_history.
session() {
if [[ "$1" =~ ^[a-z][a-z0-9]*$ ]]; then
# remove session switch from history
history -d -1
# write/append history
shopt -q histappend && history -a || history -w
# clear history
history -c
# set HISTFILE
HISTFILE=~/.bash_history."$1"
# load new session's history
history -r
else
echo "invalid session"
false
fi
}
# saves the current working directory into the current history.
# does NOT save to the history *file*.
savecwd() {
history -s "$(printf 'cd %q' "$PWD")"
}
```
and it'd be great if we could integrate it with guake. The main thing would be some way of storing `HISTFILE` in guake's session file, or some way to attach userdata to guake terminals. Guake already has `GUAKE_TAB_UUID` (which should be deprecated and renamed `GUAKE_TERMINAL_UUID`, given tab splitting features), so it makes sense to be able to have a datastore attached to the terminal.
Note that, at least for bash, the `HISTFILE` isn't inherited/exported by default, so this should NOT be done through some sort of environment-based mechanism.
- - -
feathub is kinda... bad. but here's the link back to it: https://feathub.com/Guake/guake/+94
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.