Openbox integration
This commit is contained in:
parent
729e224dc2
commit
8674fe80e5
|
@ -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>"
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
setup_script_path="$HOME/.local/bin/setup_gui.sh"
|
||||||
|
|
||||||
eval "$(xdotool getmouselocation --shell)"
|
eval "$(xdotool getmouselocation --shell)"
|
||||||
mouse_x=$X
|
mouse_x=$X
|
||||||
mouse_y=$Y
|
mouse_y=$Y
|
||||||
|
@ -84,10 +86,22 @@ get_info() {
|
||||||
--field="Server Shortname":CB \
|
--field="Server Shortname":CB \
|
||||||
--field="Local Directory" \
|
--field="Local Directory" \
|
||||||
--field="Remote Directory" \
|
--field="Remote Directory" \
|
||||||
|
--button="Configure Servers...":2 \
|
||||||
--button="Cancel":1 \
|
--button="Cancel":1 \
|
||||||
--button="Continue":0 \
|
--button="Continue":0 \
|
||||||
"$ssh_config_file" "$server_name" "$sshfs_local_path" "$sshfs_remote_path")
|
"$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")
|
server_name=$(get_field 2 "$info")
|
||||||
sshfs_local_path=$(get_field 3 "$info")
|
sshfs_local_path=$(get_field 3 "$info")
|
||||||
|
|
Loading…
Reference in New Issue