#!/bin/bash # # TODO: Factorize for Mageia 2 # KRCFG="$(which kreadconfig5)" if [ ! -z "$KRCFG" ]; then # Check if kde is installed, otherwise do nothing # "Desktop" Mageia icons" MGADESK=$(kreadconfig5 --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 $(kreadconfig5 --file $HOME/.config/user-dirs.dirs --key XDG_DESKTOP_DIR --group "" )" ) 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/kio_desktop/directory.trash "${DIR}/org.kde.trash.desktop" kwriteconfig5 --group "Mageia" --key "MageiaDesktopFiles" --type "bool" 1 fi # Add .directory to XDG_*_DIR ICONSXDGDIR=$(kreadconfig5 --group "Mageia" --key "IconsXdgDir" --default "false") if [ ! "$ICONSXDGDIR" = "true" ]; then MUSICDIR=$(eval "echo $(kreadconfig5 --file $HOME/.config/user-dirs.dirs --key XDG_MUSIC_DIR --group "" )" ) 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 $(kreadconfig5 --file $HOME/.config/user-dirs.dirs --key XDG_DOWNLOAD_DIR --group "" )" ) 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 $(kreadconfig5 --file $HOME/.config/user-dirs.dirs --key XDG_DOCUMENTS_DIR --group "" )" ) 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 $(kreadconfig5 --file $HOME/.config/user-dirs.dirs --key XDG_PICTURES_DIR --group "" )" ) 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 $(kreadconfig5 --file $HOME/.config/user-dirs.dirs --key XDG_VIDEOS_DIR --group "" )" ) 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 kwriteconfig5 --group "Mageia" --key "IconsXdgDir" --type "bool" 1 fi # "Desktop" Mageia icons" MGA5to6=$(kreadconfig5 --group "Mageia" --key "Mageia5to6" --default "false") if [ ! "$MGA5to6" = "true" ]; then DIRDESKTOP=$(eval "echo $(kreadconfig5 --file $HOME/.config/user-dirs.dirs --key XDG_DESKTOP_DIR --group "" )" ) HOME="$DIRDESKTOP/Home2.desktop" TRASH="$DIRDESKTOP/trash.desktop" if [ -e "$HOME" ]; then rm -f "$HOME" fi if [ -e "$TRASH" ]; then rm -f "$TRASH" fi kwriteconfig5 --group "Mageia" --key "Mageia5to6" --type "bool" 1 fi # end of main if: all the changes should be done inside this main if fi