Skip to content

Commit 5e6561d

Browse files
authored
installation script
1 parent fa1f3ff commit 5e6561d

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

install.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -t 0 ]; then
4+
# If running in a terminal, continue with the script
5+
# get USER name
6+
USER=$(who am i | awk '{print $1}')
7+
8+
# Set the target file you want to update
9+
TARGET_FILE="EnvyControlQt.desktop"
10+
11+
# Get the current working directory
12+
CURRENT_DIR=$(pwd)
13+
14+
# Find the actual path of the envycontrol_qt.py file
15+
ENVYCONTROL_QT_PATH=$(find "$CURRENT_DIR" -type f -name "envycontrol_qt.py" 2>/dev/null | head -n 1)
16+
17+
# Find the actual path of the envycontrol.png file
18+
ENVYCONTROL_ICON_PATH=$(find "$CURRENT_DIR" -type f -name "envycontrol.png" 2>/dev/null | head -n 1)
19+
20+
# Update the Exec and Icon lines in the target file with the actual paths
21+
sed -i "s|^Exec=.*|Exec=python3 \"${ENVYCONTROL_QT_PATH}\"|" "$TARGET_FILE"
22+
sed -i "s|^Icon=.*|Icon=${ENVYCONTROL_ICON_PATH}|" "$TARGET_FILE"
23+
24+
echo "Updated the paths in the $TARGET_FILE"
25+
26+
# Copy the updated desktop file to /usr/share/applications/
27+
cp "$TARGET_FILE" /home/$USER/.local/share/applications/
28+
29+
echo "Copied the $TARGET_FILE to /home/$USER/.local/share/applications/"
30+
31+
read -p "Press enter to exit script: "
32+
else # Have fun if you have multiple terminals
33+
# I'm tired of trying to make it properly terminal agnostic.
34+
# Without reimplementig bash script in python
35+
konsole -e "$0"
36+
gnome-terminal -e "$0"
37+
xfce4-terminal -e "$0"
38+
xterm -e "$0"
39+
terminator -e "$0"
40+
st -e "$0"
41+
urxvt -e "$0"
42+
tilix -e "$0"
43+
mate-terminal -e "$0"
44+
kitty -e "$0"
45+
alacritty -e "$0"
46+
fi

0 commit comments

Comments
 (0)