From: mar77i Date: Mon, 22 Sep 2025 18:03:25 +0000 (+0200) Subject: fix create_desktop_file.sh. add create_desktop_files.sh X-Git-Url: https://git.mar77i.info/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=zenbook_gui fix create_desktop_file.sh. add create_desktop_files.sh --- diff --git a/create_desktop_file.sh b/create_desktop_file.sh index c749c43..b64340e 100755 --- a/create_desktop_file.sh +++ b/create_desktop_file.sh @@ -1,17 +1,16 @@ #!/usr/bin/env bash -script_dir="$(realpath -Pe "$(dirname "${0}")")" -executable="${script_dir}/zenbook_conf.py" -icon="${script_dir}/laptop-single.svg" -name="Zenbook Duo Settings" +executable="" +icon="" +name="" help() { - echo " ${0} [--executable PATH] [--icon PATH] [--virtual-env PATH] | -h|--help" + echo " ${0} --executable PATH --icon PATH --name NAME | -h|--help" echo "Create a desktop launcher for zenbook_conf.py" echo " --executable PATH specify the executable" echo " --icon PATH specify the icon" echo " --name NAME specify the name" - echo " -h | --help show this help message" + echo " -h|--help show this help message" exit 0 } @@ -46,10 +45,21 @@ if (( help )); then help exit 0 fi +if [[ -z "${executable}" ]]; then + echo "Error: missing executable." >&2 + exit 1 +fi +if [[ -z "${icon}" ]]; then + echo "Error: missing icon." >&2 + exit 1 +fi +if [[ -z "${name}" ]]; then + echo "Error: missing name." >&2 + exit 1 +fi echo "[Desktop Entry]" echo "Type=Application" -echo "Exec=$(realpath -Pe "${executable}")" -echo "Icon=${icon}" -echo "" +echo "Exec=${executable}" +echo "Icon=${icon}"$'\n' echo "Name=${name}" diff --git a/create_desktop_files.sh b/create_desktop_files.sh new file mode 100755 index 0000000..4ebe9da --- /dev/null +++ b/create_desktop_files.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +script_dir="$(realpath -Pe "$(dirname "${0}")")" + +"${script_dir}/create_desktop_file.sh" \ + --executable "${script_dir}/zenbook_conf.py" \ + --name "Zenbook Settings" \ + --icon "$(realpath -Pe "${script_dir}/laptop-single.svg")" >Zenbook\ Settings_.desktop +"${script_dir}/create_desktop_file.sh" \ + --executable "${script_dir}/keyboard.py" \ + --name "Zenbook Keyboard" \ + --icon "input-keyboard" >Zenbook\ Keyboard_.desktop