Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Galaxy Nexus MTP Mount
#Action on Galaxy Nexus Connect
SUBSYSTEMS=="usb", ATTRS{serial}=="014E058C0E010016", KERNEL=="1-1", SYMLINK+="galaxy-nexus", RUN+="/home/david/.bin/root-to-david"
su david /home/david/.bin/galaxy-nexus
# Set up a user environment
su david
export DISPLAY=:0
export HOME=/home/david/
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
# Run if user hits control-c
echo -en "\n*** Exiting ***\n"
killall yad
exit $?
# Make a FIFO pipe to send commands to yad.
PIPE=$(mktemp -u --tmpdir ${0##*/}.XXXXXXXX)
mkfifo $PIPE
exec 3<> $PIPE
function on_exit () {
echo "quit" >&3
rm -f $PIPE
trap on_exit EXIT
# trap keyboard interrupt (control-c)
trap control_c SIGINT
kdialog --passivepopup "Your Galaxy Nexus is ready to be mounted!" 5 --title "<b>Google Galaxy Nexus</b>" --icon "google-play"
yad --text="Galaxy Nexus" --notification="Google Galaxy Nexus" --kill-parent --listen --command="brocket -c 'konsole' 'My Tasks - Google Tasks'" --image="google-play" <&3 &
echo "menu: Quit!quit!application-exit|Unmount!fusermount -u /home/david/Android/!emblem-unmounted|Open Folder!dolphin '/home/david/Android/Internal storage'!system-file-manager|Mount!jmtpfs /home/david/Android/!emblem-mounted" >&3
while [ -a /dev/galaxy-nexus ] ; do
sleep 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment