File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments