Service Menu - Icon theme icon replacer
A point&right click icon replacer.
More: http://www.kubuntuforums.net/showthr...332#post289332
The desktop part
~/.kde/share/kde4/services/ServiceMenus/replaceicon.desktop /1/, /2/:
The Perl script part
~/.bin/iconreplacer.pl:
Notes
- Working at here. May or may not work at there
- Needs package: perlmagick
- More notifications: uncomment the lines 22, 44, 48, 49.
Links
1. http://www.freedesktop.org/wiki/Spec...top-entry-spec
2. http://techbase.kde.org/Development/..._Service_Menus
A point&right click icon replacer.
More: http://www.kubuntuforums.net/showthr...332#post289332
The desktop part
~/.kde/share/kde4/services/ServiceMenus/replaceicon.desktop /1/, /2/:
Code:
[Desktop Entry] Type=Service X-KDE-ServiceTypes=KonqPopupMenu/Plugin MimeType=image/png; Actions=replaceIconThemeIcon; [Desktop Action replaceIconThemeIcon] Name=Replace Icon Theme Icon Icon=tools-wizard.png Exec=perl ~/.bin/iconreplacer.pl %f
The Perl script part
~/.bin/iconreplacer.pl:
Code:
#!/usr/bin/perl # argument: icon name with the path # action: ask the new picture and replace the same context/name icons # with the correct resolution picture use strict; use warnings; # Modules use Image::Magick; my $showText = "Give the new picture"; my @RESOLUTIONS = ("8x8","16x16","22x22","32x32","48x48","64x64","128x128","256x256","512x512"); my @KONQUERORS = `"qdbus" "org.kde.konqueror*"`; chomp (@KONQUERORS); my @DOLPHINS = `"qdbus" "org.kde.dolphin*"`; chomp (@DOLPHINS); my ($newIcon, $resolution, $konqueror, $dolphin); #my (@writeLog); # split argument my @themePath = split('/', $ARGV[0]); my $fileName = pop(@themePath); my $iconContext = pop(@themePath); pop(@themePath); # get the new picture my $newPicture = `"kdialog" "--title" "$showText" "--getopenfilename" "." "*.png *.jpg *.gif"`; chomp ($newPicture); # write the new icons foreach $resolution (@RESOLUTIONS) { my $fileCandidate = join("/", @themePath) . "/" . $resolution . "/" . $iconContext . "/" . $fileName; if (-e $fileCandidate) { chomp($fileCandidate); $newIcon = Image::Magick->new; $newIcon->Read($newPicture); $newIcon->Resize(geometry=>$resolution); $newIcon->Write($fileCandidate); # push(@writeLog, $fileCandidate); } } #my @KDIALOGCALL = ("kdialog", "--msgbox", "@writeLog \n \n replaced with \n \n $newPicture"); #system @KDIALOGCALL; # refresh the konquerors and dolphins foreach $konqueror (@KONQUERORS) { system ("qdbus $konqueror /konqueror/MainWindow_1 activateAction reload 2>/dev/null"); } foreach $dolphin (@DOLPHINS) { system ("qdbus $dolphin /dolphin/Dolphin_1 activateAction reload 2>/dev/null"); }
- Working at here. May or may not work at there
- Needs package: perlmagick
- More notifications: uncomment the lines 22, 44, 48, 49.
Links
1. http://www.freedesktop.org/wiki/Spec...top-entry-spec
2. http://techbase.kde.org/Development/..._Service_Menus
Comment