From 2ade8fc386f523d3736ab7044d1116cc56004a66 Mon Sep 17 00:00:00 2001 From: Taryel Hlontsi Date: Sun, 26 Jan 2025 19:20:45 +0100 Subject: [PATCH] Add proj launcher script --- proj-launcher.sh | 110 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 proj-launcher.sh diff --git a/proj-launcher.sh b/proj-launcher.sh new file mode 100755 index 0000000..03707f1 --- /dev/null +++ b/proj-launcher.sh @@ -0,0 +1,110 @@ +#!/usr/bin/env bash + +############################################################# +# Author: Taryel Hlontsi, 2025 +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +############################################################# + +doc=$(cat <<'EOF' +NOTES: +This will create a desktop entry and a simlink to the executable +in user's home directory. +It will allow to add the launcher to the bar +EOF + ) + +############################################################# +# SETUP SECTION +############################################################# +set -e +set -o pipefail + +############################################################# +# HELPER FUNCTIONS +############################################################# +info() { + GREEN='\033[1;32m' + NC='\033[0m' + echo -e "${GREEN}${1}${NC}" +} + +trace() { + YELLOW='\033[1;33m' + NC='\033[0m' + echo -e "${YELLOW}${1}${NC}" +} + +warn() { + PURPLE='\033[1;35m' + NC='\033[0m' + echo -e "${PURPLE}${1}${NC}" +} + +error() { + RED='\033[1;31m' + NC='\033[0m' + echo -e "${RED}${1}${NC}" +} + + +############################################################# +# RUN SECTION +############################################################# +echo $(date +'%Y-%m-%d %H:%M') +info "$doc" + +user=$(whoami) +if [ $user == root ]; then + error "You should NOT be using a root account" + exit 1 +fi + +read -p "The app name [default: My App]: " name +name=${name:-My App} + +read -p "Executable name [default: emacs]: " exe +exe=${exe:-emacs} + +read -p "New executable name [default: emacs-my-app]: " new_exe +new_exe=${new_exe:-emacs-my-app} + +read -p "Icon file path or name [default: help-browser]: " icon +icon=${icon:-help-browser} + +read -p "Project path to open: " proj + +info 'Adding desktop entry' +cat <