+++ /dev/null
-[Desktop Entry]
-Type=Application
-Exec=/home/martti/src/python/zenbook_conf/zenbook_conf.py
-X-Environment=VIRTUAL_ENV=/home/martti/src/python/zenbook_conf/venv
-Icon=/home/martti/src/python/zenbook_conf/laptop-single.svg
-
-Name=Zenbook Duo settings
--- /dev/null
+#!/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"
+echo "Exec=$(realpath -Pe "${executable}")"
+if [[ "${virtual_env}" ]]; then
+ echo "X-Environment=$(realpath -Pe "${virtual_env}")"
+fi
+echo "Icon=$(realpath -Pe "${icon}")"
+echo ""
+echo "Name=Zenbook Duo settings"
if item["name"] != "single":
self.bluetooth_conf.update(True)
self.bt_switch.update(True)
- self.xinput_conf.update_touch(self.touch_switch.setting)
- self.xinput_conf.update_stylus(self.stylus_switch.setting)
+ settings_per_device_type = {
+ "touchpad": self.touch_switch.setting,
+ "stylus": self.stylus_switch.setting,
+ }
+ for device_type, setting in settings_per_device_type.items():
+ if setting is not None:
+ self.xinput_conf.update_by_type(device_type, setting)
self.dirty = True
else:
self.bt_switch.handle_mousebuttondown(ev)