meld integration into zzzFM possible?

Forum Forums General Software meld integration into zzzFM possible?

  • This topic has 14 replies, 6 voices, and was last updated Feb 10-6:33 pm by Robin.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #131616
    Member
    Robin

      Is it possible to integrate “meld” into zzzFM in a way you can select two or three files, and then from right click control menu you can select an entry “compare with meld”, opening these two or three files in meld the same way as if you’d feed them manually on command line to it:

      meld '/endless/long/path/to/file_01' '/even/longer/path/to/file_02' ['/longest/ever/path/to/file_03']

      This would save me really much time when comparing different versions of files (texts, but also config files and last but not least: script files while testing them). It is pretty error prone to copy and paste the paths from file manager into console again and again, easily you grab the wrong entry while switching back and forth between the console window and the file manager constantly.

      I merely know from Skidoo that zzzFM is highly flexible and scriptable, but have never looked into this. If this could be done by adding a specific entry in it’s settings or hooking an external script to it, this would speed up preparations of the antiX 23.1 scripts I’m working on currently remarkably.

      Windows is like a submarine. Open a window and serious problems will start.

      #131626
      Member
      anti-apXos

        I’m not familiar with meld, but what you described should be possible

        Try this:
        1. Right-click anywhere in zzzFM’s file list window to open the context menu
        2. Right-click again on any one of the entries in this context menu (such as Rename) to get a second-level context menu
        3. Select New > Command from this second context menu
        4. Enter the name you want for your command, such as “Compare with _Meld”, and click Okay
        5. In the Menu Item Properties window that comes up with the Command tab selected by default enter the command as “meld %F” (without the quotes)
        6. (Optional) Switch to the Context tab of the Properties window where you can edit and add a rule so that the menu command only shows if “Multiple Selected” equals “true”
        7. (Optional) Switch to the Menu Item tab of the Properties window and click the button next to Key to set a keyboard shortcut to run the command without having to use the context menu

        #131641
        Member
        Robin

          Hey, that’s great! Many many thanks @anti-apXos! Would never have guessed it is that easily to be achieved. Works immediately like a charm. Single issue left is: It is even shown when more than three files are selected, so an error message window comes up, showing proper meld command line syntax, if you happen to select four or more files. But this is not a real problem.

          Btw, I never even knew there is a second level context menu in zzzFM. Many thanks for making me aware of this. Will have to check the translation of some strings within this menus at transifex, these menus partly come up in Portuguese instead of German for me. If I recollect correctly, zzzFM itself was written in English language, so I should see all still untranslated strings in English rather than in Portuguese. Never mind, will be fixed sooner or later. Todo-list grows longer and longer… 🙂

          @anticapitalista: In my opinion this tool should be really included into antiX 23.1 ISO and set up this way @anti-apXos has described above in file managers. Most people even don’t know how easily two or three huge but mostly identical files with tiny differences between them can be compared, each change evaluated and approved or skipped in a second, since highlighted and referenced optically. Now having meld at hand directly from within zzzFM is king-size extra convenience class. Everything in it is self explaining, providing really well thought workflows and features, no quirks even for unexperienced users. For me a must-have meanwhile. Have forgotten whether it was @BobC or @Xunzi_23 who has introduced me some years ago to this tool I wasn’t aware of before, but this was a really great tip which has saved me a lot of time meanwhile, many thanks again.

          Windows is like a submarine. Open a window and serious problems will start.

          #131659
          Member
          Xunzi_23

            Good tip Robin, many thanks anti-apXos
            all credit to BobC on meld pls. I agree inclusion in zzzFM as standard would be good.
            Seems I will use it more often in future rather than my preferred rox :-).

            Trying to setup I also ended up with the window to enter a command full of portuguese.
            Guess PPC is secretly teaching us his language 🙂

            • This reply was modified 4 months, 3 weeks ago by Xunzi_23.
            • This reply was modified 4 months, 3 weeks ago by Xunzi_23.
            #131687
            Forum Admin
            anticapitalista

              @Robin – I have no idea how to add it to the zzzFM config file on a pre-built deb

              BTW – latest changes in antixcc.sh breaks it –

              https://gitlab.com/antiX-Linux/control-centre-antix/-/issues/2

              • This reply was modified 4 months, 3 weeks ago by anticapitalista.

              Philosophers have interpreted the world in many ways; the point is to change it.

              antiX with runit - leaner and meaner.

              #131697
              Member
              Robin

                I have no idea how to add it to the zzzFM config file on a pre-built deb

                For me the file

                ~/.config/zzzFM/session

                contains the following addition after adding the context menu entry via GUI:

                cstm_00facb61-y=
                cstm_00facb61-label=Compare with Meld
                cstm_00facb61-next=cstm_2b015761
                cstm_00facb61-cxt=0%%%%%0%%%%%8%%%%%0%%%%%true
                cstm_00facb61-prev=cstm_25a291d5
                cstm_00facb61-line=meld %F &
                cstm_00facb61-task_err=1
                cstm_00facb61-task_out=1
                cstm_00facb61-keep=1
                cstm_00facb61-op=1

                Maybe this can be preset this way in the very file in /etc/skel ?
                This seems the single position where it is stored, I have searched for the string within all files in zzzFM config folder.
                You could counter check this way: save your session file to a backup, add the menu entry via context menu, and compare the new session file with your backup copy.

                latest changes in antixcc.sh breaks it –

                Seems you’ve broken the code while replacing some icon paths. At least the original version I had sent the merge request for works flawlessly for me here. Just removing the duplicate fragment you’ve inserted should probably fix it already.

                Please see my testing results for this issue over at https://gitlab.com/antiX-Linux/control-centre-antix/-/issues/2

                Windows is like a submarine. Open a window and serious problems will start.

                #131700
                Member
                anti-apXos

                  I’m glad the added menu item works for you, @Robin, though actually I just noticed it’s not exactly what you asked for.

                  In your original example, the files to open in meld were in different paths, but the suggestion I made will only work as long as the files are all in the same path since they have to be selected at the same time. I just did a couple tests and it doesn’t seem like zzzFM can recognize multiple selected files in different folders (e.g. in different tabs or panels).

                  So hopefully you don’t actually need that ability. The only way I can think to do it would be complicated and pretty clunky, using a tmp file to store the filenames.

                  Actually, now that I think about it, what I suggested is not really different from just using the existing context menu Open option and choosing meld from the list of alternative programs. The only real advantage is being able to set a keyboard shortcut for it.

                  #131702
                  Forum Admin
                  anticapitalista

                    @Robin – yes you are right about antixcc.sh
                    All’s well that ends well.

                    For zzzFM and meld, it would also need localising.

                    BTW – I prefer diffuse

                    Philosophers have interpreted the world in many ways; the point is to change it.

                    antiX with runit - leaner and meaner.

                    #131769
                    Member
                    Robin

                      So hopefully you don’t actually need that ability.

                      »A sparrow in the hand is better than a pigeon on the roof«, like we’d say, or like the British say: A bird in the hand is worth two in the bush.
                      My workaround is for now: copying the two files into the very same folder, created especially for comparison (needs file renaming in case they have the same name)

                      @anti-apXos: Actually I’d need it, just like you could do file compare in old days’ norton commander. Highlight one file in the left half, the other in the right one, and then let it compare. And that was possible on console level already. Seems the more the tools get modernised, the less they come with the really needed features. Simplification everywhere.

                      The only way I can think to do it would be complicated and pretty clunky, using a tmp file to store the filenames.

                      So you have an idea how to make it work across two or three panes within a zzzFM window, comparing the files highlighted in them? That would be great, if this could become real.

                      @anticapitalista:
                      Is there a logic behind your placement of icons in the system folders?

                      Line 617 $ICONS2/papirus/suspend.png
                      Line 635 $ICONS2/papirus/suspend_grey.png   →   moved to $ICONS

                      There was a reason why I had placed suspend_grey in the $ICONS2/papirus folder:
                      suspend_grey.png is the very same symbol in the very same style as the already residing suspend.png, I have just changed the colour to have a toggle pair from it.
                      Now you have moved one of them to a completely different system folder. Is this wise? I can forsee, some day in one of the folders the icon set will be updated, and then the toggle pair won’t match any longer. Having them next to each other, the person updating the set will notice immediately this is a pair and has to be updated or replaced together. That was why I had placed this icon in the very same folder where the other one already lives.

                      My conclusion: If moving the grey variant from /usr/share/pixmaps/… to /usr/share/icons/… the coloured twin should follow him so they are united again.

                      On diffuse: great tool, have checked out and evaluated it right now. Many thanks for making me aware of it.
                      + I like it has syntax highlighting. (probably not needed for everyday usage by people not scripting or programming)
                      + Great it can open more than three files, so it wouldn’t come up with an error message in zzzFM in case user has selected more than three files.
                      + And it has activated line numbers by default, which have to be activated in settings in meld first.
                      + It comes with a tool I don’t know to make something of, “search order of version control system bazaar cvs darcs git mercurial monotone rcs subversion svk”. This may be really usefull for programmers, but for an everyday usage general text file comparison tool this is overkill.

                      – On the other hand I don’t like in diffuse the bright white background hurting the eyes, and the weak yellow letters on this bright white background, hard to read. But didn’t see a way to change the colour scheme like in geany. Have I missed the place where to change it? [edit: actually missed it, you can manually edit the fifty .syntax files in /etc/diffuse/syntax to change colours by changing numeric values, not sure what they represent (RGB wouldn’t have decimal points and range from 0 to 255, so maybe this is RGB-% ? man diffuse doesn’t explain. And where to change the background colour?).]
                      – And then I’m missing the virtual line break, which can be activated in meld settings. This way in diffuse a highlighted fragment of a line can be easily overlooked, you have to scroll horizontally all the time on long lines. (I guess this is what happened with the fragment in acc?)
                      And then, can diffuse do a folder comparison? Meld can, which is pretty handy for “normal” users:

                      Select two folders containing two versions of a set of files and chose anti-apXos’ “compare with meld” entry. It will highlight all the files not being identical in both folders, down to subfolder content.
                      This is a feature known from norton/midnight commander, missing in zzzFM. So for everyday default user’s needs meld blends into and completes zzzFM pretty good, better than diffuse does.

                      So under the line I’d vote still for “meld” to be integrated rather than “diffuse”, but as always (and without saying this explicitely again and again on other occasiones) : last word is yours.

                      Windows is like a submarine. Open a window and serious problems will start.

                      #131776
                      Member
                      wildstar84

                        I’m not familiar w/zzzFM, but I included this capability in my own file-mgr (JFM5) to select 2 directories from the 2 panes and invoke meld from the general “Action menu”, since I do this all the time in code development. In this example “meld_T2B” (compare Top selection (1st arg) to Bottom one (2nd arg). Works the same for diffuse (I use tkdiff) for 2 files from the 2 panes.

                        Attachments:
                        #131797
                        Member
                        anti-apXos

                          So you have an idea how to make it work across two or three panes within a zzzFM window, comparing the files highlighted in them? That would be great, if this could become real.

                          I like a challenge, so here’s my attempt and not actually as clunky as I thought it might be. Allows creating a “multiselection” across visible panels and opening all the selected files.

                          Create a new menu entry according to the instructions I gave above or maybe in this case using the “Tools” menu instead of a right-click context menu if that seems like a more natural place. Then, instead of “meld %F” enter the following in the Command box:

                          
                          save=$(zzzfm -s get focused_panel)
                          multiselection=()
                          for panel in 1 2 3 4; do
                            if [ $(zzzfm -s get $(echo panel"$panel"_visible)) -eq 1 ]; then
                              zzzfm -s set focused_panel $panel
                              eval selected="$(zzzfm -s get selected_files)"
                              for file in "${selected[@]}"; do
                                multiselection+=( "'$(zzzfm -s get current_dir)/$file'" )
                              done
                            fi
                          done
                          zzzfm -s set focused_panel $save
                          eval meld "${multiselection[@]}"
                          

                          You can also set the context to show (or enable) only when “Panel Count” is greater than “1”.

                          This still has the problem you mentioned if more than three files are selected in total, though that could be addressed in the script if you wanted. Maybe by adding something like this:

                          
                          if [ ${#multiselection[@]} -gt 3 ]; then
                            zzzfm -g --label "Cannot compare more than three files using Meld!" --button Oops!
                          else
                            eval meld "${multiselection[@]}"
                          fi
                          
                          #132171
                          Member
                          Robin

                            Many thanks @wildstar84, your file manager looks not bad. This seems to be a fine tool. But I’ll stick to zzzFM for now, being default in antiX.

                            For zzzFM and meld, it would also need localising.

                            @anticapitalista Meld is (hopefully) fully localised. And I have found a way to localise the zzzFM integration of this command as well. When placing the command within a script rather than using the command method for adding it, the full command will go into a script file within ~/config/zzzFM/scripts/<random> file, which is actually a simple bash script, easily to be set up for translation. It’s mostly the very same method anti-apXos has also found, for making the panes work.

                            I like a challenge…

                            Seems we are cut from same kind of wood (or like the British say: of the same kidney) 🙂

                            I really like your solution. Looks great! And since it’s an external script it is translatable.

                            You can also set the context to show (or enable) only when “Panel Count” is greater than “1”.

                            Why this? It’s perfectly fine allowing a comparison of two or three files within a single folder also. If only a single panel present, it won’t try to switch to another one.

                            Maybe by adding something like this:

                            Yes, something like that will address it, since zzzFM itself seems only to differentiate between multiple and single, not greater than ./. less than.

                            I did a bit polishing to your work, avoiding eval and clearing the arrays, so on next loop the files from former loop run are not repeated.

                            #!/bin/bash
                            save=$(zzzfm -s get focused_panel)
                            multiselection=()
                            for panel in 1 2 3 4; do
                              if [ $(zzzfm -s get $(echo panel"$panel"_visible)) -eq 1 ]; then
                                zzzfm -s set focused_panel $panel
                                selected=()
                                declare selected="$(zzzfm -s get selected_files)"
                                for file in "${selected[@]}"; do
                                  if [ ! -z "$file" ]; then
                                     multiselection+=( "$(zzzfm -s get current_dir)/$file" )
                                  fi
                                done
                              fi
                            done
                            zzzfm -s set focused_panel $save
                            if [ ${#multiselection[@]} -gt 3 ]; then
                              zzzfm -g --label $"Cannot compare more than three files using Meld!" --button Oops!
                            elif [ ${#multiselection[@]} -lt 2 ]; then
                              zzzfm -g --label $"Nothing to do. Comparing a single file is not possible!" --button Oops!
                            else
                              meld "${multiselection[@]}"
                            fi

                            … some days later, was busy with other stuff… And meanwhile I’ve made a ready to use script, for inclusion into antiX zzzFM. See attached zip archive. Since I had started parallel to anti-apXos, using the internal interface of zzzFM rather than the console line options, these scripts can’t be run from command line directly, they need to be started by zzzFM itself by it’s context menu handler. But on contrary to anti-apXos’ version this avoids switching between the panels, since within the internal zzzDM scripting interface the information about panel visibility is easily avialable.
                            In one of the two I have applied already the “new” gettext style, but in the other I failed to make the new style work, so it uses the old gettext style, causing to throw errors and warnings about security when extracting the strings to translation template files. Never mind, will be updated later. Most of our scripts work with the old style still.
                            @anti-apXos: If you happen to know how to apply the new gettext style also to the second script, with the variables and placeholders within the translatable strings within awk printf expressions, let me know please. That’s another nut to crack. This is my first exploration of awk, btw. Boy, that is a powerful tool… never had guessed this.

                            @PPC: Please, could you take care for the proper setup of the two within zzzFM, you have done this already with your trashbin script, so you are probably familiar with the proper settings in zzzFM and how and what to extract from where in zzzFM for use in antiX after having it set up properly in zzzFM. Many thanks!

                            @anticapitalista: The zip file contains besides the scripts the translation .pot template file including dev notes already, and also a German test translation (.po and .mo file). Is there a textdomain or a translation resource already you want to have the translations to be merged with, or do you want me to upload the antix-zzz-extensions resource to transifex as a new resource? I guess the latter is easier to achieve, I can upload the completely prepared .pot file immediately. But you can also have it merged to some other resoure.

                            Windows is like a submarine. Open a window and serious problems will start.

                            #132224
                            Member
                            Robin

                              Update:

                              The extension scripts are at available at my git space now.

                              Translations are prepared at transifex.

                              @anticapitalista: Will try to care for the respective update of the zzzfm-localise script following the steps described by @PPC now. Not sure whether I will succeed, have never worked with this zzzFM-localising script before, maybe I overlook some pitfalls known to people familiar with this set of files and zzzFM integration:

                              Steps that we have to follow, to include these, or any other scripts, to be called from ZZZfm’s contextual menu:
                              1- include in https://gitlab.com/antiX-Linux/desktop-defaults-zzzfm-antix/-/tree/main/bin?ref_type=heads the scripts we want zzzfm to be able to access (they don’t even have to be marked as executable)
                              2- edit the default english zzzfm session file, adding, in zzzfm’s GUI, the contextual menu entries that call those scripts (and send that template to the Skell git – I forgot which one 🙁 )
                              3- edit zzzfmlocalize script to localize the 2 new strings in the contextual menu (and change it in https://gitlab.com/antiX-Linux/desktop-defaults-zzzfm-antix/-/tree/main/bin?ref_type=heads )

                              ——-
                              Edit:
                              Integration into desktop-defaults-zzzfm-antix to come soon, it’s mostly done already. I’ll include then all stuff needed to make it work on antiX 23.1. out of the box, including translation of the two new context menu entries.

                              Windows is like a submarine. Open a window and serious problems will start.

                              #132670
                              Moderator
                              BobC

                                Great ideas! I use both zzzfm and meld all the time and really like anti-apXos multiselect idea.

                                I haven’t tried diffuse but will have a look at it.

                                Daily driver distro https://www.antixforum.com

                                #132720
                                Member
                                Robin

                                  @BobC Yes, it was you who has introduced me to this tool. This thing came handy many many times meanwhile, so I can’t express how much thankful I am for this hint you gave me, while we were working together on antiXscreenshot2. It actually has saved me lots of time since. So now I decided to integrate it into antiX zzzFM file manager.

                                  Meanwhile you’ll find all the new stuff from this thread here: https://gitlab.com/antiX-Linux/desktop-defaults-zzzfm-antix
                                  Many thanks for having merged this, @anticapitalista

                                  Windows is like a submarine. Open a window and serious problems will start.

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