Announcement

Collapse
No announcement yet.

Service Menus with Dolphin

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

  • vinnywright
    replied
    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

    Leave a comment:


  • chimak111
    replied
    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.

    Leave a comment:


  • GreyGeek
    replied
    Originally posted by GreyGeek View Post
    Thanks, Rog131! Worked perfectly!
    Until I checked today.
    Seems some update in the last three weeks reversed the changes.
    Re-doing them, they still work (on fully updated Neon User Edition).

    PS - I checked the kservice5 Dolphin service menu changes and they had been reverted as well. Changed them back to Rog's solution.

    Leave a comment:


  • Rog131
    replied
    sudoedit with the Kate

    Linking: https://www.kubuntuforums.net/showth...l=1#post399157

    AskUbuntu: Proper way to let user enter password for a bash script using only the GUI (with the terminal hidden): http://askubuntu.com/questions/31439...y-the-gui-with

    =>

    Writing files:

    /usr/local/bin/sudoeditkate.sh
    Code:
    #!/bin/sh 
    
    export EDITOR=/usr/bin/kate
    export SUDO_ASKPASS=/usr/local/bin/sudoeditpass.sh
    sudoedit -A "$1"
    /usr/local/bin/sudoeditpass.sh
    Code:
    #!/bin/sh
    kdialog --password 'sudoedit needs user (sudo) password to execute the kate'
    $Home/.local/share/kservices5/ServiceMenus/rootkate.desktop
    Code:
    [Desktop Entry]
    Type=Service
    Icon=kate
    X-KDE-ServiceTypes=KonqPopupMenu/Plugin
    MimeType=all/allfiles;
    Actions=sudoeditKate;
    X-KDE-Priority=TopLevel
    #X-KDE-Submenu=
    Encoding=UTF-8
    
    [Desktop Action sudoeditKate]
    Name=sudoedit kate
    Icon=kate
    Exec=sudoeditkate.sh "%U"
    Testing...



    ...Seems to work
    Last edited by Rog131; Apr 08, 2017, 01:32 PM.

    Leave a comment:


  • acheron
    replied
    Now in zesty for testing.

    https://launchpad.net/ubuntu/+source....12.3-0ubuntu2

    Leave a comment:


  • GreyGeek
    replied
    Service Menus with Dolphin

    Thanks, Rog131! Worked perfectly!
    Last edited by GreyGeek; Mar 16, 2017, 10:03 PM.

    Leave a comment:


  • Rog131
    replied
    Only text file editing needed - 1,2,3 done

    Originally posted by acheron View Post
    Hmmmm. Backportable, maybe...
    Meanwhile - it is fixable for the users:

    1)

    Code:
    $ locate servicemenu.knsrc
    =>
    Code:
    kdesudo kate /etc/xdg/servicemenu.knsrc
    change:
    Code:
    ProvidersUrl=http://download.kde.org/khotnewstuff/servicemenu-providers.xml
    to
    Code:
     
    ProvidersUrl=http://download.kde.org/ocs/providers.xml
    Categories=Dolphin Service Menus
    2)

    Code:
    $ locate servicemenudeinstallation
    change:
    Code:
    FileUtils.rm(`kde4-config --localprefix`.strip! + "share/kde4/services/ServiceMenus/" + File.basename(archive))
    to:
    Code:
    FileUtils.rm(`qtpaths --writable-path GenericDataLocation`.strip! + "/kservices5/ServiceMenus/" + File.basename(archive))
    and

    3)

    Code:
    $ locate servicemenuinstallation
    change:
    Code:
    $servicedir = `kde4-config --localprefix`.strip! + "share/kde4/services/ServiceMenus/"
    to:
    Code:
    $servicedir = `qtpaths --writable-path GenericDataLocation`.strip! + "/kservices5/ServiceMenus/"
    Last edited by Rog131; Mar 14, 2017, 11:52 AM.

    Leave a comment:


  • acheron
    replied
    Originally posted by Rog131 View Post
    Both Bugs 371907 and Bug 376922 fixed with the https://cgit.kde.org/dolphin.git/com...10e40880bc3a1a

    => KDE Applications 17.04 / Dolphin 17.04 or later
    Hmmmm. Backportable, maybe...

    Leave a comment:


  • Rog131
    replied
    Both Bugs 371907 and Bug 376922 fixed with the https://cgit.kde.org/dolphin.git/com...10e40880bc3a1a

    => KDE Applications 17.04 / Dolphin 17.04 or later

    Leave a comment:


  • Rog131
    replied
    The Dolphin service menu GHNS is not using KDE Store

    Bug 376922 - Don't show new Service Menus in KDE Store - https://bugs.kde.org/show_bug.cgi?id=376922

    Leave a comment:


  • vinnywright
    replied
    Originally posted by Rog131 View Post
    The Dolphin is using ruby script to install and deinstall Service Menus. Looking Dolphin 16.08.2 /usr/bin/servicemenuinstallation
    and /usr/bin/servicemenudeinstallation and finding that they are still using KDE4 paths. Filing a bug report: Bug 371907 - Dolphin, KDE Framework, service menu installation and deinstallation ruby scripts are using KDE4 paths - https://bugs.kde.org/show_bug.cgi?id=371907
    added my as well stating it was the same on Kubuntu-16.04 and Neon dev/stable as well ,,,,,,,,shouldn't be that hard to confirm ,,,,it's a script.

    VINNY

    Leave a comment:


  • Rog131
    replied
    GHNS wrong paths

    The Dolphin is using ruby script to install and deinstall Service Menus. Looking Dolphin 16.08.2 /usr/bin/servicemenuinstallation
    and /usr/bin/servicemenudeinstallation and finding that they are still using KDE4 paths. Filing a bug report: Bug 371907 - Dolphin, KDE Framework, service menu installation and deinstallation ruby scripts are using KDE4 paths - https://bugs.kde.org/show_bug.cgi?id=371907

    Leave a comment:


  • Teunis
    replied
    So good we have this forum!

    After installation of the Root Actions Service Menu in Dolphin on 15.10 I noticed they were not showing and remembered there was this 'hybrid' problem.

    This is the relevant bit from Rog's post needed to fix the issue:
    The Kubuntu 15.04 is a hybrid system. There are KDE4 applications and there are new KF5 applications. The KDE4 parts are looking the service menus from:

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

    The new KF5 service menus are at:

    ~/.local/share/kservices5/ServiceMenus/
    and
    /usr/share/kservices5/ServiceMenus/
    Open Dolphin, press Alt+. to view the hidden stuff, F3 to get a split pane view, in the left pane you open the kde4 path, in the right the kde5 one.

    In the kde4 path you should see the installed menu's .desktop files, drag them to the right pane and select Link.

    Done.
    Last edited by Teunis; Dec 13, 2015, 11:51 AM. Reason: Grammar

    Leave a comment:


  • Rog131
    replied
    Using embedded mp4 cover art with the KDE thumbnailer

    Linking to http://askubuntu.com/questions/67956...d-use-built-in

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


    With the KDE4:

    Making: ~/.kde/share/kde4/services/ServiceMenus/mattepaint-mp4.desktop
    Code:
    [Desktop Entry]
    Type=Service
    Icon=kdenlive-add-clip
    X-KDE-ServiceTypes=KonqPopupMenu/Plugin
    MimeType=video/mp4;
    Actions=useMp4Image;pickMp4Image
    #X-KDE-Priority=TopLevel
    X-KDE-Submenu=Video Thumbnail Fixer
    Encoding=UTF-8
    InitialPreference=69
    
    [Desktop Action useMp4Image]
    Name=Use a picture from the Mp4 attachments
    Icon=mail-attachment
    Exec=mp4-image-to-thumbnaill.pl "%U"
    
    [Desktop Action pickMp4Image]
    Name=Pick a picture from the Mp4 attachments
    Icon=project-open
    Exec=mp4-pick-image-to-thumbnail.pl "%U"



    Writing Perl scripts:

    /usr/local/bin/mp4-image-to-thumbnail.pl
    Code:
    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    # perl modules
    use URI::Escape;
    use Digest::MD5 qw(md5_hex);
    use File::Copy;
    use Time::HiRes qw(usleep nanosleep);
    
    my @pictureSuffix = ( '*.png','*.jpg');
    
    my @kdeLocalprefix = ("kde4-config", '--localprefix');
    chomp(my $kdeHome = `@kdeLocalprefix`) or die "Can't find the kde home";
    
    my $ffmpegthumbsDir = $kdeHome . "share/apps/ffmpegthumbs-mattepaint/";
    my $attachmentsToThumbnail = $ffmpegthumbsDir . "cleanOne";
    my $createMissingdir = $ffmpegthumbsDir;
    my $parsleyDir = $createMissingdir . "AtomicParsley/";
    
    mkdir $createMissingdir;
    mkdir $parsleyDir;
    
    $ARGV[0] =~ s' /' //'g;
    my @fileNames = split(' /', $ARGV[0]);
    
    # extract attached cover to the ../ffmpegthumbs-mattepaint/cleanOne
    foreach my $name (@fileNames) {
       my $fullName = "file://" . $name;
       my $escapedName = uri_escape("$fullName", "^A-Za-z0-9\-\._~/:()&'");
       my $thumbName = md5_hex("$escapedName") . ".png";
      
       my @extractCall = ( "AtomicParsley", "$name", "-e", "$parsleyDir");
       system (@extractCall) == 0 or die "Can't execute the AtomicParsley";
       
       chdir $parsleyDir;
       my @globFiles = glob ("@pictureSuffix");
       print scalar @globFiles;
       if (scalar @globFiles == 0) { next; }
       copy ("$globFiles[0]", "$attachmentsToThumbnail") or die "Can't copy";
       unlink @globFiles;
    
    # remove old thumbnails
       unlink("$ENV{ HOME }/.thumbnails/large/$thumbName");
       unlink("$ENV{ HOME }/.thumbnails/normal/$thumbName");
    
    #  refresh/reload the filemanager window
       my @konquerors = `"qdbus" "org.kde.konqueror*"`;
       chomp (@konquerors);
       foreach my $member (@konquerors) { system ("qdbus $member /konqueror/MainWindow_1 activateAction reload 2>/dev/null"); }
    
       my @dolphins = `"qdbus" "org.kde.dolphin*"`;
       chomp (@dolphins);
       foreach my $member (@dolphins) { system ("qdbus $member /dolphin/Dolphin_1 activateAction reload 2>/dev/null"); }
    
    #  wait new thumbnail
       open( DUMP , ">/dev/null" );
       until ( -e "$ENV{ HOME }/.thumbnails/large/$thumbName" || -e  "$ENV{ HOME }/.thumbnails/normal/$thumbName" ) { 
          print DUMP "waiting thumbnail \n"; 
       }
       close (DUMP);
       usleep(5000);
    }
    and

    /usr/local/bin/mp4-pick-image-to-thumbnail.pl
    Code:
    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    # perl modules
    use URI::Escape;
    use Digest::MD5 qw(md5_hex);
    use File::Copy;
    use Time::HiRes qw(usleep nanosleep);
    
    my @pictureSuffix = ( '*.png','*.jpg');
    
    my @kdeLocalprefix = ("kde4-config", '--localprefix');
    chomp(my $kdeHome = `@kdeLocalprefix`) or die "Can't find the kde home";
    
    my $ffmpegthumbsDir = $kdeHome . "share/apps/ffmpegthumbs-mattepaint/";
    my $attachmentsToThumbnail = $ffmpegthumbsDir . "cleanOne";
    my $createMissingdir = $ffmpegthumbsDir;
    my $parsleyDir = $createMissingdir . "AtomicParsley/";
    
    mkdir $createMissingdir;
    mkdir $parsleyDir;
    
    $ARGV[0] =~ s' /' //'g;
    my @fileNames = split(' /', $ARGV[0]);
    
    # extract attached cover to the ../ffmpegthumbs-mattepaint/cleanOne
    foreach my $name (@fileNames) {
       my $fullName = "file://" . $name;
       my $escapedName = uri_escape("$fullName", "^A-Za-z0-9\-\._~/:()&'");
       my $thumbName = md5_hex("$escapedName") . ".png";
      
       my @extractCall = ( "AtomicParsley", "$name", "-e", "$parsleyDir");
       system (@extractCall) == 0 or die "Can't execute the AtomicParsley";
       
       chdir $parsleyDir;
       my @globFiles = glob ("@pictureSuffix");
       if (scalar @globFiles == 0) { next; }
       if (scalar @globFiles > 1 ){
          my $pickThumbnail = `"kdialog" "--getopenfilename" "$parsleyDir"`;
          chomp ($pickThumbnail);
          copy ("$pickThumbnail", "$attachmentsToThumbnail") or die "Can't copy";
       } else {
          copy ("$globFiles[0]", "$attachmentsToThumbnail") or die "Can't copy";
       }   
       unlink @globFiles;
    
    # remove old thumbnails
       unlink("$ENV{ HOME }/.thumbnails/large/$thumbName");
       unlink("$ENV{ HOME }/.thumbnails/normal/$thumbName");
       
    #  refresh/reload the filemanager window
       my @konquerors = `"qdbus" "org.kde.konqueror*"`;
       chomp (@konquerors);
       foreach my $member (@konquerors) { system ("qdbus $member /konqueror/MainWindow_1 activateAction reload 2>/dev/null"); }
    
       my @dolphins = `"qdbus" "org.kde.dolphin*"`;
       chomp (@dolphins);
       foreach my $member (@dolphins) { system ("qdbus $member /dolphin/Dolphin_1 activateAction reload 2>/dev/null"); }
    
    #  wait new thumbnail
       open( DUMP , ">/dev/null" );
       until ( -e "$ENV{ HOME }/.thumbnails/large/$thumbName" || -e  "$ENV{ HOME }/.thumbnails/normal/$thumbName" ) { 
          print DUMP "waiting thumbnail \n"; 
       }
       close (DUMP);
       usleep(5000);
    }
    Checking that the scripts are executable.

    Testing.



    Seems to work - at here.
    Last edited by Rog131; Oct 06, 2015, 08:52 AM.

    Leave a comment:


  • OneLine
    replied
    Plasmafication

    Linking: https://www.kubuntuforums.net/showth...l=1#post369248

    The service menu desktop - plasmafication.desktop:
    Code:
    [Desktop Entry]
    Type=Service
    X-KDE-ServiceTypes=KonqPopupMenu/Plugin
    MimeType=image/*;
    Actions=plasmaficationImage;removePlasmoid;
    X-KDE-Submenu=Plasmafication tools
    Icon=plasma
    
    [Desktop Action plasmaficationImage]
    Name=Plasmafication of Image
    Icon=preferences-desktop-plasma
    Exec=plasmafication.pl %f
    
    [Desktop Action removePlasmoid]
    Name=Remove plasmoid
    Icon=plasma
    Exec=plasmafication-remover.pl


    Few short scripts to make and remove the image plasmoids.

    plasmafication.pl :

    Installs a picture plasmoid so it can be added to the plasma 5 desktop.
    Code:
    #!/usr/bin/perl
    
    # argument: a picture with full path
    #
    # actions:
    # write icon picture to the ~/.local/share/icons/Plasmafication/
    # write metadata.desktop to the /tmp/...
    # write main.qml to the /tmp/...
    # execute the plasmapkg2 to install the plasmoid
    #
    # using:
    # perlmagick
    # kde-baseapps-bin (kdialog)
    
    use strict;
    use warnings;
    
    # modules
    use File::Basename;
    use Image::Magick;
    use File::Path qw(make_path);
    
    # replace whitespace with undescore
    my $image = $ARGV[0];
    my $imageName = fileparse($image,'\..*');
    my $spacelessName = $imageName;
    $spacelessName =~ s' '_'g;
    
    
    # icon
    my $newIcon;
    my $iconResolution = "128x128";
    my $iconPlace = "$ENV{ HOME }/.local/share/icons/Plasmafication";
    mkdir $iconPlace;
    my $iconOut = "$iconPlace/plasmafication.$spacelessName.png";
    
    $newIcon = Image::Magick->new;
    $newIcon->Read($image);
    $newIcon->Resize(geometry=>$iconResolution);
    $newIcon = $newIcon->Montage(geometry=>$iconResolution, background=>'transparent');
    $newIcon->Write($iconOut);
    
    
    # desktop
    my $temporary = "/tmp/plasmafication.$spacelessName";
    make_path("$temporary/plasmafication.$spacelessName/contents/ui");
    open(OUT, ">$temporary/plasmafication.$spacelessName/metadata.desktop");
    
    print OUT '[Desktop Entry]',"\n";
    print OUT 'Name=Picture Plasmoid',"\n";
    print OUT 'Comment=Show ',"$imageName","\n";
    print OUT 'Encoding=UTF-8',"\n";
    print OUT 'Icon=',"$ENV{ HOME }/.local/share/icons/Plasmafication/plasmafication.$spacelessName","\n";
    print OUT 'ServiceTypes=Plasma/Applet',"\n";
    print OUT 'Type=Service',"\n";
    print OUT 'X-KDE-PluginInfo-Name=','plasmafication',"\.","$spacelessName","\n";
    print OUT 'X-Plasma-API=declarativeappletscript',"\n";
    print OUT 'X-Plasma-MainScript=ui/main.qml',"\n";
    
    
    # main.qml
    open(OUT, ">$temporary/plasmafication.$spacelessName/contents/ui/main.qml");
    
    print OUT 'import QtQuick 2.0',"\n";
    print OUT "\n";
    print OUT 'Rectangle {',"\n";
    print OUT '    width: 300',"\n";
    print OUT '    height: 300',"\n";
    print OUT "\n";
    print OUT '    Image {',"\n";
    print OUT '        anchors.fill: parent',"\n";
    print OUT '        fillMode: Image.PreserveAspectFit',"\n";
    print OUT '        smooth: true',"\n";
    print OUT '        source:', "\"","$image","\"","\n";
    print OUT '    }',"\n";
    print OUT '}',"\n";
    
    
    # execute plasmapkg2 --install
    system ("plasmapkg2", "--install", "$temporary/plasmafication.$spacelessName");
    plasmafication-remover.pl - removes the picture plasmoid:
    Code:
    #!/usr/bin/perl
    
    # no arguments
    #
    # actions:
    # show file picker (kdialog) to pick the removed plasmoid
    # remove picked plasmoid
    # remove icon
    #
    # using:
    # kde-baseapps-bin (kdialog)
    
    use strict;
    use warnings;
    
    # modules
    use File::Basename;
    
    # picker
    my $iconPlace = "$ENV{ HOME }/.local/share/icons/Plasmafication";
    my $image = `"kdialog" '--getopenfilename' '$iconPlace' '*.png'`;
    chomp ($image);
    my $imageName = fileparse($image,'.png');
    
    # execute plasmapkg2 --remove
    system ("plasmapkg2", "--remove", "$imageName");
    
    # remove icon
    unlink($image);

    Leave a comment:

Users Viewing This Topic

Collapse

There are 0 users viewing this topic.

Working...
X