GUI to mount and unmount android devices

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.
Viewing 14 posts - 31 through 44 (of 44 total)
  • Author
    Posts
  • #36122
    Member
    PPC
      Helpful
      Up
      0
      ::

      ok, folks newer version, with a lot of bells ans whistles and a bug fix, available here:

      https://pastebin.com/akVRHLuz

      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” icon

      TO 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.
      #36123
      Member
      PPC
        Helpful
        Up
        0
        ::

        Ooops: wrong file uploaded. Correct one is available at:

        https://pastebin.com/Q2b6aZJr

        P.

        #36145
        Member
        PPC
          Helpful
          Up
          0
          ::

          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=False
          #36148
          Member
          sybok
            Helpful
            Up
            0
            ::

            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_exit
            

            For 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.
            #36160
            Member
            PPC
              Helpful
              Up
              0
              ::

              Current PPC version (before the previous changes sybok implemented):

              https://pastebin.com/6U0y5Ba9

              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.

              #36162
              Member
              rayluo
                Helpful
                Up
                0
                ::

                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,
                Ray

                #36177
                Member
                PPC
                  Helpful
                  Up
                  0
                  ::

                  @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/EgLpqLvd

                  Changes:
                  – 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.

                  #36185
                  Member
                  PPC
                    Helpful
                    Up
                    0
                    ::

                    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.

                    #36205
                    Member
                    PPC
                      Helpful
                      Up
                      0
                      ::

                      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.

                      #36206
                      Forum Admin
                      anticapitalista
                        Helpful
                        Up
                        0
                        ::

                        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.

                        #36209
                        Member
                        PPC
                          Helpful
                          Up
                          0
                          ::

                          Very nice, anticapitalista, thanks!
                          I’ve already finished the Portuguese (Pt) translation!

                          P.

                          #36219
                          Member
                          zeh
                            Helpful
                            Up
                            0
                            ::

                            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.

                            #36220
                            Moderator
                            BobC
                              Helpful
                              Up
                              0
                              ::

                              Hmmmmmm,

                              MaX has a nice ring to it for tools that are standard for both MX and antiX …

                              #36388
                              Member
                              PPC
                                Helpful
                                Up
                                0
                                ::

                                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.

                              Viewing 14 posts - 31 through 44 (of 44 total)
                              • You must be logged in to reply to this topic.