Originally posted by chimak111
View Post
VINNY
[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
[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
MimeType=application/octet-stream
MimeType=all/all
#!/bin/sh export EDITOR=/usr/bin/kate export SUDO_ASKPASS=/usr/local/bin/sudoeditpass.sh sudoedit -A "$1"
#!/bin/sh kdialog --password 'sudoedit needs user (sudo) password to execute the kate'
[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"

$ locate servicemenu.knsrc
kdesudo kate /etc/xdg/servicemenu.knsrc
ProvidersUrl=http://download.kde.org/khotnewstuff/servicemenu-providers.xml
ProvidersUrl=http://download.kde.org/ocs/providers.xml Categories=Dolphin Service Menus
$ locate servicemenudeinstallation
FileUtils.rm(`kde4-config --localprefix`.strip! + "share/kde4/services/ServiceMenus/" + File.basename(archive))
FileUtils.rm(`qtpaths --writable-path GenericDataLocation`.strip! + "/kservices5/ServiceMenus/" + File.basename(archive))
$ locate servicemenuinstallation
$servicedir = `kde4-config --localprefix`.strip! + "share/kde4/services/ServiceMenus/"
$servicedir = `qtpaths --writable-path GenericDataLocation`.strip! + "/kservices5/ServiceMenus/"
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.[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"

#!/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);
}
#!/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);
}

[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

#!/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");
#!/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);
There are 0 users viewing this topic.
Leave a comment: