Dear all,
for the ones who use the KDE apps like me, I've written a small script which can be used to automatically fix the Dolphin contextual menu after the system has been updated, which is used to choose the application for opening a particular file, among all the available ones, and to define file associations for any extension within the system.
Code: Select all
#!/bin/bash
file="libkf5service-data_5.103.0-1_all.deb";
Australia="http://ftp.au.debian.org/debian/pool/main/k/kservice/";
Address=$Australia;
#EU_Germany="http://ftp.de.debian.org/debian/pool/main/k/kservice/";
#Address=$EU_Germany;
#North_America="http://ftp.us.debian.org/debian/pool/main/k/kservice/";
#Address=$North_America;
#Sud_America="http://download.unesp.br/linux/debian/pool/main/k/kservice/";
#Address=$Sud_America;
#China="http://ftp.cn.debian.org/debian/pool/main/k/kservice/";
#Address=$China;
#Africa="http://debian.mirror.ac.za/debian/pool/main/k/kservice/";
#Address=$Africa;
# Download the package libkf5service-data_5.103.0-1_all.deb and save it onto /files/archive
cd /files/archive/
U=$Address;
FILE=$file;
[[ -z "$U" ]] && echo -e "Usage: $0 repo-url [file to download]\nwithout give \"file to download\" this script will list the files inside the repo\n";
for i in $(curl -l "$U" 2>/dev/null|grep -i 'href='|sed -e 's/.*href=//g' -e 's/>.*//g' -e 's/"//g'|grep -v '/$'|grep "$FILE")
do
if [[ -z "$FILE" ]]
then
echo "FILE: $i"
else
echo "Download file: $i"
curl -q "${U}/${i}" --output "$i" 2>/dev/null
ls -la "$i"
fi
done
sleep 3;
# Extract file kf5-applications.menu from package and save it onto /etc/xdg/menus
dpkg-deb --fsys-tarfile libkf5service-data_5.103.0-1_all.deb | tar -xOf - ./etc/xdg/menus/kf5-applications.menu > /etc/xdg/menus/kf5-applications.menu
sleep 1;
# Close Dolphin instances if present
kill `pidof dolphin`;
sleep 1;
# Rebuild Dolphin applications-contextual-menu
kbuildsycoca5 --noincremental;
The curl package is needed (also available on the Scarthgap repository). This script can also be used on Scarthgap, in case you have installed Dolphin on Scarthgap as a foreign app. What this script does is extremely simple:
- Downloads the package libkf5service-data_5.103.0-1_all.deb from the Debian repository and saves it onto the /files/archive folder
- Extracts the file kf5-applications.menu from it onto the folder /etc/xdg/menus
- Closes all active Dolphin instances if present
- Executes the needed command to rebuild the Dolphin menu
The default url for the package is the australian one. If you want to select another location, just comment the 2 lines for Australia and uncomment the 2 lines for the desired source location. Just name this script as you wish (give it obviously the .sh file extension) and don't forget to give it execution permissions.