From: mar77i Date: Sun, 2 Feb 2025 12:25:46 +0000 (+0100) Subject: add create_desktop_file.sh and .gitignore X-Git-Url: https://git.mar77i.info/?a=commitdiff_plain;h=8176001ad0d61a8a9005bf9d2282870f6c19e5dc;p=zenbook_gui add create_desktop_file.sh and .gitignore --- diff --git a/.gitignore b/.gitignore index 2483976..5708aad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +*.desktop .idea/ __pycache__/ +venv/ diff --git a/create_desktop_file.sh b/create_desktop_file.sh new file mode 100755 index 0000000..366fe36 --- /dev/null +++ b/create_desktop_file.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +script_dir="$(realpath -Pe "$(dirname "${0}")")" +executable="${script_dir}/zenbook_conf.py" +icon="${script_dir}/laptop-single.svg" +virtual_env= + +help() { + echo " ${0} [--executable PATH] [--icon PATH] [--virtual-env PATH] | -h|--help" + echo "Create a desktop launcher for zenbook_conf.py" + echo " --executable PATH specify the executable" + echo " --icon PATH specify the icon" + echo " --virtual-env PATH specify a VIRTUAL_ENV path" + echo " -h | --help show this help message" + exit 0 +} + +help=0 + +while (( $# )); do + case "${1}" in + --executable) + executable="${2}" + shift + ;; + --icon) + icon="${2}" + shift + ;; + --virtual-env) + virtual_env="${2}" + shift + ;; + -h|--help) + help=1 + ;; + *) + echo "Error: invalid argument: ${1}" >&2 + exit 1 + ;; + esac + shift +done + +if (( help )); then + help + exit 0 +fi + +echo "[Desktop Entry]" +echo "Type=Application" +if [[ "${virtual_env}" ]]; then + virtual_env="$(realpath -Pe "${virtual_env}")" + env="VIRTUAL_ENV=${virtual_env} PATH=\$VIRTUAL_ENV/bin:\$PATH " +else + env= +fi +echo "Exec=/usr/bin/sh -c '${env}$(realpath -Pe "${executable}")'" +echo "Icon=$(realpath -Pe "${icon}")" +echo "" +echo "Name=Zenbook Duo settings" diff --git a/laptop-single.svg b/laptop-single.svg new file mode 100644 index 0000000..687d56f --- /dev/null +++ b/laptop-single.svg @@ -0,0 +1,7 @@ + + + + + + +