Xfce Forum

Sub domains
 

You are not logged in.

#1 2015-07-07 13:24:01

SenorSalad
Member
Registered: 2015-07-06
Posts: 12

Can I make a desktop application update its icon immediately?

I created a bash script which when executed as a desktop application modifies its own application icon. This is done by altering the Icon= line in the application's .desktop file.

Here is a gif of the application in action: http://gfycat.com/TepidThankfulHart. As you can tell, there is an approximately two second delay before the icon changes. I was wondering if there was a way of making the icon change immediately.

For completeness sake here is the script I am using:

#!/bin/bash

LAUNCHER=/home/alessandro/Scripts/wallpaper_cycle.desktop
PLAY_ICON=media-playback-start-symbolic
PAUSE_ICON=media-playback-pause-symbolic

if [ ! -z $(grep "Icon=$PLAY_ICON" $LAUNCHER) ]; then
   sed -i -e "s/Icon=$PLAY_ICON/Icon=$PAUSE_ICON/g" $LAUNCHER
elif [ ! -z $(grep "Icon=$PAUSE_ICON" $LAUNCHER) ]; then
   sed -i -e "s/Icon=$PAUSE_ICON/Icon=$PLAY_ICON/g" $LAUNCHER
fi

Last edited by SenorSalad (2015-07-07 18:32:21)

Offline

#2 2015-07-07 18:13:36

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,494

Re: Can I make a desktop application update its icon immediately?

What version of xfdesktop are you running?

Try forcing an xfdesktop reload at the end of the script:

xfdesktop --reload

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2015-07-07 18:35:41

SenorSalad
Member
Registered: 2015-07-06
Posts: 12

Re: Can I make a desktop application update its icon immediately?

I am running xfwm4 version 4.11.1git.22344d9 (revision 22344d9) for Xfce 4.10.

Unfortunately

xfdesktop --reload

does not help.

Offline

#4 2015-07-07 20:48:16

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,494

Re: Can I make a desktop application update its icon immediately?

What does the following return:

xfdesktop --help

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2015-07-07 20:54:23

SenorSalad
Member
Registered: 2015-07-06
Posts: 12

Re: Can I make a desktop application update its icon immediately?

Usage:
  xfdesktop [OPTION...] 

Help Options:
  -h, --help               Show help options
  --help-all               Show all help options
  --help-gtk               Show GTK+ Options
  --help-sm-client         Show session management options

Application Options:
  -V, --version            Display version information
  --reload                 Reload all settings, refresh image list
  --menu                   Pop up the menu (at the current mouse position)
  --windowlist             Pop up the window list (at the current mouse position)
  --arrange                Automatically arrange all the icons on the desktop
  --quit                   Cause xfdesktop to quit
  --display=DISPLAY        X display to use

Offline

#6 2015-07-08 18:14:55

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,494

Re: Can I make a desktop application update its icon immediately?

Well that confirms that the command is indeed "xfdesktop --reload". Sorry it didn't help.

It looks like xfdesktop uses glib's GFileMonitor to monitor file changes and call functions to deal with the changes. It may be that this is just how long the process takes on your system. I was hoping that forcing an xfdesktop reload might help. I am unaware of any setting that would speed up GLib's File Monitoring process.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2015-07-09 02:46:02

SenorSalad
Member
Registered: 2015-07-06
Posts: 12

Re: Can I make a desktop application update its icon immediately?

Thanks anyway Toz. I'll leave this thread open in case a wizard shows up with a solution, if that's all right with you.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.010 seconds, 7 queries executed - Memory usage: 545.09 KiB (Peak: 545.93 KiB) ]