File fix-macbook-swedish-keyboard-layout-issue of Package kimi-utils-ubuntu

#!/bin/bash

# Set swedish keyboard
# Fix for Macbook defaulting to american keyboard after user login
# Issue observed in Ubuntu 22.04
# Replacing manual reconfiguration of swedish keyboard layout

# 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)/.config/autostart"

menuFileName="swedish-keyboard.desktop"
fullFilePath="$fileDir/$menuFileName"

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

echo "[Desktop Entry]" >> "$fullFilePath"
# echo "Encoding=UTF-8" >> "$fullFilePath"
echo "Name=Swedish keyboard" >> "$fullFilePath"
echo "Name[sv]=Svenskt tangentbord" >> "$fullFilePath"
echo "Comment=Set Swedish keyboard" >> "$fullFilePath"
echo "Comment[sv]=Använd svenskt tangentbord" >> "$fullFilePath"
echo "Type=Application" >> "$fullFilePath"
#echo "Terminal=true" >> "$fullFilePath"
echo "Icon=system-run" >> "$fullFilePath"
echo "Exec=/usr/local/bin/set-swedish-keyboard" >> "$fullFilePath"
echo "StartupWMClass=system" >> "$fullFilePath"
echo "Categories=System;" >> "$fullFilePath"
echo "X-GNOME-Autostart-enabled=true" >> "$fullFilePath"

if test -f "$fullFilePath" ; then
  echo "[OK] Default Swedish keyboard fix was applied."
else
  echo "[ERROR] Default Swedish keyboard fix was not created."
fi
openSUSE Build Service is sponsored by