# path that includes directories of launchers and their corresponding configuration files
launchers_path="/home/USERNAME/.config/xfce4/panel"
# name of the launcher that you want to update
launcher_name="MyLauncher"
# loop over each launcher configuration file that contains the name of the launcher to update
for launcher in $(grep -rl $launcher_name $launchers_path); do
# using sed to replace "favicon.ico" by the same name in order to edit the file and force xfce4-panel to refresh the launcher
sed -i 's/favicon.ico/favicon.ico/g' $launchers_path/$launcher
done
1条答案
按热度按时间2guxujil1#
经过几天的搜索,我发现了一个解决方案,强制xfce 4面板刷新图标而不重新启动它。解决方案涉及编辑xfce 4面板启动器的配置文件。通过修改文件,xfce 4-panel识别出已经进行了更改,并刷新启动器,包括相关的图标。
所以我在脚本中集成的代码如下:
在阅读这个解决方案时,很自然地发现自己会问一些问题:
原因是启动器的文件夹被命名为“启动器-N”,其中“N”表示启动器的编号,可能指示每个启动器的创建顺序。为了确保准确性,我选择遍历包含我想要更新的启动器名称的每个配置文件,以便找到相应的配置文件。
在我的特殊情况下,文件“favicon.ico”在第一个脚本中被替换。因此,我采用的解决方法是简单地编辑文件并通过xfce 4-panel触发启动器图像的刷新。在您的示例中,您可以使用新映像的路径或名称。
其他信息:
在此解决方案之前,我尝试使用
touch configuration_file
命令更新文件的日期并强制刷新,但没有成功。