This forum has been archived. All content is frozen. Please use KDE Discuss instead.

complete session restoration

-4

Votes
3
7
Tags: konsole konsole konsole
(comma "," separated)
ecloud
Registered Member
Posts
4
Karma
0
I like that KDE restores Konsole sessions with the right window dimensions and cwd when I log back in. But I would like bash history to be session-specific, and also would like to store all the text in the scrollback buffer in the session, too. As it is, the fact that Konsole does not do this is one of the main reasons not to ever log out.

bash has HISTFILE to specify which file saves the history. So assuming each konsole session has some kind of unique ID, each instance of bash which happens to be running in a Konsole could have a unique history file based on the Konsole session ID.

Unfortunately it would decouple the Konsole bash history from that of ssh sessions, though. (If I ssh into the same box I don't get any historical commands that have been run from Konsole sessions, because bash by default uses ~/.bash_history.) That could probably be solved with screen, though. (Just make screen unset the HISTFILE variable. Then if you run screen from konsole, you could hijack the screen session remotely from ssh, and in either case it would be using ~/.bash_history rather than the Konsole version of bash_history.)

To enable the session to be even more persistent, e.g. to make a menu item which always loads the same history, same scrollback buffer, dimensions and cwd, it should be possible to specify the konsole session ID as a parameter. Then even if you have not saved that instance into your session, you could have menu items to launch konsoles for particular intermittent purposes.
User avatar
Madman
Registered Member
Posts
593
Karma
1
OS
Hmm... I'm not sure this would be possible: bash history is stored in a single file, ~/.bash_history, and this causes problems because then Konsole would have to read your command history separately to Bash, and I'm not even sure how it would. Not to mention, if you press the up arrow, this is already mapped to Bash to read the history from ~/.bash_history...

Last edited by Madman on Thu Apr 09, 2009 2:28 pm, edited 1 time in total.


Madman, proud to be a member of KDE forums since 2008-Oct.
ecloud
Registered Member
Posts
4
Karma
0
Madman wrote:Hmm... I'm not sure this would be possible: bash history is stored in a single file, ~/.bash_history, and this causes problems because then Konsole would have to read your command history separately to Bash,


As I wrote in the original post if you just set the HISTFILE environment variable, bash will store its history in that file instead. So probably all Konsole has to do is set the variable to a unique history file for each window.
User avatar
Alec
Registered Member
Posts
565
Karma
1
OS
ecloud wrote:As I wrote in the original post if you just set the HISTFILE environment variable, bash will store its history in that file instead. So probably all Konsole has to do is set the variable to a unique history file for each window.


First of all, if you do it with a lot of different history files, you're basically losing your history because it's all over the place - if you want to run some command you ran before and you're using the wrong history file, you're out of luck.

Secondly, not everyone uses bash - there are many other popular shells such as tcsh or zsh.


Get problems solved faster - get reply notifications through Jabber!
ecloud
Registered Member
Posts
4
Karma
0
Alec wrote:First of all, if you do it with a lot of different history files, you're basically losing your history because it's all over the place - if you want to run some command you ran before and you're using the wrong history file, you're out of luck.


Yeah it would have to be optional I guess, a Konsole setting whether to do that or not, which can be turned off by default. My way of working is I have long-term Konsoles which continue to exist for months, for specific projects on specific desktops. So I'd like to have this feature for those Konsoles. For more ephemeral windows it doesn't make sense.

Alec wrote:Secondly, not everyone uses bash - there are many other popular shells such as tcsh or zsh.


That could be detected.
rvfh
Registered Member
Posts
2
Karma
0

Re: complete session restoration

Fri Aug 14, 2015 8:50 am
Your proposal is exactly what I'm after as well. Could be an option which defaults to disabled. Seems dead easy to implement too...


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]