File create-reboot-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="reboot.desktop"
fullFilePath="$fileDir/$menuFileName"

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

echo "[Desktop Entry]" >> "$fullFilePath"
# echo "Encoding=UTF-8" >> "$fullFilePath"
echo "Name=Reboot" >> "$fullFilePath"
echo "Name[sv]=Starta om" >> "$fullFilePath"
echo "Comment=Restart computer" >> "$fullFilePath"
echo "Comment[sv]=Starta om datorn" >> "$fullFilePath"
echo "Type=Application" >> "$fullFilePath"
#echo "Terminal=true" >> "$fullFilePath"
echo "Terminal=false" >> "$fullFilePath"
echo "Icon=system-reboot" >> "$fullFilePath"
echo "Exec=sh -c 'gnome-session-quit --reboot --force'" >> "$fullFilePath"
echo "StartupWMClass=system" >> "$fullFilePath"
echo "Categories=System;" >> "$fullFilePath"

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