File create-shutdown-menu-shortcut of Package kimi-utils-ubuntu

#!/bin/bash
# How to create a specified Encoding
# "echo "$var" | iconv --from-code=utf-8 --to-code=utf-16le --output=file2.txt

fileDir="$(xdg-user-dir HOME)/.local/share/applications"

menuFileName="shutdown.desktop"
fullFilePath="$fileDir/$menuFileName"

if test -f "$fullFilePath" ; then
  rm -f "$fullFilePath"
fi

echo "[Desktop Entry]" >> "$fullFilePath"
# echo "Encoding=UTF-8" >> "$fullFilePath"
echo "Name=Shutdown" >> "$fullFilePath"
echo "Name[sv]=Stäng av" >> "$fullFilePath"
echo "Comment=Shutdown computer" >> "$fullFilePath"
echo "Comment[sv]=Stäng av datorn" >> "$fullFilePath"
echo "Type=Application" >> "$fullFilePath"
#echo "Terminal=true" >> "$fullFilePath"
echo "Terminal=false" >> "$fullFilePath"
echo "Icon=system-shutdown" >> "$fullFilePath"
echo "Exec=sh -c 'gnome-session-quit --power-off --force'" >> "$fullFilePath"
echo "StartupWMClass=system" >> "$fullFilePath"
echo "Categories=System;" >> "$fullFilePath"

if test -f "$fullFilePath" ; then
  echo "[OK] Shutdown menu item was created in:"
  echo "    $fullFilePath"
else
  echo "[ERROR] Shutdown menu item was not created."
fi
openSUSE Build Service is sponsored by