Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-11-27 17:37:06

tolis0
Member
Registered: 2022-11-27
Posts: 2

Placing desktop icons from script

I am looking for a more reliable way to place icons in a specific location on the desktop.
So far I've tried editing the file icons.screen.latest.rc in ~/.config/xfce4/desktop/ with cp, but it doesn't always work.
I've also tried using rm on it first in case it needs confirmation to copy.

rm ~/.config/xfce4/desktop/icons.screen.latest.rc && \
cp ~/desktop-stuff/def-icons.rc ~/.config/xfce4/desktop/icons.screen.latest.rc

I don't know what the other files in this directory are for exactly (e.g. icons.screen0-1904x1026.rc) but some of them are accurate and some have older data.
I also checked xfconf-query but seems like it doesn't have this option.
Is there any program that can accurately do this? Am I missing something?

Offline

#2 2022-11-27 18:20:05

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

Re: Placing desktop icons from script

Hello and welcome

tolis0 wrote:

I am looking for a more reliable way to place icons in a specific location on the desktop.
So far I've tried editing the file icons.screen.latest.rc in ~/.config/xfce4/desktop/ with cp, but it doesn't always work.

The only real way to do this is to quit and restart xfdesktop:

xfdesktop -Q && xfdesktop &

...but this might flicker your desktop as the wallpaper is loaded. It will, however, re-read the icon config file and place the icons as indicated in the file.

I don't know what the other files in this directory are for exactly (e.g. icons.screen0-1904x1026.rc) but some of them are accurate and some have older data.
I also checked xfconf-query but seems like it doesn't have this option.

xfdesktop basically computes the available desktop real-estate (full resolution minus dimensions of panels) to use for icon placement. It can create numerous files depending on when xfdesktop is run vs the panel, if you're adding/removing panels, or if your video driver resizes the desktop during initiation. The latest file is the current file.

Is there any program that can accurately do this? Am I missing something?

Unfortunately no. You could create an enhancement request for a parameter to re-read icon placement information. Currently there is an "-A' parameter that arranges icons - you are looking for a way to re-read the changed configuration file.


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 2022-11-28 00:16:00

tolis0
Member
Registered: 2022-11-27
Posts: 2

Re: Placing desktop icons from script

Thank you for your reply

ToZ wrote:

The only real way to do this is to quit and restart xfdesktop:

xfdesktop -Q && xfdesktop &

...but this might flicker your desktop as the wallpaper is loaded. It will, however, re-read the icon config file and place the icons as indicated in the file.

I tried this with

cat ~/desktop-stuff/def-icons.rc > ~/.config/xfce4/desktop/icons.screen.latest.rc

and it does work if I do it manually although the screen becomes black for a split second. If I do it on the script though it doesn't work. Ctr+r also works manually.

I was testing while writing this reply and found out that if I remove some line from the script, cp seems to be working fine by itself (although it's still buggy):

xfconf-query -c xfce4-desktop -p /desktop-icons/icon-size -s 42

Even though the settings are made for size 42 and it was already that size (so this line didn't do anything), it still created problems somehow.

Offline

#4 2022-11-28 01:10:29

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

Re: Placing desktop icons from script

You should note that the icons.screen.latest.rc file is a link to one of the other rc files - it identifies the active file. You should replace the active file. For example, the following script works on my system:

#!/bin/bash

BKFILE=/home/toz/xfdesktop.icons.rc

FILE=$(ls -l ~/.config/xfce4/desktop/icons.screen.latest.rc  | awk '{print $11}')

cp $BKFILE $FILE
xfdesktop -Q && xfdesktop &

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

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

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.012 seconds, 7 queries executed - Memory usage: 534.36 KiB (Peak: 535.2 KiB) ]