Openbox integration

This commit is contained in:
fosslinux 2018-11-21 21:41:39 -08:00 committed by Samuel Tyler
parent 729e224dc2
commit 8674fe80e5
4 changed files with 53 additions and 1 deletions

38
openbox_files.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh
ssh_config_file="$HOME/.ssh/config"
get_locations(){
if ! grep -q "SSHFS Mount " "$ssh_config_file"
then
echo "<item label=\"Configure Locations...\">"
echo " <action name=\"Execute\">"
echo " <command>$HOME/.local/bin/sshfs_gui.sh</command>"
echo " </action>"
echo "</item>"
else
while read -r line
do
location_path=""
if echo "$line" | grep -q "SSHFS Mount "
then
location_path=$(echo "$line" | rev | cut -f 1 -d ' ' | rev)
location_name=$(basename "$location_path")
echo "<item label=\"$location_name\">"
echo " <action name=\"Execute\">"
echo " <command>thunar $location_path</command>"
echo " </action>"
echo "</item>"
fi
done < "$ssh_config_file"
fi
}
echo "<openbox_pipe_menu>"
echo "<item label=\"File Manager\">"
echo " <action name=\"Execute\">"
echo " <command>thunar</command>"
echo " </action>"
echo "</item>"
echo "<separator label=\"Locations\" />"
get_locations
echo "</openbox_pipe_menu>"

0
setup.sh Normal file → Executable file
View File

0
setup_gui.sh Normal file → Executable file
View File

16
sshfs_gui.sh Normal file → Executable file
View File

@ -1,5 +1,7 @@
#!/bin/sh
setup_script_path="$HOME/.local/bin/setup_gui.sh"
eval "$(xdotool getmouselocation --shell)"
mouse_x=$X
mouse_y=$Y
@ -84,10 +86,22 @@ get_info() {
--field="Server Shortname":CB \
--field="Local Directory" \
--field="Remote Directory" \
--button="Configure Servers...":2 \
--button="Cancel":1 \
--button="Continue":0 \
"$ssh_config_file" "$server_name" "$sshfs_local_path" "$sshfs_remote_path")
[ $? -ne 0 ] && exit # Shellcheck will yell at me for this, perhaps find a better way?
info_return="$?"
if [ $info_return -eq 1 ]
then
exit
elif [ $info_return -eq 2 ]
then
if ! "$setup_script_path"
then
error_box "Could not run $setup_script_path"
get_info
fi
fi
server_name=$(get_field 2 "$info")
sshfs_local_path=$(get_field 3 "$info")