8

When logging in to Xubuntu, I get a selection list of saved sessions, most of them is outdated old stuff.

I hit the delete button in a sportive manner. I tried a click to the left, and just a click to the right - no deletion possible.

I went through system menus and menu sections (and the system section of the menu).

Note: Not related: How to remove session entries from LightDM? or Managing the login screen's sessions list which links to it - they handle session-classes like xubuntu vs. xfce, gnome, kde - not different xfce-sessions.

Note: I want to remove some sessions, not all of them. I don't want to start with the session-list deactivated. I have 5 entries and want to remove 3 of them.

4 Answers 4

6

Go to $HOME/.cache/sessions and open the latest file with the name xfce-session-yourdesktopname in a text editor.

All your sessions are listed in the file by name in this format:

[Session: Default] 

or

[Session:somename]

Select the entire set of lines from [Session:somename] to the next blank line (including the [Session:somename] line and delete them. Save the file.

5

Sagarchalise brought me on the right track, but only half the way.

The place, where to look in Xfce is indeed

$HOME/.cache/sessions

I found a lot of files there, including some empty Thunar- files, xfwm4- files and, interesting for us, xfce4-session-asux:0, where asux is the name of my local machine, the hostname.

:0 reminds of the way, the XServer enumerates different instances, which I used rarely, but I used it, so I have a xfce4-session-asux:1 file as well, and it is rather old, but different sessions aren't stored in different files, but in different sections inside the file.

Such a section looks like this:

[Session: 2010]
key1=value1
key2=value2
...
LastAccess=1315125649

So you can see the name ("2010" in this case) of the session, a bunch of key-value-pairs, and as last these pairs a LastAccess key. It stores the seconds since 1.1.1970 UTC. It's not short and easy to translate it to a human readable date with date or bash arithmetic (or tell me how in the comments). But at least the age in years is worth calculating:

echo $((1315125649/(365*24*60*60)))
41

So it is 41 years after 1.1.1970 (ignoring leap years and daylight saving time, and cutting the result to whole years) which is 2011. The other fields can be computed as well - I prefered to do it with scala by

scala> val d = new java.util.Date (1315125649*1000L)
d: java.util.Date = Sun Sep 04 10:40:49 CEST 2011

So I remove the whole section, and after relogin, this session is vanished from my list of sessions.

update:

I now know the much simpler solution for the date issue, simply put into the shell:

date -d @1315125649
So 4. Sep 10:40:49 CEST 2011

So this can be made into a simple script:

for f in  ~/.cache/sessions/xfce4-session-* 
do
   la=$(sed -n -r 's/LastAccess=(.*)/\1/p' "$f")
   echo -e $(date -d @$la) "\t$f"
done 

Fr 9. Mär 07:17:13 CET 2018     /home/stefan/.cache/sessions/xfce4-session-tux201t:0
Fr 9. Mär 07:16:03 CET 2018     /home/stefan/.cache/sessions/xfce4-session-tux201t:0.bak
2
  • exactly what I need
    – gboffi
    Mar 14, 2018 at 12:16
  • @gboffi: Thanks. Alarmed by your upvote, I suspect, I revisited this answer and extended it a bit. Mar 14, 2018 at 12:41
1

AFAIK most of the display managers handle sessions from .desktop files present in /usr/share/xsessions. I guess renaming it to something else will remove session entries.

E.g.

cd /usr/share/xsessions
mv gnome.desktop gnome.desktop.backup

xfce caches its session in $HOME/.cache/sessions as well as has configurations in $HOME/.config/xfce4-session. You could try viewing those folders as well. I think xubuntu has folders with names xubuntu in place of xfce as it has its own session manager.

2
  • As I expected, only root has write access to /usr/share/xsession and its subfolders. gnome.desktop is of course completly off topic. $HOME/.cache/sessions seems the right thing: older and younger entries, xfce4-session-* and xfwm4-*-files are laying around. After renaming them and relogin (which might take some time) you might get the "accepted" flag, but the /usr/share part should really be removed. The $HOME/.config/xfce4-session directory only contains a 2 and a 4 years old file - this seems to be unrelated too. Mar 9, 2012 at 14:14
  • I used this method to remove the MATE Desktop option from my Xfce installation.
    – user1221273
    Aug 3, 2021 at 12:42
-1

This is how it goes:

  • Click on Settings manager at the app menu or run xfce4-settings-manager from a terminal
  • Click on 'Session and Startup'
  • Uncheck 'Display chooser on login' on the general tab, 'Session Chooser'
  • Also review the 'Logout Settings' on the same tab.
  • *In session tab, Click 'Clear saved session' *
1
  • I don't want to ignore all settings, but delete some of them. Mar 8, 2012 at 20:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .