Skip to content

Instantly share code, notes, and snippets.

@underr
Created May 16, 2014 23:57
Show Gist options
  • Save underr/c376645f79a9ea9e6055 to your computer and use it in GitHub Desktop.
Save underr/c376645f79a9ea9e6055 to your computer and use it in GitHub Desktop.
recent files
#!/bin/sh
DATA_PATH="`kde4-config --path data`"
DATA_PATH="${DATA_PATH%%:*}"
STREAM="<submenu>"
for file in "${DATA_PATH}RecentDocuments/"*; do
eval "`sed -r '/^(Icon|Name|URL|X-KDE-LastOpenedWith).*/!d; s/URL\[.[^\]]*/URL/g; s/X-KDE-LastOpenedWith/La
LastOpenedWith="${LastOpenedWith:-kfmclient open}"
STREAM="${STREAM}<action label=\"${Name}\" icon=\"${Icon}\" exec=\"${LastOpenedWith} '${URL}'\" />\n"
# echo $Icon $Name $URL
done
STREAM="${STREAM}</submenu>"
echo $STREAM > "${DATA_PATH}be.shell/MainMenu/RecentFiles.xml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment