Forum › Forums › General › Tips and Tricks › GUI to mount and unmount android devices
- This topic has 44 replies, 9 voices, and was last updated May 27-12:58 pm by PPC.
-
AuthorPosts
-
May 19, 2020 at 4:30 pm #36122Member
PPC
::ok, folks newer version, with a lot of bells ans whistles and a bug fix, available here:
Fixed link ; https://pastebin.com/Q2b6aZJr
Changes:
1- If no device is detected, users can retry rescaning or exit the script
2- bug that opened 2 tabs with the android device mount point solved
3- To avoid problems (like Roky had) when unmounting, the android_device folder is removed automacaly! WARNING: don’t have a folder with that name in your Home folder, or it goes up in flames… đ
4- All windows now display the “phone” iconTO DO’s:
I don’t know about Sybok, but, I’m quite happy with the script. On my end, only small GUI optimizations are missing.
P.
- This reply was modified 2 years, 11 months ago by anticapitalista.
- This reply was modified 2 years, 11 months ago by PPC.
May 19, 2020 at 4:48 pm #36123MemberPPC
::Ooops: wrong file uploaded. Correct one is available at:
P.
May 20, 2020 at 2:36 am #36145MemberPPC
::And I just finished a nice bilingual .desktop file, to make if easier to launch the script:
[Desktop Entry] Encoding=UTF-8 GenericName=Android device mount and unmount GUI GenericName[pt]= Montar e desmontar dispositivos android Name=Android device manager Name[pt]= Gestor de dispositivos Android Comment= Allows access to the contents of android devices, connected via USB, from the default file manager Comment[pt]= Permite o acesso ao conteudo de dispositivos android, ligados por USB, a partir do gestor de ficheiros Type=Application Exec= {INSERT FULL PATH TO YOUR SCRIPT HERE} Icon=/usr/share/icons/papirus-antix/22x22/devices/smartphone.png Categories=X-Personal;X-antiX; NoDisplay=False Terminal=FalseMay 20, 2020 at 6:25 am #36148Member
sybok
::Hi,
if you would like to avoid over-mounting and deleting existing directory, you can configure it to have a random suffix
uniqueid="_$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 4 | head -1)" dir="$HOME/android_device${uniqueid}"But then, in order to delete it properly (and avoid accumulation of these), all calls of exit would have to be replaced with the following ‘exit’ function:
clean_exit(){ # Exit the script with some clean-up: local result_code result_code="$1" if [ -d "${dir}" ]; then rmdir "${dir}" || exit 1 fi if [ -z "${result_code}" ]; then # Fall-back to defaul value: result_code=0 fi exit "${result_code}" } # clean_exitFor the whole script, see https://pastebin.com/LW0WEVvy.
Apart from that, I find this code OK. (Could fix the indentation to increase readability.)
- This reply was modified 2 years, 11 months ago by sybok.
May 20, 2020 at 9:55 am #36160MemberPPC
::Current PPC version (before the previous changes sybok implemented):
Basically just GUI changes and language errors corrected.
I think I’m almost done with this, it took more time and resources than I thought it would…@Sybok:
I’ve been taking care of some minor text corrections and GUI and yad script optimizations… Now every single yad window has title icons and window icons, set in variables. This way, not only do we get a cleaner script, it’s also easily fixed/changable: if we want to change the windows title, we just have to change a variable, not every single yad command that the script has. I’ve settled by ” Android Device Manager ” ( because, well, not techies will probable not know what “Android Device Mounter/Unmounter” means…). any suggestion for a better name?
Oh, and the version I’ve been working on has the option “fixed” added to every single yad instance, it eliminates the nasty white spaces that, I dunno why yad puts on the end of some windows…
Every single window has the “phone” icon and displays the android phone icon on the left of the text (completly option, but I like it)Note: I’m not really sure about the need to delete the mount point folder when unmounting… I don’t mind having the folder there, and, after unmounting, any user can delete it via file manager/cli… So? Keep or delete this part?
This now really acts and looks like a real professional script. Thanks for all the help, sybok (you would make Spock proud đ )
P.
May 20, 2020 at 12:20 pm #36162Member
rayluo
::Have to chime in to say, thank you PPC and sybok for such a wonderful script! Admittedly, when I first saw the headline of this thread days ago, I did not realize it was necessary, because my distant memory told me that an Android device would (supposedly) be automatically recognized as a USB disk on desktop PC, in a plug-and-play fashion. Turns out that is not the case (or at least not the norm). Yesterday I happened to have a need to plug in my Android tablet(s) to my desktop (now running antiX), and it was not “detected” until I used PPC and sybok’s script. I did encounter some hiccup (at a point, the SpaceFM UI seemed stay on top, so that I could not even switch to other apps), but at least it can get the main job done, i.e. copying files in and out from my Android device.
This script could be included and shipped by future antiX.
This now really acts and looks like a real professional script.
P.PPC and/or Sybok can also consider to host this now-professional script from a more professional place than pastbin. Say, host it as its own open-source project on Github. If you do not currently have a github account and do not intend to create one, I can create one such repo/project for you, under my account, with all the attribution mentioning you.
Regards,
RayMay 21, 2020 at 6:58 am #36177MemberPPC
::@rayluo : thanks for the kind words and the offer! Hosting the scrot on github is something I’ll have to ponder and also talk with sybok…
Current version of the script:
https://pastebin.com/EgLpqLvdChanges:
– better “unmount” dialog (1 button to “unmount”, 1 button to “access device”, better description of both options)
– changed script name to the more descriptive “Android Device USB Connect”P.
May 21, 2020 at 11:55 am #36185MemberPPC
::I rolled with it and just created a github page for this script…
it’s over at:https://github.com/PPC-scripts/android-device-USB-connect/
As always, all productive input is welcome!
P.
May 22, 2020 at 11:00 am #36205MemberPPC
::Howdy, folks!
This, unless, something unexpected happens, should be my last post on this thread for a while:
On the last post, I mentioned the scripts github page. It now hosts the last versions of the script:
– Thanks to Rayluo I realized that using “xdg-open” does not open the default file manager on antiX, but always opens Spacefm (I didn’t notice that before because this is already my default browser), so I made a “antiX only” version of the script, that opens the android’s device’s contents use desktop-defaults-run -fm (that runs the file manager selected in antiX’s Control Centre – Default applications).
– Both the original and “antiX only” version have been upgraded with a new confirmation dialog that, after the unmounting process is finished, tells users if it’s safe (or not) to unplug the device.This script started as a small personal project to allow me to automate access to my newish android phone, but ended up being a fully fledged GUI application that allows simple access to android device’s contents… Even if it’s not included in future version of antiX, it’s available here and in github, for the foreseeable future.
thanks for all input and help!
P.
May 22, 2020 at 12:05 pm #36206Forum Admin
anticapitalista
::Thanks! I forked your repo and made some changes elating to localisation.
Fork here: https://gitlab.com/antiX-Linux/android-device-USB-connect
Once we get dome translations, I’ll add the file to antix-goodies package (with a .desktop file).
Once again, thanks for the script.
Philosophers have interpreted the world in many ways; the point is to change it.
antiX with runit - leaner and meaner.
May 22, 2020 at 1:03 pm #36209MemberPPC
::Very nice, anticapitalista, thanks!
I’ve already finished the Portuguese (Pt) translation!P.
May 23, 2020 at 3:26 am #36219Memberzeh
::Iâve settled by â Android Device Manager â ( because, well, not techies will probable not know what âAndroid Device Mounter/Unmounterâ meansâŚ). any suggestion for a better name?
This looks like the perfect candidate for a “MX android Device Mounter” as well, to go along with the existing “MX iDevice Mounter“. And the opposite, getting idevice mounter into antiX to go along with this one. So, I’d just suggest the naming to be consistent. And if the two tools could be shown together it’d make it even easier for the user.
May 23, 2020 at 8:15 am #36220ModeratorBobC
May 27, 2020 at 12:58 pm #36388MemberPPC
::Hi!
I’ll leave any name changes to anticapitalista, if he so wishes.
I like the “Max” idea, for apps that are common to antiX and Mx Linux!
The current name for the script is “Android USB Device Connect” ( it’s kind of a rip off/ homage to KDE connect, that I never used but it has a cool name).
Probably “Android Device USB mounter and unmounter” would be a mouth full, but this more descriptive name, because, well, people do have to run it to mount and unmount the device (a more descriptve name would avoid users not realizing that they can unmount the device by running the script again)If your default file manager is SpaceFm, it’s probably faster to unmount the device from there, but if you use the default Rox file manager, it’s better to unmount using the script…
P.
-
AuthorPosts
- You must be logged in to reply to this topic.