Separate thread for Preferred Applications (desktop-defaults-set) enhancement

Forum Forums antiX-development Development Separate thread for Preferred Applications (desktop-defaults-set) enhancement

  • This topic has 35 replies, 5 voices, and was last updated Sep 1-6:02 pm by marcelocripe.
Viewing 15 posts - 1 through 15 (of 36 total)
  • Author
    Posts
  • #87509
    Moderator
    BobC

      This started out as a request in the antiX 22 thread, but should be in a separate thread so it doesn’t divert attention from anticapitalista’s more important issues in that thread. So I’m going to try splitting its posts out to this thread.

      #87179
      Moderator
      BobC
        Helpful
        Up
        0
        ::

        Is Dave watching this thread?

        If Preferred Applications would show all FileManager category .desktops (including in subdirectories like antix) and only FileManager .desktops to make selecting a default file manager easier, that would help a lot. Rox-filer needs to have FileManager added to its Categories line.

        PS: I looked at the code for this and I think that when you pop up the selection of applications, it would need to build a recursive list of matching FileManager entries to select from rather than a wide open select of what is in the directory

        Another possibility would be to add a separate “Change Preferred Applications” menu option. I was thinking on the Desktop menu. The downside is it adds to the menus.

        #87259
        Moderator
        BobC
          Helpful
          Up
          0
          ::

          I made and tested the changes to Preferred Applications (desktop-defaults-set program) that I was suggesting, and made the changes for all of the Preferred Application Groups, not just file managers. I made no changes to any text, so no translation effort would be required. The program defaults to the current setting, and shows local ,desktop apps as well as system ones, sorted alphabetically, excluding the current default.

          # Categories = Values in .desktop files needed to select
          # Terminal – TerminalEmulator
          # Web Browser – WebBrowser
          # File Manager – FileManager
          # Email Client – Email
          # Text Editor – TextEditor
          # Image Viewer – GraphicsViewer
          # Video Player – VideoPlayer
          # Audio Player – AudioPlayer

          No other changes are needed to make it work, except adding the FileManager category to the rox-filer .desktop file. I’ll see if Dave is willing to look at the code.

          PS: Just adding a zip of the code here in case anyone would like to try it. If you have any updated desktop files they will get included on the selections if you put them in ~/.local/share/applications or a subdirectory of it. Thanks to Dave for creating the original. This is just an enhancement of his creation.

          • This reply was modified 8 months, 3 weeks ago by BobC.
          • This reply was modified 8 months, 3 weeks ago by BobC.
          • This reply was modified 8 months, 3 weeks ago by BobC.
          #87277
          Member
          PPC
            Helpful
            Up
            0
            ::

            in case anyone would like to try it

            Many thanks, Bob.
            Great idea! I tested the script and I have a suggestion that do not imply changing Rox’s .desktop file:

            – simply check if rox’s desktop file exists and, if so, add it to the correct list.

            Other suggestions:
            – On the “Terminal” field- remove gksu from the list of displayed .desktop files

            On the video and audio players: the use of the .desktop’s file description sometimes produces far from perfect results, I have loads of media player installed and some audio players come up on the video player’s list and vice versa (no problem there, most video players do play audio files just fine).

            Great idea!

            EDIT: some .desktop files that should be cleaned up from the audio/video player’s list:
            alsamixer, alsamixer-equalizer, audio-player, Sound_card, speaker-test, video-player

            P.

            • This reply was modified 8 months, 3 weeks ago by PPC.
            #87285
            Moderator
            BobC
              Helpful
              Up
              0
              ::

              I did it by Categories. Maybe that’s not the right way.

              #87316
              Member
              marcelocripe
                Helpful
                Up
                0
                ::

                I made and tested the changes to Preferred Applications (desktop-defaults-set program) that I was suggesting, and made the changes for all of the Preferred Application Groups, not just file managers. I made no changes to any text, so no translation effort would be required. The program defaults to the current setting, and shows local ,desktop apps as well as system ones, sorted alphabetically, excluding the current default.

                The numbers of the lines referring to the translations of the “desktop-defaults-set” are different, in the old one the translatable texts are between lines 31 to 39 and in your current one the translatable texts are between lines 106 to 114. Therefore, a new .pot, .po and .mo files need to be created. I tested with these files that are attached and the pt-BR translation worked. The .pot file has programmer comments for translators with English language texts from machine translation, I hope all texts are correct.

                Thanks

                – – – – –

                I made and tested the changes to Preferred Applications (desktop-defaults-set program) that I was suggesting, and made the changes for all of the Preferred Application Groups, not just file managers. I made no changes to any text, so no translation effort would be required. The program defaults to the current setting, and shows local ,desktop apps as well as system ones, sorted alphabetically, excluding the current default.

                Os números das linhas realtivas as traduções do “desktop-defaults-set” são diferentes, no antigo os textos traduzíveis estão entre as linhas 31 a 39 e no seu atual os textos traduzíveis estão entre as linhas 106 a 114. Por isso, um novo arquivo .pot, .po e .mo precisam ser criados. Eu testei com estes arquivos que estão em anexo e funcionou a tradução pt-BR. O arquivo .pot possui comentários do programador para os tradutores com textos em idioma Inglês da tradução automática, eu espero que todos os textos estejam corretos.

                #87319
                Moderator
                BobC
                  Helpful
                  Up
                  0
                  ::

                  I’m sorry, Marcelo. I have very little experience with translations. You are correct. I did change many line numbers, but did not change any of the text prompts a user would see.

                  #87333
                  Member
                  PPC
                    Helpful
                    Up
                    0
                    ::

                    @BobC – Translation is a pain also to me… as is using sed to process files.
                    I took a look at your script and found out the best place to use a sed command to remove the unwanted .desktop files from being listed… Here’s my example, to remove “gksu” from the Terminal options list:
                    alter you grep line to include the need sed command (I hope the forum software does not mangle this…:

                    grep -i "TerminalEmulator" "$HOME/.local/share/desktop-defaults-set/categories.lst" | awk -F ':' '{print $1}' |sed '/gksu.desktop/d' > "$HOME/.local/share/desktop-defaults-set/TerminalEmulator.lst"

                    The same can be adapted without much work, to all categories, removing all unwanted entries from the menus…

                    If you want, I can also send your way an example of how to add rox to the file manager’s list… (tip: echo rox’s .desktop file into the file manager list)

                    Your idea is so good I wonder no one ever thought about it before- it’s perfect to stop newbies from messing the essential apps, while still allowing everyone to have a simple and efficient GUI to selected those apps!

                    Edit: I tried changing my audio player using the script, and it does not perform the changes… I’ve not yet read all the script, to check out what’s missing…

                    Edit2: I realize now that your script, as it is, does not allow to change the audio player, also, changing the video player also sets the audio player to the same .desktop file (as the chosen video player)

                    P.

                    • This reply was modified 8 months, 3 weeks ago by PPC.
                    • This reply was modified 8 months, 3 weeks ago by PPC.
                    • This reply was modified 8 months, 3 weeks ago by PPC.
                    #87338
                    Moderator
                    BobC
                      Helpful
                      Up
                      0
                      ::

                      I will look at the issues tonight. I plan to work from Marcelo’s fixed version. “desktop-defaults-follow-fm.desktop” is also missing the FileManager Categories designation.

                      #87341
                      Member
                      marcelocripe
                        Helpful
                        Up
                        0
                        ::

                        Please look at the image “desktop-defaults-set-20220815 (2).png”, the “desktop-defaults-set” which has the pt-BR language translation on the right, has the “desktop-defaults-follow-fm.desktop”.

                        Por favor, olhe na imagem “desktop-defaults-set-20220815 (2).png”, o “desktop-defaults-set” que possui a tradução do idioma pt-BR que está a direita, possui o “desktop-defaults-follow-fm.desktop”.

                        #87521
                        Moderator
                        BobC
                          Helpful
                          Up
                          0
                          ::

                          I think I fixed nicely all of the problems. Thanks for the help, PPC and Marcelo 🙂

                          Marcelo, I’m sorry, but could you regenerate that translation data? Here is an updated version of the code.

                          I have also included revised versions of the .desktop files that will need to be changed in antiX to include the right Categories entry. As a temporary fix, if you copy the included .desktop files to ~/.local/share/applications they will appear in the selection pulldowns.

                          Let me know if anyone finds any problems, please…

                          In the second pic you see all of the .desktop entries that have both Audio and Player in their Categories= line. I didn’t find a good way to trim the list down further, but am open for suggestions.

                          #87525
                          Member
                          iznit
                            Helpful
                            Up
                            0
                            ::

                            “way to trim the list down further”

                            Can apply sed command to remove the line containing each known undesirable filepath.
                            Example for the “Audio Player” [[[ I only recognize 4 undesirable items, more may exist ]]]
                            before the echo line , just after line 122 of desktop-defults-set

                            sed -i '@/usr/share/applications/antix/alsamixer.desktop@d' \
                                 $HOME/.local/share/desktop-defaults-set/AudioPlayer.lst
                            sed -i '@/usr/share/applications/antix/alsamixer-equalizer.desktop@d' \
                                 $HOME/.local/share/desktop-defaults-set/AudioPlayer.lst
                            sed -i '@/usr/share/applications/antix/Sound_Card.desktop@d' \
                                 $HOME/.local/share/desktop-defaults-set/AudioPlayer.lst
                            sed -i '@/usr/share/applications/antix/speaker-test.desktop@d' \
                                 $HOME/.local/share/desktop-defaults-set/AudioPlayer.lst

                            A single sed command can handle multiple patterns but would be an awkwardly long line in the script.
                            Here I chose to place @ characters as delimters; avoids needing to escape all the slash characters in the filepath strings.

                            #87527
                            Moderator
                            BobC
                              Helpful
                              Up
                              0
                              ::

                              Yes, they could be hard coded, but it would be better to come up with a cleaner method, ie by looking for a value in Categories (maybe UTILITY or SETUP or SETTINGS) that could be used to exclude them. I would consider looking for a mime type, but the command line apps never seem to include those, and I don’t want to preclude people from choosing them because they are usually very lightweight.

                              Did you notice Midnight Commander (mc) comes up as one of the default file manager options? On older machines it might be nice to be able to easily set very lightweight defaults.

                              #87528
                              Moderator
                              BobC
                                Helpful
                                Up
                                0
                                ::

                                Marcelo, When you rebuild and replace the translation file, does that fix the translation problem shown in the pic you posted?

                                #87551
                                Moderator
                                BobC
                                  Helpful
                                  Up
                                  0
                                  ::

                                  I added a feature to exclude from listing any application with a “NotDefault” Categories entry, and made the field label translation more normal for the translators.

                                Viewing 15 posts - 1 through 15 (of 36 total)
                                • You must be logged in to reply to this topic.