how to clear KDE History

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
germaineman
Level 1
Level 1
Posts: 14
Joined: Sat Feb 02, 2013 7:45 am
Location: Netherlands

how to clear KDE History

Post by germaineman »

I run a clean installation of Linux Mint 18.1 with KDE desktop
KDE Plasma version 5.8.5 KDE Frameworks version 5.28.0

When I open the KDE Application Launcher one of the menu items is "History"
When I mouse-over this item a list of recently opened files is shown
I would like to clear this list (preferably when I logout from a session)

I tried the following suggestions I could find on various forums:
Clear RecentDocuments and make read-only
chmod -w ~/.kde/share/apps/RecentDocuments/

Clear and stop entries being added to recently_used.xbel
rm -f ~/.local/share/recently-used.xbel
touch ~/.local/share/recently-used.xbel
chmod -w ~/.local/share/recently-used.xbel


Starting my computer again and using it the files RecentDocuments and recently_used_xbel stay empty.
The KDE Menu itemlist "History" however keeps growing
Does anyone know where this "History" list is kept and how I can manage it
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Older and wiser voices can help you find the right path, if you are only willing to listen. Jimmy Buffett
lmuserx4849

Re: how to clear KDE History

Post by lmuserx4849 »

In 5, there is suppose to be a sweeper utility. Update: It seems sweeper doesn't work anymore.

In KDE 5 Settings -> Desktop Behavior -> Activities -> Privacy, there is an option to never remember files for all or for specific applications.

In KDE 4, if I'm on the Recently Used tab and hover over a file and right-click, there is an option to Clear recently used Documents or Applications.
In KDE 5, if I right-click and select Application Menu Settings, there is a option to show recent apps/docs.... and you can right-click a document to forget it or all.

As for where they are, I'm not sure it is a text file any longer. :-( I did a grep for the files that are showing up in Recent Documents and .local/share/kactivitymanagerd/resources/database kept coming up. The "file" command says it is a SQLite database. I'm looking at it now with sqlitebrowser.
Last edited by lmuserx4849 on Fri Apr 14, 2017 3:29 am, edited 2 times in total.
DeMus

Re: how to clear KDE History

Post by DeMus »

I don't use the KDE Application Launcher but instead use the Application menu, this does not show History, just recent Applications and Documents.
It has furthermore the benefit of automatically open the sub-menus, where in the Launcher you need to click first.
To change, unlock your widgets, right-click the launcher button and choose alternatives, then choose Application Menu. Lock the widgets again, if you like that.
lmuserx4849

Re: how to clear KDE History

Post by lmuserx4849 »

I backup/removed the database file (don't recommend doing unless you can fix what gets broken :-)), logged off/on and the Recently Used files in the menu were gone. So this seems to confirm these particular files are located $HOME/.local/share/kactivitymanagerd/resources/database.

I opened a file in Kate and it was in the database. Removed it from the menu (as described above) and it was gone from the database.

If you want to confirm yourself. #1 command below will display all rows in the ResourceScoreCache table. #2 will display a specific row (change the X). #3 is a script and will display 5 rows of every table in the database. It uses hexdump to get some header info. It's not necessary. If you don't have that installed and don't want to install just comment the 3 printf's. I used the ResourceScoreCache table because that is where they first appeared. But later they appeared in ResourceInfo and ResourceEvent. I don't know the purpose or relationship of these tables....

Code: Select all

# 1) Select all from table
sqlite3 -header $HOME/.local/share/kactivitymanagerd/resources/database "select * from ResourceScoreCache;"

# 2) Select row where name is like X (replace X with name found in Recently Used
sqlite3 -header $HOME/.local/share/kactivitymanagerd/resources/database "select * from ResourceScoreCache where targettedResource like '%X';"

Code: Select all

#!/bin/bash
# 3)
set -u

declare -r path="${1:-$HOME/.local/share/kactivitymanagerd/resources}"
declare -- db=''
declare -a tbls=()
declare -i idx=0
declare numRows=5;

# Look for sqlite files and display a few rows from each.
for db in $(find "${path}" -type f -name "database"); do

  # Process each sqlite file.
  if [[ $(file -b "${db}") == SQLite* ]]; then

    # Database title line (requires hexdump). dbVersion=$(xxd -s96 -l4 -ps  "$db")
    printf -v l1 '\nDatabase %s (%d)' "${db}" $(hexdump  -s96 -n4 -ve '"0x" 4/1 "%02x" "\n"' "${db}")
    printf -v l2 '%*s' "${#l1}"
    printf -- '%s\n%s\n' "${l1}" "${l2// /-}"

    # Create an array containing all tables in the sqlite database.
    tbls=($(sqlite3 "${db}" .tables))

    # Table title line.
    printf -- '\nThere are %d tables in database %s\n' "${#tbls[@]}" "${db}"

      # Get sample rows with column headers from each table in the array.
      idx=0
      while (( $idx < ${#tbls[@]} )); do
        printf -- '\nTable %3d: %s:\n' "$((idx+1))" "${tbls[idx]}"
        sqlite3 -header "${db}"  "select * from ${tbls[idx++]} limit $numRows;";
      done

  fi
done

germaineman
Level 1
Level 1
Posts: 14
Joined: Sat Feb 02, 2013 7:45 am
Location: Netherlands

Re: how to clear KDE History

Post by germaineman »

Thanks Imuserx4849 and DeMus for your truly helpful suggestions.
Using System Settings>Workspace>Desktop Behavior>Activities>Privacy>Clear recent history>Forget everything I could indeed clear the history as I asked for in my original post
Also in this tab 'Privacy' one has the option of choosing various settings for Remember opened documents
Knowing which database kde uses to store recently opened items might be very useful if one wants even more grip on what is happening inside the system
Which is why I started using Linux in the first place
Older and wiser voices can help you find the right path, if you are only willing to listen. Jimmy Buffett
Locked

Return to “Software & Applications”