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

Communicate to desktop folder view via bash?

Tags: None
(comma "," separated)
kdeforumsuser2010
Registered Member
Posts
59
Karma
0
OS
I have an icon in the Desktop Folder View. When clicked it executes a bash script. The "Type" is "desktop configuration file".

I want to dynamically change the icon in that bash script. I'm not sure what I can do here, but I want to either replace the icon with a new icon, or I want to change the current icon (i.e., desaturate, gray, colorize) --- some effect to show a change.

Do I use dbus or is there another way to communicate to the desktop folder view?

I've searched techbase, developer, userbase at kde.org, plus googled in general.

Suggestions, pointers would greatly be appreciated.

Thank you.
User avatar
Hans
Administrator
Posts
3304
Karma
24
OS
OK so you have a .desktop file. I'm not sure if this is the best way, but say that your file looks like this:

Code: Select all
[Desktop Entry]
Exec=path/to/myscript
Icon=myicon
Name=myscript
Type=Application


You could then make your script edit the line Icon=myicon to change the icon.

(I'm not very good with bash scripting and don't know how to do this. A more "hackish" way is to have two desktop files and two scripts like this:
a.desktop: executes script a
b.desktop: executes script b
script a: <do something> and copy b.desktop to the directory.
script b: <do something> and copy a.desktop to the directory.

The copied desktop files should have the same name and be placed in the directory your Folderview points to.

There should be much more elegant ways of doing this, but well, this is the only way I know).


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts
kdeforumsuser2010
Registered Member
Posts
59
Karma
0
OS
Thank you!

I got a similar suggestion to use sed to modify the icon= and then to get the Desktop Folder View to recognize the change and update, hide the file and unhide the file (mv file .file; mv .file file). I thought there might be a more "official" way to communicate, but hey, this will get the job done :-)


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot]