Announcement

Collapse
No announcement yet.

How does this service menu work?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How does this service menu work?

    I have this service menu: /home/chimak/.local/share/kservices5/ServiceMenus/meld-menu.desktop highly simplified from those in the KDE Store. It works only with files in the same folder.

    Code:
    [Desktop Entry]
    Type=Service
    ServiceTypes=KonqPopupMenu/Plugin
    MimeType=inode/directory;application/octet-stream;
    Actions=meld
    X-KDE-Priority=TopLevel
    
    [Desktop Action meld]
    Icon=page-2sides
    Exec=meld %U
    Name=Meld
    When I
    • [1]left-click on one file
      [2]ctrl+left-click on a second file and
      [3]right-click to choose "meld" from the context menu


    Meld opens and I can see where the two files differ.

    (I can do the same thing in the terminal with meld /path/to/filename1 path/to/filename2.)

    My question is this: it looks like the names of the file left-clicked in [1] and the file ctrl+left-clicked in [2] are somehow stored for use in [3] but where?
    Kubuntu 20.04

    #2
    In memory or some tmp file (to be deleted after the function is closed)?
    Using Kubuntu Linux since March 23, 2007
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Originally posted by Snowhog View Post
      In memory or some tmp file (to be deleted after the function is closed)?
      In this meld service menu (modified from https://www.pling.com/p/998366), ~/tmp is used in the Exec= line:

      Code:
      [Desktop Entry]
      Type=Service
      ServiceTypes=KonqPopupMenu/Plugin
      MimeType=inode/directory;application/octet-stream;
      Icon=meld
      Actions=setArg1;diff;_SEPARATOR_;selected;
      X-KDE-Priority=TopLevel
      X-KDE-StartupNotify=false
      X-KDE-Submenu=Meld menu
      
      [Desktop Action setArg1]
      Icon=arrow-left
      Exec=echo "%U" > /tmp/meld-menu-arg1
      Name=Set file/folder
      
      [Desktop Action diff]
      Icon=arrow-right
      Exec=ARG1=$(cat /tmp/meld-menu-arg1);meld "$ARG1" %U; rm /tmp/meld-menu-arg1;
      Name=Compare with file/folder
      
      [Desktop Action selected]
      Icon=page-2sides
      Exec=meld %U; rm /tmp/meld-menu-arg1;
      Name=Compare selected files/folder
      But in the one I posted, the Exec= line is simpler.
      Kubuntu 20.04

      Comment


        #4
        check "man meld" it may state what it dose .

        VINNY
        i7 4core HT 8MB L3 2.9GHz
        16GB RAM
        Nvidia GTX 860M 4GB RAM 1152 cuda cores

        Comment


          #5
          Not really a mystery, just basic Dolphin service menu stuff:

          %U = multiple URLs.

          The first left-click selects the first file, the second left-click using CTRL selects the second file without de-selecting the first file, thus when you select the Meld action from the menu, it chooses all the files in the URL list - the two you selected.

          Please Read Me

          Comment


            #6
            Originally posted by oshunluvr View Post
            ...
            The first left-click selects the first file, the second left-click using CTRL selects the second file without de-selecting the first file, thus when you select the Meld action from the menu, it chooses all the files in the URL list - the two you selected.
            Could it be a bit more complex than that?

            Consider two files, .bashrc and .bashrc.bak both in my home folder. In a "non-split" Dolphin window, meld works as expected (first image) but if I split Dolphin's window, both open to my home folder, meld fails if I select .bashrc from the left side and .bashrc.bak from the right side: it seems to compare only the second file to itself (second image).
            Attached Files
            Kubuntu 20.04

            Comment


              #7
              when working in dolphin , only the "active" pane is ? well active .

              just try to delete files in both panes at once , only the files in the active pane will be worked on .

              VINNY
              i7 4core HT 8MB L3 2.9GHz
              16GB RAM
              Nvidia GTX 860M 4GB RAM 1152 cuda cores

              Comment


                #8
                Could it be a bit more complex than that?
                Well actually, no. In your original post you asked how it worked the way it did, which I think I explained correctly. Vinny's answer explains the why your test above didn't work.

                In you above test you got the results you saw because of exactly how I and Vinny explained: In short, once you switched panes in Dolphin, the file URL list changed, so only the one selected file URL (the one in the current pane) was sent to Meld.

                If you're looking to modify the behavior of the Service Menu you'd need to write a whole new one that works totally differently. It could be done, but it would function in a totally different way.

                Please Read Me

                Comment

                Working...
                X