Skip to content

Commit efc866b

Browse files
mf-fxMarcus Funch
authored andcommitted
Desktop shortcut to directory: Add support for removing shortcut
1 parent 5797ab7 commit efc866b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

os2borgerpc/desktop/desktop_shortcut_to_directory.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,23 @@
33
# Places a shortcut on the Desktop to any directory on the file system
44
#
55
# Parameters:
6-
# 1: The path to the directory you want a shortcut to
7-
# 2: The name of the shortcut on the Desktop
6+
# 1: Whether to add or remove the shortcut
7+
# 2: The path to the directory you want a shortcut to
8+
# 3: The name of the shortcut on the Desktop
89

910
set -ex
1011

11-
DIRECTORY="$1"
12-
SHORTCUT_NAME="$2"
12+
ADD="$1"
13+
DIRECTORY="$2"
14+
SHORTCUT_NAME="$3"
1315

1416
SHADOW_DESKTOP="/home/.skjult/Skrivebord"
1517

1618
mkdir --parents $SHADOW_DESKTOP
1719

18-
# Note: "ln" doesn't care if the destination ($DIRECTORY) exists
19-
ln --symbolic --force "$DIRECTORY" "$SHADOW_DESKTOP/$SHORTCUT_NAME"
20+
if [ "$ADD" = "True" ]; then
21+
# Note: "ln" doesn't care if the destination ($DIRECTORY) exists
22+
ln --symbolic --force "$DIRECTORY" "$SHADOW_DESKTOP/$SHORTCUT_NAME"
23+
else
24+
rm "$SHADOW_DESKTOP/$SHORTCUT_NAME"
25+
fi

0 commit comments

Comments
 (0)