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

Make icon change depending on status

Tags: None
(comma "," separated)
throbscottle
Registered Member
Posts
2
Karma
0
First post here!
I want to make an icon which changes depending on whether a program is running or not (Windscribe VPN). I made a little script which toggles the program, which runs from one icon, but then I had to make another one to test if it is running or not!
Here's my toggle script:
Code: Select all
#!/bin/bash
# detect if Windscribe is connected
# connect if it's disconnected, disconnect if it's connected
if [ "$(windscribe status|grep CONNECTED)" = "DISCONNECTED" ];
then
kdialog --msgbox "Connecting Windscribe VPN"
windscribe connect;
else
kdialog --msgbox "Disconnecting Windscribe VPN"
windscribe disconnect;
fi
#make some way to change icon instead


What I'd really like is to have icon change to show the status, like the wastebin does.

Can anyone suggest a way to do this?
User avatar
raphaelra
Registered Member
Posts
209
Karma
0
OS
Wellcome :)

If I understand you correctly, you created an icon on your desktop and toggle Windscribe with doubleclick on it ?
If so, each desktop icon has a *.desktop file (in ~/Desktop). This file has an entry for the icon. The value for icon can be changed with kwriteconfig5 tool.
Code: Select all
kwriteconfig5 --file ~/Desktop/<windscribe>.desktop --group "Desktop Entry" --key Icon <icon_name>
Use this in your script after windscript connect/disconnect with <icon_name> of your choice.
throbscottle
Registered Member
Posts
2
Karma
0
That's great, it works (after I finally managed to key it in correctly...)
Thank you very much :)
Also used it to change the comment so I get a tooltip saying whether it's connected or not :)


Bookmarks



Who is online

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