Change Icon with bash / docky

Forum rules
Before you post please read this

Change Icon with bash / docky

Postby bulsatar on Sun Nov 17, 2013 11:20 am

Morning Everyone,

I am attempting to do an "on click" icon change in a bash script. The icon is for a launcher for the bash script that is being toggled on docky. I would like the icon on docky to change according to if Motion is on or not. The program starts/stops fine, but no icon change. any help is greatly appreciated!

Code: Select all
#!/bin/bash

if [ "$(pidof motion)" ]
  then
sudo /etc/init.d/motion stop

gvfs-set-attribute -t string /home/<user>/.local/share/applications/motion metadata::custom-icon file:///home/<user>/Pictures/MotionOff.png

sleep 3

xte "key F5"

else

sudo /etc/init.d/motion start

gvfs-set-attribute -t string /home/<user>/.local/share/applications/motion metadata::custom-icon file:///home/<user>/Pictures/MotionOn.png

sleep 3

xte "key F5"
fi


gvfs...code found here for reference: http://askubuntu.com/questions/217757/how-can-i-programmatically-change-a-files-icon
bulsatar
Level 1
Level 1
 
Posts: 47
Joined: Sun May 26, 2013 1:05 am

Linux Mint is funded by ads and donations.
 

Re: Change Icon with bash / docky

Postby bulsatar on Sun Nov 17, 2013 10:49 pm

Got the change to work in the folder by using code to copy over the .desktop file of the launcher I setup. However this never translated over to docky. My guess is that there is no command to give docky to refresh the icons without shutting down and restarting it.

I just wanted a visual to remind me that Motion was running so....instead I just used a command to open firefox to the 8081 port on the localhost (see http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionGuide) so the stream would popup and kill it when it closes thru the script. Will be throwing in some other checks to make sure every angle is covered but that is the solution I came up with. Not really solved, but figured out something else :D
bulsatar
Level 1
Level 1
 
Posts: 47
Joined: Sun May 26, 2013 1:05 am


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 1 guest