From 2e5f3c981eabd0bc8bc9f91e1e0c9fc619242984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C3=A9cureuil?= Date: Sat, 24 Oct 2015 00:19:48 +0200 Subject: Add first setup copied from KDE4 ( minus clean cache parts ) --- etc/xdg/plasma-workspace/env/plasma5-firstsetup.sh | 116 +++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 etc/xdg/plasma-workspace/env/plasma5-firstsetup.sh (limited to 'etc') diff --git a/etc/xdg/plasma-workspace/env/plasma5-firstsetup.sh b/etc/xdg/plasma-workspace/env/plasma5-firstsetup.sh new file mode 100644 index 0000000..413df55 --- /dev/null +++ b/etc/xdg/plasma-workspace/env/plasma5-firstsetup.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +# +# TODO: Factorize for Mageia 2 +# + +KRCFG="$(which kreadconfig)" + +if [ ! -z "$KRCFG" ]; then # Check if kde is installed, otherwise do nothing + + # "Desktop" Mageia icons" + MGADESK=$(kreadconfig --group "Mageia" --key "MageiaDesktopFiles" --default "false") + + if [ ! "$MGADESK" = "true" ]; then + # TODO: We need to handle default => Default too + PROD=$(sed 's/.*product=\(.*\)/\L\1/' < /etc/product.id) + # We should handle i18n dir modes in xgd user dirs + DIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DESKTOP_DIR)" ) + if [ -z "${DIR}" ]; then + DIR="$HOME/Desktop" + fi + + if [ ! -d "${DIR}" ]; then + mkdir -p "${DIR}" + fi + + if [ -n "$PROD" -a -d "/usr/share/dist/desktop-files/${PROD}" ]; then + cp -f /usr/share/dist/desktop-files/${PROD}/*.desktop "${DIR}" + fi + + # Copy the "Trash" icon on the desktop + cp -f /usr/share/apps/kio_desktop/directory.trash "${DIR}/org.kde.trash.desktop" + + kwriteconfig --group "Mageia" --key "MageiaDesktopFiles" --type "bool" 1 + fi + + # Add .directory to XDG_*_DIR + ICONSXDGDIR=$(kreadconfig --group "Mageia" --key "IconsXdgDir" --default "false") + + if [ ! "$ICONSXDGDIR" = "true" ]; then + + MUSICDIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_MUSIC_DIR)" ) + if [ -z "$MUSICDIR" ]; then + MUSICDIR="$HOME/Music" + fi + + if [ ! -e "$MUSICDIR/.directory" ]; then + cat >> "$MUSICDIR/.directory" << EOF +[Desktop Entry] +Hidden=true +Icon=folder-sound +EOF + fi + + + DLDIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DOWNLOAD_DIR)" ) + if [ -z "$DLDIR" ]; then + DLDIR="$HOME/Downloads" + fi + + if [ ! -e "$DLDIR/.directory" ]; then + cat >> "$DLDIR/.directory" << EOF +[Desktop Entry] +Hidden=true +Icon=folder-downloads +EOF + fi + + + DOCDIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DOCUMENTS_DIR)" ) + if [ -z "$DOCDIR" ]; then + DOCDIR="$HOME/Documents" + fi + + if [ ! -e "$DOCDIR/.directory" ]; then + cat >> "$DOCDIR/.directory" << EOF +[Desktop Entry] +Hidden=true +Icon=folder-documents +EOF + fi + + + PICTUREDIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_PICTURES_DIR)" ) + if [ -z "$PICTUREDIR" ]; then + PICTUREDIR="$HOME/Pictures" + fi + + if [ ! -e "$PICTUREDIR/.directory" ]; then + cat >> "$PICTUREDIR/.directory" << EOF +[Desktop Entry] +Hidden=true +Icon=folder-image +EOF + fi + + + VIDEOSDIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_VIDEOS_DIR)" ) + if [ -z "$VIDEOSDIR" ]; then + VIDEOSDIR="$HOME/Videos" + fi + + if [ ! -e "$VIDEOSDIR/.directory" ]; then + cat >> "$VIDEOSDIR/.directory" << EOF +[Desktop Entry] +Hidden=true +Icon=folder-video +EOF + fi + kwriteconfig --group "Mageia" --key "IconsXdgDir" --type "bool" 1 + fi + +# end of main if: all the changes should be done inside this main if +fi + + -- cgit v1.2.1