This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Change Folder icon Via Terminal

Tags: None
(comma "," separated)
laragoza
Registered Member
Posts
2
Karma
0
OS

Change Folder icon Via Terminal

Fri May 19, 2017 12:50 pm
i use lockit to lock & unlock folders. I would like to have the folder icon change to red when locked & green when unlocked. Any Help would be appreciated


[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/all;
Actions=lock;unlock;

[Desktop Action lock]
Name=Lock
Icon=object-locked
Exec=gksudo "chattr -R +i %U" && notify-send 'Folders Locked'; fi

[Desktop Action unlock]
Name=Unlock
Icon=object-unlocked
Exec=gksudo "chattr -R -i %U" && notify-send 'Folders Unlocked'; fi
User avatar
Zren
Registered Member
Posts
41
Karma
1
OS
If you manually set a folder icon it'll create a file called .directory with Icon=icon-name. Eg:

Code: Select all
[Desktop Entry]
Icon=folder-green


We can use kwriteconfig5 to set a value in an .ini/.desktop like file.

Code: Select all
kwriteconfig5 --file "%U/.directory" --group "Desktop Entry" --key "Icon" "folder-green"


With testing, dolphin will update the icon right away, but an icon on the desktop won't update. We might need to run another command telling plasma to refresh the desktop and/or file a bug report.


laragoza
Registered Member
Posts
2
Karma
0
OS

Re: Change Folder icon Via Terminal

Sat May 20, 2017 3:37 am
Zren wrote:If you manually set a folder icon it'll create a file called .directory with Icon=icon-name. Eg:

Code: Select all
[Desktop Entry]
Icon=folder-green


We can use kwriteconfig5 to set a value in an .ini/.desktop like file.

Code: Select all
kwriteconfig5 --file "%U/.directory" --group "Desktop Entry" --key "Icon" "folder-green"


With testing, dolphin will update the icon right away, but an icon on the desktop won't update. We might need to run another command telling plasma to refresh the desktop and/or file a bug report.



Worked perfect! thank you Very Much!


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]