-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopn-lnk-dir.sh
38 lines (38 loc) · 1.51 KB
/
opn-lnk-dir.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/bash
#------------------------------------------------------------------------------#
# Programmed By Liz #
#------------------------------------------------------------------------------#
# caja open link directory in new window
#
# something windows always had, now caja can do it
# caja will follow the link but it becomes part of the current directory
# this will open the link directory, the actual link source
#
# usage:
# File -> Scripts -> opn-lnk-dir.sh
# -or-
# right(left) click -> Scripts -> opn-lnk-dir.sh
#
# first caja script
#---------------------------------------------------------------- initialization
hdg="opn-lnk-dir"
cat="$HOME/.icons/EMOJI Fav/Cat.png"
notify-send -i "$cat" "caja" "open link directory"
#------------------------------------------------------------------ main program
while read src
do
if [[ "$src" != "" ]] # ignore empty lines
then
pth=$(realpath "$src") # dereference
if [[ "$pth" != "$src" ]] # same ?
then # link found
mim=$(mimetype --output-format "%d" "$pth") # check for filename
if [[ "$mim" != "folder" ]]
then
pth=${pth%/*} # remove filename
fi
caja "$pth" &
fi
fi
done <<< $CAJA_SCRIPT_SELECTED_FILE_PATHS
#-------------------------------------------------------------------------------