Announcement

Collapse
No announcement yet.

Service Menus with Dolphin

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

    #46
    Working in Kubuntu 16.04 with Dolphin version 16.04.3 (and Plasma 5.8.7):

    Two ways to copy path and filename to clipboard:
    https://www.kubuntuforums.net/showth...l=1#post402060 requires xsel
    https://www.kubuntuforums.net/showth...l=1#post402061 requires xclip

    Then I made a very simple "Open with mpv" menu entry:
    Code:
    [Desktop Entry]
    Actions=open-with-mpv
    ServiceTypes=KonqPopupMenu/Plugin
    #MimeType=inode/directory
    MimeType=application/octet-stream
    Type=Service
    X-KDE-Priority=TopLevel
    
    [Desktop Action open-with-mpv]
    Exec=mpv %U
    Name=Open with mpv
    Icon=mpv
    I changed
    Code:
    MimeType=application/octet-stream
    to
    Code:
    MimeType=all/all
    so I can open folders or individual files.
    Last edited by chimak111; Jul 23, 2017, 08:05 AM.
    Kubuntu 20.04

    Comment


      #47
      Originally posted by chimak111 View Post
      Working in Kubuntu 16.04 with Dolphin version 16.04.3 (and Plasma 5.8.7):

      Two ways to copy path and filename to clipboard:
      https://www.kubuntuforums.net/showth...l=1#post402060 requires xsel
      https://www.kubuntuforums.net/showth...l=1#post402061 requires xclip

      Then I made a very simple "Open with mpv" menu entry:
      Code:
      [Desktop Entry]
      Actions=open-with-mpv
      ServiceTypes=KonqPopupMenu/Plugin
      #MimeType=inode/directory
      MimeType=application/octet-stream
      Type=Service
      X-KDE-Priority=TopLevel
      
      [Desktop Action open-with-mpv]
      Exec=mpv %U
      Name=Open with mpv
      Icon=mpv
      ok ,,gota ask ,,,why "mpv" is not that a media player ,,,,I'v never used it .

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

      Comment


        #48
        Originally posted by vinnywright View Post
        ok ,,gota ask ,,,why "mpv" is not that a media player ,,,,I'v never used it .
        VINNY
        It has a minimal GUI and I'm used to it on my Lubuntu laptop. I'm using the ppa version: https://launchpad.net/~mc3man/+archi..._filter=xenial.

        The one in the standard repos is quite old (and gave me trouble with kwin as well).

        Plus I wanted to make a service menu all of my very own
        Kubuntu 20.04

        Comment


          #49
          Originally posted by chimak111 View Post
          It has a minimal GUI and I'm used to it on my Lubuntu laptop. I'm using the ppa version: https://launchpad.net/~mc3man/+archi..._filter=xenial.

          The one in the standard repos is quite old (and gave me trouble with kwin as well).

          Plus I wanted to make a service menu all of my very own
          O ,,,so you made a service menu to launch mpv on a media file .

          I thought you were still talking about getting the full path and filename of some file to the clipboard.

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

          Comment


            #50
            Use This As Icon

            Linking to Thread: Dolphin folder display, one photo only as thunbnail. - https://www.kubuntuforums.net/showth...bnail?p=408667

            With the KDE Frameworks 5.41.0 (kio) , KDE Applications 17.12.0 (Dolphin), Plasma 5.11.4 (kde-cli-tools).

            Making a desktop file - useThisAsIcon.desktop

            Code:
            [Desktop Entry]
            Type=Service
            Icon=image-x-icon
            X-KDE-ServiceTypes=KonqPopupMenu/Plugin
            MimeType=all/allfiles;
            Actions=thisIcon;
            Encoding=UTF-8
            
            [Desktop Action thisIcon]
            Name=Use this as folder icon
            Icon=image-x-icon
            Exec=useThisAsIcon.sh "%f"


            And a script file - useThisAsIcon.sh:

            Code:
            #!/bin/sh
            # Usage: useThisAsIcon /path/to/file.extension
            
            file=$1
            directory=$(dirname "${file}")
            
            kioclient5 copy "thumbnail://$file" "$directory/.cover.png"
            kwriteconfig5 --file "$directory/.directory" --group 'Desktop Entry' --key Icon ./.cover
            The script file is executing the kio thumbnail and writing the thumbnail to the .cover.png. The script is also writing the icon key to the the KDE .directory file:





            More of the kioclient and the kwriteconfig can be found with the commands:

            Code:
            kioclient --help
            kwriteconfig --help
            With the KDE Frameworks 5 the commands are kioclient5 and the kwriteconfig5.
            Last edited by Rog131; Jan 05, 2018, 01:41 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


              #51
              Nice!! Thanks!

              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?
              Last edited by MoonRise; Jan 06, 2018, 08:54 AM.

              Comment


                #52
                Originally posted by MoonRise View Post
                Nice!! Thanks!

                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?
                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 .

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

                Comment


                  #53
                  ..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.

                  Please Read Me

                  Comment


                    #54
                    KDE4 vs KF5

                    Paths

                    Service menus are looked at...

                    Earlier: https://www.kubuntuforums.net/showth...l=1#post367207

                    KDE4 - Debian based:

                    ~/.kde/share/kde4/services/ServiceMenus/
                    and
                    /usr/share/kde4/services/ServiceMenus/

                    KF5:

                    ~/.local/share/kservices5/ServiceMenus/
                    and
                    /usr/share/kservices5/ServiceMenus/

                    A quick test

                    with
                    $ dolphin -v
                    Qt: 4.8.6
                    KDE Development Platform: 4.14.2
                    Dolphin: 4.14.2
                    ~/.kde/share/kde4/services/ServiceMenus/useThisAsIcon.desktop:
                    Code:
                    [Desktop Entry]
                    Type=Service
                    Icon=image-x-icon
                    X-KDE-ServiceTypes=KonqPopupMenu/Plugin
                    MimeType=all/allfiles;
                    Actions=thisIcon;
                    Encoding=UTF-8
                    
                    [Desktop Action thisIcon]
                    Name=Use this as folder icon
                    Icon=image-x-icon
                    Exec=useThisAsIcon.sh "%f"
                    Executable useThisAsIcon.sh:
                    Code:
                    #!/bin/sh
                    # Usage: useThisAsIcon /path/to/file.extension
                    
                    file=$1
                    directory=$(dirname "${file}")
                    
                    kioclient copy "thumbnail://$file" "$directory/.cover.png"
                    kwriteconfig --file "$directory/.directory" --group 'Desktop Entry' --key Icon ./.cover
                    In the right place - told by echo $PATH.

                    Seems to work =>



                    Notes

                    The KDE4 Dolphin is not refreshing the view. The user need to press F5 to reload the folder icons.

                    The KDE4 Dolphin/kio is squashing the icons to square. KF5 keep the image proportions.
                    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


                      #55
                      Thanks All!

                      Comment


                        #56
                        Originally posted by Rog131 View Post
                        Linking to Thread: Dolphin folder display, one photo only as thunbnail. - https://www.kubuntuforums.net/showth...bnail?p=408667

                        With the KDE Frameworks 5.41.0 (kio) , KDE Applications 17.12.0 (Dolphin), Plasma 5.11.4 (kde-cli-tools).

                        Making a desktop file - useThisAsIcon.desktop

                        Code:
                        [Desktop Entry]
                        Type=Service
                        Icon=image-x-icon
                        X-KDE-ServiceTypes=KonqPopupMenu/Plugin
                        MimeType=all/allfiles;
                        Actions=thisIcon;
                        Encoding=UTF-8
                        
                        [Desktop Action thisIcon]
                        Name=Use this as folder icon
                        Icon=image-x-icon
                        Exec=useThisAsIcon.sh "%f"
                        And a script file - useThisAsIcon.sh:

                        Code:
                        #!/bin/sh
                        # Usage: useThisAsIcon /path/to/file.extension
                        
                        file=$1
                        directory=$(dirname "${file}")
                        
                        kioclient5 copy "thumbnail://$file" "$directory/.cover.png"
                        kwriteconfig5 --file "$directory/.directory" --group 'Desktop Entry' --key Icon ./.cover
                        Hi Rog131 & everybody,
                        I tried to add this service menu to my Kubuntu 18.04, but I don't understand exactly, where to put the useThisAsIcon.sh and what to do exactly with it.
                        What do you mean by:
                        In the right place - told by echo $PATH.
                        Thank you in advance about a timely response!
                        Chipy

                        Comment


                          #57
                          Originally posted by Chipy View Post
                          Hi Rog131 & everybody,
                          I tried to add this service menu to my Kubuntu 18.04, but I don't understand exactly, where to put the useThisAsIcon.sh and what to do exactly with it.
                          What do you mean by:

                          Thank you in advance about a timely response!
                          Chipy
                          Hi !

                          What is PATH ?: http://www.linfo.org/path_env_var.html
                          PATH is an environmental variable in Linux and other Unix-like operating systems that tells the shell which directories to search for executable files (i.e., ready-to-run programs) in response to commands issued by a user. It increases both the convenience and the safety of such operating systems and is widely considered to be the single most important environmental variable...

                          A list of all the current environmental variables and their values for the current user, including all the directories in the PATH variable, can be seen by running the env command without any options or arguments (i.e., input data), i.e.,

                          env

                          As there can be considerable output, it can be convenient to modify this command so that it displays just the PATH environmental variable and its value. This can be accomplished by using a pipe (represented by the vertical bar character) to transfer the output of env to the grep filter and use PATH as an argument to grep, i.e.,

                          env | grep PATH

                          Another way to view the contents of just PATH alone is by using the echo command with $PATH as an argument:

                          echo $PATH

                          echo repeats on the display screen whatever follows it on the command line. The dollar sign immediately preceding PATH tells echo to repeat the value of the variable PATH rather than its name.

                          Each user on a system can have a different PATH variable...
                          AskUbuntu - How to add a directory to the PATH?: https://askubuntu.com/questions/6021...ry-to-the-path

                          At here the useThisAsIcon.sh is in the $HOME/.bin/:



                          as my $PATH includes it.

                          The useThisAsIcon.sh is executable:



                          so I can execute it when I right click a file:



                          The desktop file ($HOME/.local/share/kservices5/ServiceMenus/useThisAsIcon.desktop) has line:

                          Code:
                          Exec=useThisAsIcon.sh "%f"
                          The Exec key: https://standards.freedesktop.org/de...t/ar01s07.html

                          The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments. The executable program can either be specified with its full path or with the name of the executable only. If no full path is provided the executable is looked up in the $PATH environment variable used by the desktop environment...
                          Last edited by Rog131; Jul 16, 2018, 04:34 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


                            #58
                            Originally posted by Rog131 View Post
                            Hi !

                            What is PATH ?: http://www.linfo.org/path_env_var.html

                            AskUbuntu - How to add a directory to the PATH?: https://askubuntu.com/questions/6021...ry-to-the-path

                            At here the useThisAsIcon.sh is in the $HOME/.bin/:

                            as my $PATH includes it.

                            The useThisAsIcon.sh is executable:

                            so I can execute it when I right click a file:

                            The desktop file ($HOME/.local/share/kservices5/ServiceMenus/useThisAsIcon.desktop) has line:

                            Code:
                            Exec=useThisAsIcon.sh "%f"
                            The Exec key: https://standards.freedesktop.org/de...t/ar01s07.html
                            Hi Rog131,
                            thank you very much for your fast answer!

                            I checked with
                            Code:
                            [FONT=sans-serif]echo $PATH[/FONT]
                            and got as result
                            Code:
                            /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
                            So I moved the executable useThisAsIcon.sh to
                            Code:
                            /usr/local/bin
                            , where I also have two other executable files for service menus.

                            But I'm only getting an Internal Error and there is no new icon...

                            Any further ideas?

                            Thank you in advance!
                            Chipy

                            Comment


                              #59
                              Originally posted by Chipy View Post

                              ...But I'm only getting an Internal Error and there is no new icon...

                              Any further ideas?

                              Thank you in advance!
                              Chipy
                              Hi !

                              Do you see something like:

                              or something else ?

                              In this case the image file has a wrong extension.
                              A bug report: Bug 220496 - Preview of pictures when content type does not match extension - https://bugs.kde.org/show_bug.cgi?id=220496

                              You could check if there is a wrong extension with the file command:
                              Code:
                              $ file /media/sda1/GifWallpapers/1358773.jpg
                              /media/sda1/GifWallpapers/1358773.jpg: GIF image data, version 89a, 460 x 460
                              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


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

                                Comment

                                Working...
                                X