2018-11-22 05:41:39 +00:00
|
|
|
#!/bin/sh
|
2019-01-25 23:38:36 +00:00
|
|
|
# Copyright (c) 2018-2019 TildeLinux Maintainers
|
|
|
|
#
|
|
|
|
# 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 2 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, write to the Free Software Foundation, Inc.,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# Email: tildelinux@tildeverse.org
|
|
|
|
|
2019-01-27 01:43:49 +00:00
|
|
|
mounts_file="$HOME/.ssh/mounts"
|
2018-11-22 05:41:39 +00:00
|
|
|
|
2019-01-20 05:05:30 +00:00
|
|
|
get_locations() {
|
2019-01-27 01:43:49 +00:00
|
|
|
if ! grep -q "SSHFS Mount " "$mounts_file"
|
2019-01-20 05:05:30 +00:00
|
|
|
then
|
|
|
|
printf "<item label=\"Configure Locations...\">\\n"
|
|
|
|
printf " <action name=\"Execute\">\\n"
|
|
|
|
printf " <command>%s/.local/bin/sshfs_gui.sh</command>\\n" "$HOME"
|
|
|
|
printf " </action>\\n"
|
|
|
|
printf "</item>\\n"
|
|
|
|
else
|
|
|
|
while read -r line
|
|
|
|
do
|
|
|
|
location_path=""
|
|
|
|
if printf "%s" "$line" | grep -q "SSHFS Mount "
|
|
|
|
then
|
2019-01-27 01:53:33 +00:00
|
|
|
location_path=$(printf "%s" "$line" | rev | cut -f 2 -d ' ' | rev)
|
|
|
|
location_name=$(printf "%s" "$line" | rev | cut -f 1-2 -d ' ' | rev)
|
2019-01-20 05:05:30 +00:00
|
|
|
printf "<item label=\"%s\">\\n" "$location_name"
|
|
|
|
printf " <action name=\"Execute\">\\n"
|
|
|
|
printf " <command>thunar %s</command>\\n" "$location_path"
|
|
|
|
printf " </action>\\n"
|
|
|
|
printf "</item>\\n"
|
|
|
|
fi
|
2019-01-27 01:43:49 +00:00
|
|
|
done < "$mounts_file"
|
|
|
|
printf "<separator/>\\n"
|
|
|
|
printf "<item label=\"Configure More Locations...\">\\n"
|
|
|
|
printf " <action name=\"Execute\">\\n"
|
|
|
|
printf " <command>%s/.local/bin/sshfs_gui.sh</command>\\n" "$HOME"
|
|
|
|
printf " </action>\\n"
|
|
|
|
printf "</item>\\n"
|
2019-01-20 05:05:30 +00:00
|
|
|
fi
|
2018-11-22 05:41:39 +00:00
|
|
|
}
|
|
|
|
|
2019-01-20 05:05:30 +00:00
|
|
|
printf "<openbox_pipe_menu>\\n"
|
|
|
|
printf "<item label=\"File Manager\">\\n"
|
|
|
|
printf " <action name=\"Execute\">\\n"
|
|
|
|
printf " <command>thunar</command>\\n"
|
|
|
|
printf " </action>\\n"
|
|
|
|
printf "</item>\\n"
|
|
|
|
printf "<separator label=\"Locations\" />\\n"
|
|
|
|
get_locations
|
|
|
|
printf "</openbox_pipe_menu>\\n"
|