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

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

echo "[Desktop Entry]" >> "$fullFilePath"
# echo "Encoding=UTF-8" >> "$fullFilePath"
echo "Name=Logout user" >> "$fullFilePath"
echo "Name[sv]=Logga ut användare" >> "$fullFilePath"
echo "Comment=Logout user" >> "$fullFilePath"
echo "Comment[sv]=Logga ut användare" >> "$fullFilePath"
echo "Type=Application" >> "$fullFilePath"
#echo "Terminal=true" >> "$fullFilePath"
echo "Terminal=false" >> "$fullFilePath"
echo "Icon=system-log-out" >> "$fullFilePath"
echo "Exec=sh -c 'gnome-session-quit --logout'" >> "$fullFilePath"
echo "StartupWMClass=system" >> "$fullFilePath"
echo "Categories=System;" >> "$fullFilePath"

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