]> git.mar77i.info Git - zenbook_gui/commitdiff
add create_desktop_file.sh and .gitignore
authormar77i <mar77i@protonmail.ch>
Sun, 2 Feb 2025 12:25:46 +0000 (13:25 +0100)
committermar77i <mar77i@protonmail.ch>
Sun, 2 Feb 2025 12:25:46 +0000 (13:25 +0100)
.gitignore
create_desktop_file.sh [new file with mode: 0755]
laptop-single.svg [new file with mode: 0644]

index 2483976dced2e2e74a8e85752abb8c15faaec8dc..5708aadfbe4df3ef20c67a26b53d9707ce7f07d1 100644 (file)
@@ -1,2 +1,4 @@
+*.desktop
 .idea/
 __pycache__/
+venv/
diff --git a/create_desktop_file.sh b/create_desktop_file.sh
new file mode 100755 (executable)
index 0000000..366fe36
--- /dev/null
@@ -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 (file)
index 0000000..687d56f
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
+  <defs id="defs3051">
+    <style type="text/css" id="current-color-scheme">.ColorScheme-Text { color: #fcfcfc; } </style>
+  </defs>
+  <path style="fill:currentColor;fill-opacity:1;stroke:none" d="m 2,3 0,1 0,8.1 0,1 4,5 1,0 14.4,0 1,0 -4,-5 0,-1 0,-8.1 0,-1 -1,0 -14.4,0 -1,0 z m 1,1 14.4,0 0,8.1 -14.4,0 0,-8.1 z" id="rect4211" class="ColorScheme-Text"/>
+</svg>