Announcement

Collapse
No announcement yet.

Service Menus with Dolphin

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

    #61
    No, it only says :
    No plugin specified.

    Comment


      #62
      Originally posted by Chipy View Post
      No, it only says :
      What kind of file ?
      What is the extension ?

      I get the error - No plugin specified - When the kioclient5 doesn't link the filename pattern to the correct file type.
      i.e with the 'video.mpeg-4' the thumbnailer can thumbnail it but the kioclient5 command doesn't understand the type.



      Last edited by Rog131; Jul 16, 2018, 10:22 AM.
      Before you edit, BACKUP !

      Why there are dead links ?
      1. Thread: Please explain how to access old kubuntu forum posts
      2. Thread: Lost Information

      Comment


        #63
        Magick pile of Polaroids

        With the help of the ImageMagick /1/ the KDE icons can be made from the piles of polaroids.



        The context menu desktop part - $HOME/.local/share/kservices5/ServiceMenus/magickpile.desktop:
        Code:
        [Desktop Entry]
        Type=Service
        Icon=view-list-icons
        X-KDE-ServiceTypes=KonqPopupMenu/Plugin
        MimeType=all/allfiles;
        Actions=magickPile;
        Encoding=UTF-8
        
        [Desktop Action magickPile]
        Name=Magick pile of icons
        Icon=view-list-icons
        Exec=magickpile.pl "%F"


        The thumbnail polaroids are scooped from the thumbnail cache and piled with a short Perl script - magickpile.pl:
        Code:
        #!/usr/bin/perl
        
        # usage: magickpile.pl filelist
        
        use strict;
        use warnings;
        
        # modules
        use Image::Magick;
        use File::Spec;
        use URI::Escape;
        use Digest::MD5 qw(md5_hex);
        
        my $angle;
        my @newIcon;
        
        my $i = 0;
        my $iconResolution = '256x256';
        
        my $cachePath = $ENV{XDG_CACHE_HOME} || ("$ENV{HOME}/.cache");
        my $thumbPath = "$cachePath/thumbnails/large/";
        
        $ARGV[0] =~ s' /' //'g;
        my @fileNames = split(' /', $ARGV[0]);
        my ($volume,$workDir,$file) = File::Spec->splitpath( $fileNames[0] );
        my $iconOut = "$workDir.magickpile.png";
        
        # pile of thumbs
        foreach my $name (@fileNames) {
        $i++;
        my $fullName = "file://" . $name;
        my $escapedName = uri_escape("$fullName", "^A-Öa-ö0-9\-\.,_~/:()&!\@\\[\\]'");
        $escapedName=~ s'\|'%7C'g;
        $escapedName=~ s'%24'$'g;
        $escapedName=~ s'\{'%7B'g;
        $escapedName=~ s'\}'%7D'g;
        my $thumbName = md5_hex("$escapedName") . ".png";
        my $angle = int(rand(30))-15;
        $newIcon[$i] = Image::Magick->new;
        $newIcon[$i]->Read("$thumbPath$thumbName");
        $newIcon[$i]->Polaroid(angle => $angle, gravity => 'center', background => 'transparent');
        $newIcon[$i] = $newIcon[$i]->Montage(geometry=>$iconResolution, background=>'transparent');
        if ($i > 1) { 
        $newIcon[1]->Composite(image=>$newIcon[$i],compose=>'over', gravity=>'center');
        $newIcon[$i]->Set(quality=>100);
        }
        }
        
        $newIcon[1]->Write("$iconOut");
        system ("kwriteconfig5", "--file", "$workDir.directory", "--group", "Desktop Entry", "--key", "Icon", "./.magickpile.png");
        Executable script 'magickpile.pl' is located in the $PATH. The script is using PerlMagick /2/

        Note !

        This script is using 'Correctly encode URL of thumbnails' /3/. It won't work with the older KDE Frameworks (<5.46 ?). At here, now, the KF 5.48.0.

        It is getting the thumbnails from the thumbnail cache. If the thumbnailer /4/ is not caching then it won't work with this type of thumbnails.

        Preview



        Direct: https://youtu.be/-JEfOa8gAWQ

        Links

        1. https://www.imagemagick.org/script/index.php
        2. http://www.imagemagick.org/script/perl-magick.php
        3. https://cgit.kde.org/kio.git/commit/...499eff3b976162
        4. https://api.kde.org/frameworks/kio/h...mbCreator.html
        Last edited by Rog131; Jul 17, 2018, 10:05 AM.
        Before you edit, BACKUP !

        Why there are dead links ?
        1. Thread: Please explain how to access old kubuntu forum posts
        2. Thread: Lost Information

        Comment


          #64
          Can you make these scripts work in the dolphin menu?
          They are used to print the selected files without first opening them.
          They work in nautilus and derived file managers, but I do not know how to make them work in Kubuntu.

          https://ubuntu-mate.community/t/prin...-in-caja/15885

          Thanks

          Comment


            #65
            Originally posted by SDG10 View Post
            Can you make these scripts work in the dolphin menu?
            They are used to print the selected files without first opening them.
            They work in nautilus and derived file managers, but I do not know how to make them work in Kubuntu.

            https://ubuntu-mate.community/t/prin...-in-caja/15885

            Thanks
            There is no need 'to carry coals to Newcastle': https://idioms.thefreedictionary.com...s+to+Newcastle.

            A bit easier is to search from the KDE Store:

            The KDE Store: https://store.kde.org
            Dolphin Service Menus: https://store.kde.org/browse/cat/102/

            Searching - Search results for "pdf": https://store.kde.org/search/projectSearchText/pdf/

            A sample: KDE 5 Service Menu PDF - https://store.kde.org/p/1227799/

            Editing a bit (*)- Only adding the option to print selected files without first opening them:



            (*)
            1) Unpacking the 'kde-service-menu-pdf_1.0_all.tar.gz'
            2) Copying the executable 'pdfprint-kdialog' (**) to the $PATH.
            3) Adding a desktop file - pdfprintfiles.desktop:
            Code:
            [Desktop Entry]
            Type=Service
            Icon=printer
            X-KDE-ServiceTypes=KonqPopupMenu/Plugin
            MimeType=application/pdf
            Actions=printPdfFiles;
            X-KDE-Submenu=Pdf Print
            Encoding=UTF-8
            
            [Desktop Action printPdfFiles]
            Icon=printer
            Name=Print selected documents
            Name[de]=Ausgewählte Dokumente drucken
            Name[fr]=Imprimer les documents sélectionnés
            Name[it]=Stampa i documenti selezionati
            Name[ru]=Распечатать выбранные документы
            Exec=pdfprint-kdialog %F
            to the $HOME/.local/share/kservices5/ServiceMenus/

            (**)
            Though the script has name, pdfprint-kdialog, it will print other file types with the lpr if the user wants to.
            Last edited by Rog131; Aug 10, 2018, 03:27 PM.
            Before you edit, BACKUP !

            Why there are dead links ?
            1. Thread: Please explain how to access old kubuntu forum posts
            2. Thread: Lost Information

            Comment


              #66
              OK thank you very much ,
              but it's not really the same thing.

              That script can print everything because it contains both the lpr and libreoffice commands, it also gives an error message if you select a non-printable file (eg mp3) and you can have it in the default printer version or you can specify which printer to use, so in the context menu you can get "print with HP" or "Print with Samsung", for instance, and I find this very useful.

              I'm new to Kubuntu and I would like to have the same thing as Ubuntu Mate, if possible.

              Is that too much to ask?

              Comment


                #67
                You can either install Caja to your system and use their script and Caja. Or if you want to stick to Dolphin, then rewrite the script to use the correct print commands for KDE ("lp" for plain files and "libreoffice -p" for office files) or you can just write your own servicemenu desktop files and put them in ~/.local/share/kservices5/ServiceMenus/.

                Here's a start for you; If you have libreoffice installed, it will print almost anything from the command line. It will use it's default print settings. Create a file from the code below and put it in ~/.local/share/kservices5/ServiceMenus/ and try it out:
                Code:
                [Desktop Entry]
                Actions=print-file
                Icon=print
                MimeType=application/pdf;image/*;application/vnd.oasis.opendocument.text;text/plain;application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.opendocument.presentation;application/msword;application/vnd.ms-word;application/vnd.ms-excel;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.spreadsheet.sheet;application/vnd.openxmlformats-officedocument.presentationml.presentation;
                ServiceTypes=KonqPopupMenu/Plugin
                Encoding=UTF-8
                Type=Service
                X-KDE-Priority=TopLevel
                
                
                [Desktop Action print-file]
                Exec=lp %f
                Exec=libreoffice -p %f 
                Icon=stock_print
                Name=Print Now
                I tested this here on an image, a libreoffice document, a pdf, and a plain text file. Works for me.

                Please Read Me

                Comment


                  #68
                  Originally posted by SDG10 View Post
                  OK thank you very much ,
                  but it's not really the same thing.

                  That script can print everything because it contains both the lpr and libreoffice commands, it also gives an error message if you select a non-printable file (eg mp3) and you can have it in the default printer version or you can specify which printer to use, so in the context menu you can get "print with HP" or "Print with Samsung", for instance, and I find this very useful.

                  I'm new to Kubuntu and I would like to have the same thing as Ubuntu Mate, if possible.

                  Is that too much to ask?
                  KDE Service Menus
                  ( https://techbase.kde.org/Development..._Service_Menus )

                  In KDE-speak a "servicemenu" is a special entry that appears in a context menu (or other context-based interface) for a file (or for directory), depending on the type of files that are selected.
                  The KDE context menus are file type specific. You can't print mp3 file from the PDF print menu - If you have in the service menu desktop file:

                  Code:
                  MimeType=application/pdf


                  KDE applications

                  If applications are build on the top of the KDE framework then they could have the service menus off the box.

                  Calligra Words:

                  Code:
                  $ calligrawords --help
                  calligra.lib.pigment: Legacy integer arithmetics implementation
                  Usage: calligrawords [options] [file(s)]
                  Word processor
                  
                  Options:
                  -h, --help                       Displays this help.
                  .
                  .
                  .
                  --print                          Only print and exit
                  .
                  .
                  .
                  Arguments:
                  [file(s)]                        File(s) or URL(s) to open
                  There is a service menu available off the box...



                  Free and open...

                  If you want service menus with the non KDE application you could add them yourself as 'oshunluvr' did.

                  Libreoffice:
                  Code:
                  $ libreoffice --help
                  LibreOffice 6.0.6.2 00m0(Build:2)
                  
                  Usage: soffice [argument...]
                    argument - switches, switch parameters and document URIs (filenames).
                  
                  .
                  .
                  .
                  -p                  Prints following files to the default printer, after
                                    which those files are closed. The splash screen does
                                    not appear. If the file name contains spaces, then it
                                    must be enclosed in quotation marks.
                  .
                  .
                  .
                  and you could share your service menus with us.

                  AskUbuntu - https://askubuntu.com/questions/1405...-odt-documents :
                  Code:
                  libreoffice --writer -p --headless 'filename1' 'filename2'
                  Last edited by Rog131; Aug 11, 2018, 10:25 AM.
                  Before you edit, BACKUP !

                  Why there are dead links ?
                  1. Thread: Please explain how to access old kubuntu forum posts
                  2. Thread: Lost Information

                  Comment


                    #69
                    A post above gave the URL of a Dolphin PDF service menu:

                    A sample: KDE 5 Service Menu PDF - https://store.kde.org/p/1227799/

                    I attempted a few weeks ago to install GuiseppeBenigno's KDE 5 Service Menu PDF but no services were added after the install.

                    Today I decided to uninstall it and try again. The results were the same. After investigating I found that without warning it would not install because a program, pdftk, was missing from the BIONIC repository and the upstream developers said it wouldn't be installed because it depended upon GJI, a java tool, which was no longer being maintained. Without that file the service menu failed to install.

                    Looking around I found the deb package in ~/.local/share/servicemenu-download/kde-service-menu-pdf_1.0_all.deb

                    All I needed was to do a workaround to get pdftk installed. I found it here: https://bugs.launchpad.net/ubuntu/+s...450/comments/4
                    The following steps failed because it couldn't find gcc-6-base, which IS in the BIONIC repository. After I installed it the following steps installed pdftk:
                    Code:
                      wget [URL]http://archive.ubuntu.com/ubuntu/pool/universe/p/pdftk/pdftk_2.02-4build1_amd64.deb[/URL]
                      wget [URL]http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-6/libgcj17_6.4.0-8ubuntu1_amd64.deb[/URL]
                      wget [URL]http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-defaults/libgcj-common_6.4-3ubuntu1_all.deb[/URL]
                      sudo dpkg -i pdftk_2.02-4build1_amd64.deb libgcj17_6.4.0-8ubuntu1_amd64.deb libgcj-common_6.4-3ubuntu1_all.deb
                    Instead of installing gcc-6-base separately you can make the last line:
                    sudo dpkg -i gcc-6-base pdftk_2.02-4build1_amd64.deb libgcj17_6.4.0-8ubuntu1_amd64.deb libgcj-common_6.4-3ubuntu1_all.deb

                    With pdftk installed I used Dolphin to browse to and right clicked on kde-service-menu-pdf_1.0_all.deb and let QApt Package Installer install it. Dolphin's service menu options were populated with the services supplied by that deb package.
                    Last edited by GreyGeek; Aug 11, 2018, 11:56 AM.
                    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                    – John F. Kennedy, February 26, 1962.

                    Comment


                      #70
                      Dolphin dbus changes with the KDE Applications 18.08

                      With the KDE Applications 18.08 (Dolphin) the 'Convert hard coded shortcuts to standard keys' has landed:

                      - https://phabricator.kde.org/D11048
                      - https://cgit.kde.org/dolphin.git/com...154782664d0835

                      Before - reload:



                      qdbus command:
                      Code:
                      $ qdbus org.kde.dolphin-914 /dolphin/Dolphin_1/actions/reload trigger
                      After - redisplay:



                      qdbus command:

                      Code:
                      qdbus org.kde.dolphin-2684 /dolphin/Dolphin_1/actions/view_redisplay trigger
                      Before you edit, BACKUP !

                      Why there are dead links ?
                      1. Thread: Please explain how to access old kubuntu forum posts
                      2. Thread: Lost Information

                      Comment


                        #71
                        Originally posted by Rog131 View Post
                        With the KDE Applications 18.08 (Dolphin) the 'Convert hard coded shortcuts to standard keys' has landed:

                        - https://phabricator.kde.org/D11048
                        - https://cgit.kde.org/dolphin.git/com...154782664d0835
                        That diff looks familiar
                        Mark Your Solved Issues [SOLVED]
                        (top of thread: thread tools)

                        Comment


                          #72
                          Originally posted by oshunluvr View Post
                          ...
                          I tested this here on an image, a libreoffice document, a pdf, and a plain text file. Works for me.
                          Thank you very much,
                          The script for Nautilus/Caja file managers has some more features than this, in fact it also gives the error message in case of non-printable files, and gives the possibility to print all the printable files contained in a folder simply selecting it ... but after all, your is very good for common needs.
                          The only change I made is to put the capital F, which allows you to select and print multiple files.

                          [Desktop Entry]
                          Actions=print-file
                          Icon=print
                          MimeType=application/pdf;image/*;application/vnd.oasis.opendocument.text;text/plain;application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.opendocument.presentation;application/msword;application/vnd.ms-word;application/vnd.ms-excel;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.wordprocessingml.document;applicati on/vnd.openxmlformats-officedocument.spreadsheet.sheet;application/vnd.openxmlformats-officedocument.presentationml.presentation;
                          ServiceTypes=KonqPopupMenu/Plugin
                          Encoding=UTF-8
                          Type=Service
                          X-KDE-Priority=TopLevel

                          [Desktop Action print-file]
                          Exec=lp %F
                          Exec=libreoffice -p %F
                          Icon=stock_print
                          Name=Print
                          The following procedure allows you to modify the previous script so that you can specify a different printer than the default one.

                          Find the name of the printer you are using by typing in the terminal:
                          lpstat -p -d
                          Then replace the string 'Samsung-M2020-Series' with the name found using the command lpstat -p -d and 'PrintYourPrinter' with the name of your printer

                          [Desktop Entry]
                          Actions=print-file
                          Icon=print
                          MimeType=application/pdf;image/*;application/vnd.oasis.opendocument.text;text/plain;application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.opendocument.presentation;application/msword;application/vnd.ms-word;application/vnd.ms-excel;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.wordprocessingml.document;applicati on/vnd.openxmlformats-officedocument.spreadsheet.sheet;application/vnd.openxmlformats-officedocument.presentationml.presentation;
                          ServiceTypes=KonqPopupMenu/Plugin
                          Encoding=UTF-8
                          Type=Service
                          X-KDE-Priority=TopLevel

                          [Desktop Action print-file]
                          Exec=lp -P Samsung-M2020-Series %F
                          Exec=libreoffice -pt Samsung-M2020-Series %F
                          Icon=stock_print
                          Name=PrintYourPrinter
                          Last edited by SDG10; Sep 15, 2018, 04:23 AM.

                          Comment


                            #73
                            Remove selected thumbnails

                            Part of the thumbnailtools/kenric: https://store.kde.org/p/1080815/ is the 'Remove selected thumbnails'.



                            The servicemenu is using same code as the KDE to find the thumbnail names (kthumbnamefinder5):



                            Preview clip with the Keneric - Scripting KDE video preview thumbnails:

                            Direct: https://youtu.be/L694nghnPo8

                            KDE Forums - Scripting KDE video preview thumbnails: https://forum.kde.org/viewtopic.php?...409077#p409077
                            Last edited by Rog131; Dec 31, 2018, 07:11 PM.
                            Before you edit, BACKUP !

                            Why there are dead links ?
                            1. Thread: Please explain how to access old kubuntu forum posts
                            2. Thread: Lost Information

                            Comment


                              #74
                              Context/Service menu refresh issue

                              Originally posted by MoonRise View Post
                              EDIT: Oddly I add that desktop entry to `/.kde/share/kde4/services/ServiceMenus/ but for some reason does not show up even on a reboot. Will play around some, but any feedback?
                              Originally posted by vinnywright View Post
                              are you running plasma5 ?

                              try /home/vinny/.local/share/kservices5/ServiceMenus/ ,,,,,,,of corse change "vinny" to your user name and you may half to make the "kservices5" directory .
                              Originally posted by oshunluvr View Post
                              ..and rebooting isn't necessary. At the most closing and re-launching Dolphin, but even that shouldn't be necessary. They should be available immediately.
                              Hmm, actually the refresh isn't immediate to me in Dolphin (and desktop) on Arch Linux, Plasma 5.16...
                              At least when I change Name and Exec inside .desktop file, the command in context menu remains old.
                              Does anyone know how to fix it so that refresh is immediate?

                              I have discovered a workaround to it though - renaming the .desktop file (you may wish to do it back and forth) refreshes the action in context menu 100% reliably and immediately.
                              Interestingly also moving in any direction between the two folders refreshes the context menu:
                              /home/we/.local/share/kservices5/ServiceMenus/
                              /home/we/.local/share/kservices5/
                              because it turns out that .desktop files can be on either of these levels to work.

                              Another discrepancy from advice in this thread I have noticed is that such Exec command will not launch a shell script from Service Menu:
                              Code:
                              Exec=zip.sh %U
                              I need to launch a shell command and pass the script filename as parameter:
                              Code:
                              Exec=[B]sh[/B] zip.sh %U
                              I guess this is because I do not have a default program for handling .sh files defined. In any case, it took me hours to identify this was the reason things didn't work for me, so I am sharing this.
                              Last edited by wojcieche; Sep 11, 2019, 03:19 PM. Reason: Nothing changed, just turned on displaying smileys in this post.

                              Comment


                                #75
                                It should execute directly if
                                - It's set to +x (executable) and
                                - has #!/bin/bash at the beginning.

                                Comment

                                Working...
                                X