Xfce Forum

Sub domains
 

You are not logged in.

#26 2018-12-30 22:28:21

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

Re: How to display icons from existing directory on a Desktop/Workspace

Hello and welcome.

Insert a line before line 28 (CURRENT_WORKSPACE=) that reads from the file and moves to that workspace:

wmctrl -s $(cat ~/.desk)

...and change ~/.desk to the actual file you are using. Note that this expects that there is only one character in that file, the number of the workspace starting from 0.

If you just move to that workspace before the logic starts it should all work out.


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

#27 2018-12-31 00:54:57

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

ToZ:

Thank you for the quick response.

That was one of the things that I tried but it doesn't work for me.  I used:

 wmctrl -s $(( $(cat ~/.config/xfce4/desktop/lastworkspace) -1 )) 

... which works if run in a standalone script.

Does your suggestion work on your system?

Interestingly, I tried putting <sleep 5> on the next line (in xfdeskicons) and that had the effect of starting up with workspace 1 but with the icons from lastworkspace.  Then everything was back to normal on switching workspaces.  Does that suggest anything?

Thanks,

Alan

Offline

#28 2018-12-31 02:21:14

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

Re: How to display icons from existing directory on a Desktop/Workspace

Try this version. It saves the current workspace to ~/.cache/.xfdeskicons when the script dies and restores it when it starts up again.

#!/bin/bash

#Name: 		xfdeskicons
#Version:	2 (saves and restores last workspace)
#Description: 	Displays a different set of icons on each workspace's desktop (corresponding to separate folders)
#Requires: 	wmctrl, xdg-user-dirs
#Debug mode:	bash -xv /path/to/xfdeskicons 2>&1 | tee xfdeskicons.log

declare -a WSPACE_ICONS_FOLDERS
### Set these values to the folders containing the icons for each workspace
WSPACE_ICONS_FOLDERS=(  "/home/toz/Desktop"
			"/home/toz/Pictures"
			"/home/toz/Downloads"
			"/home/toz/Development"
			"/home/toz/Music"    )

### Do not change anything below here

# make sure that only one instance of this script is running per user
lockfile=/tmp/.xfdeskicons.$USER.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
	trap 'rm -f "$lockfile"; echo $(($CURRENT_WORKSPACE-1)) > ~/.cache/.xfdeskicons; exit $?' INT TERM EXIT
	echo "xfdeskiconsDEBUG: Locking succeeded" >&2

	# on startup, get the latest real xfdesktop icon file
	ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)

	# on startup, set the CURRENT_WORKSPACE value & display correct icons
	CURRENT_WORKSPACE=$(cat ~/.cache/.xfdeskicons)

	# finalize preparations
	[[ "$CURRENT_WORKSPACE" == "" ]] && CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
	wmctrl -s $CURRENT_WORKSPACE
	xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($CURRENT_WORKSPACE-1))]}"
	cp ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
	pgrep xfdesktop || xfdesktop &

	# every second, query the active workspace number and if different from the previous one, send a notification
	while true
	do
		sleep 1
		NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))	
		if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then

			# save current icon layout
			cp ~/.config/xfce4/desktop/$ICON_FILE ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1))

			# using xdg-user-dirs-update, point $XDG_DESKTOP to the proper icon folder
			xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($NEW_WORKSPACE-1))]}"

			# reload xfdesktop to re-read values and display correct icon set
			ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)
			cp ~/.config/xfce4/desktop/icon.layout.$(($NEW_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
			kill -HUP $(pidof xfdesktop)

			# Save the new current workspace
			CURRENT_WORKSPACE=$NEW_WORKSPACE
		fi

		# restart xfdesktop if it dies
		pgrep xfdesktop || xfdesktop &

	done

# can't create lockfile - notify user and quit
else

	echo "xfdeskiconsDEBUG: Lock failed, check for existing process and/or lock file and delete - exiting." >&2
	exit 1

fi			

exit 0

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

#29 2019-01-01 17:58:57

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: How to display icons from existing directory on a Desktop/Workspace

A little faster version with xprop.

#!/bin/bash

#Name: 		xfdeskicons
#Version:	2.1 (saves and restores last workspace)
#Description: 	Displays a different set of icons on each workspace's desktop (corresponding to separate folders)
#Requires: 	wmctrl, xdg-user-dirs, xprop
#Debug mode:	bash -xv /path/to/xfdeskicons 2>&1 | tee xfdeskicons.log

declare -a WSPACE_ICONS_FOLDERS
### Set these values to the folders containing the icons for each workspace
WSPACE_ICONS_FOLDERS=(  "/home/misko/Desktop"
			"/home/misko/Pictures"
			"/home/misko/Downloads"
			"/home/misko/Development"
			"/home/misko/Music"    )

### Do not change anything below here

# make sure that only one instance of this script is running per user
lockfile=/tmp/.xfdeskicons.$USER.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
	trap 'rm -f "$lockfile"; echo $(($CURRENT_WORKSPACE-1)) > ~/.cache/.xfdeskicons; exit $?' INT TERM EXIT
	echo "xfdeskiconsDEBUG: Locking succeeded" >&2

	# on startup, get the latest real xfdesktop icon file
	ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)

	# on startup, set the CURRENT_WORKSPACE value & display correct icons
	CURRENT_WORKSPACE=$(cat ~/.cache/.xfdeskicons)

	# finalize preparations
	[[ "$CURRENT_WORKSPACE" == "" ]] && CURRENT_WORKSPACE=$(($(xprop -root -notype -f _NET_CURRENT_DESKTOP  32c ' $0\n'  _NET_CURRENT_DESKTOP | cut -d ' ' -f 2)+1))
	wmctrl -s $CURRENT_WORKSPACE
	xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($CURRENT_WORKSPACE-1))]}"
	cp ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
	pgrep xfdesktop || xfdesktop &

	# query the active workspace number and if different from the previous one, send a notification
	xprop -root -spy -notype -f _NET_CURRENT_DESKTOP  32c ' $0\n'  _NET_CURRENT_DESKTOP \
        | while read -r workspace
	do
		sleep 1
		NEW_WORKSPACE=$((${workspace: -1} +1))	
		if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then

			# save current icon layout
			cp ~/.config/xfce4/desktop/$ICON_FILE ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1))

			# using xdg-user-dirs-update, point $XDG_DESKTOP to the proper icon folder
			xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($NEW_WORKSPACE-1))]}"

			# reload xfdesktop to re-read values and display correct icon set
			ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)
			cp ~/.config/xfce4/desktop/icon.layout.$(($NEW_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
			kill -HUP $(pidof xfdesktop)

			# Save the new current workspace
			CURRENT_WORKSPACE=$NEW_WORKSPACE
		fi

		# restart xfdesktop if it dies
		pgrep xfdesktop || xfdesktop &

	done

# can't create lockfile - notify user and quit
else

	echo "xfdeskiconsDEBUG: Lock failed, check for existing process and/or lock file and delete - exiting." >&2
	exit 1

fi			

exit 0

I wonder if it's possible to run several xfdesktops in some isolated environments and switch between them.
I don't know much about linux conainers and if it's possible to use the files outside of containers.


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#30 2019-01-01 19:44:16

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

Re: How to display icons from existing directory on a Desktop/Workspace

Misko_2083 wrote:

A little faster version with xprop.

Cool. Thanks!

I wonder if it's possible to run several xfdesktops in some isolated environments and switch between them.
I don't know much about linux conainers and if it's possible to use the files outside of containers.

Interesting idea. Though I worry that the memory footprint would be much greater.


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

#31 2019-01-02 21:24:57

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: How to display icons from existing directory on a Desktop/Workspace

ToZ wrote:

Interesting idea. Though I worry that the memory footprint would be much greater.

It was a bad idea.
In essence, xfdesktop is undecorated, fullscreen, kept bellow Thunar window that tries to honors the panel struts, tries to remember the icon positions, and skips tasklist. It's much easier to open a few Thunar windows and keep them bellow than to open a few xfdesktops. smile

Last edited by Misko_2083 (2019-01-02 21:27:33)


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#32 2019-01-02 22:24:05

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

ToZ: Version 2 - (saves and restores last workspace)

I couldn't get it working (as specified) on either machine.

What happens on my slow machine on startup -
   1. the last workspace (4, say) starts with the right icons;
   2. then it switches to workspace 1 but with the icons of workspace 4;
   3. then it updates the icons to the workspace 1 icons.
After that, switching workspaces works as normal.

Try as I might (and I've tried a lot over the past few days), I haven't progressed any further.
It takes a relative long time to restart this machine!


On my very fast machine things seem to work differenly.  Irrespective of the last workspace on startup it goes straight to workspace 1 with workspace 1 icons.  Maybe all the action takes place before the desktop is rendered.
   
I have managed to get it working on the fast machine with the following code:

...  
	# on startup, get the latest real xfdesktop icon file
	ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)

	# on startup, set the CURRENT_WORKSPACE value & display correct icons
	CURRENT_WORKSPACE=$(cat ~/.cache/.xfdeskicons)

	# finalize preparations
	[[ "$CURRENT_WORKSPACE" == "" ]] && CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))

	wmctrl -s $CURRENT_WORKSPACE

#	xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($CURRENT_WORKSPACE-1))]}"
	xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($CURRENT_WORKSPACE))]}"
#	cp ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
	cp ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE)) ~/.config/xfce4/desktop/$ICON_FILE
	pgrep xfdesktop || xfdesktop &

   sleep 2
	wmctrl -s $CURRENT_WORKSPACE

	# every second, query the active workspace number and if different from the previous one, send a notification
...

It works but I'm not happy - it doesn't feel right - and it doesn't work on my slow machine.
What I would like (obviously) is one version which works on both machines.

As I said, I'm a relative newbie.  It seems to me that in the original code it is reverting to workspace 1 after the first "pgrep xfdesktop || xfdesktop".  This doesn't matter unless you want to startup with a specific workspace.  However, what do I know!

I'm hoping with the info above that you will be able to discern what is happening.

Thanks,

Alan

Last edited by acme (2019-01-02 22:25:35)

Offline

#33 2019-01-03 00:33:25

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

Re: How to display icons from existing directory on a Desktop/Workspace

Try commenting out the "pgrep xfdesktop | | xfdesktop &". The only reason I have it there is that sometimes on my system a "kill -HUP $(pidof xfdesktop)" command kills and doesn't HUP it but kills it instead. Maybe your system won't have the same issue.

Also try Misko's version - performance will be better.


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

#34 2019-01-04 17:05:27

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

ToZ:

Thank you for the suggestions.  I tried Misko's version without success.

I have done a lot of testing and I think that the script is working as intended.  What appears to be happening is that the workspace is being reset to workspace 1 by an external process while the script is in the "do loop".  I don't know what is to be done about that!

However:
- for my fast machine, if I insert a "sleep 1" after "#finalize preparations" then the last workspace with correct icons appears as required.  So, seemingly working ok.
- for my slow machine, it needs to be "sleep 3" but ... it starts with workspace 1 with the last workspace icons and after a few seconds it switches to the last workspace with the same (correct) icons. So, working after a fashion. 

It is not a big deal for the slow machine and is acceptable for practical purposes.

However, being a bit of a perfectionist I would still like it all to work properly.  So, any suggestions as to what I can do next would be welcome

Thanks,

Alan

Offline

#35 2019-01-04 17:36:18

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

Re: How to display icons from existing directory on a Desktop/Workspace

Maybe the script is starting up before the final desktop/window manager preparations are complete. If this is the case, then your sleep statements are the best solution.

Or if you wanted to remove any potential wasted time and automate it, add the following right after the "### Do not change anything below here" line:

# wait for xfdesktop and xfwm4 to start
while ! pidof xfwm4; do sleep 1; done
while ! pidof xfdesktop; do sleep 1; done

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

#36 2019-01-04 23:51:53

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

ToZ:

Thank you.  I've tested that code and both xfwm4 and xfdesktop have already started up by the time it is checked using the above code.

I wonder whether one of those processes is taking a long time, perhaps waiting for feedback from the graphics card, and then setting the workspace to 1.  This might explain the difference between my two machines in the required sleep time I've used in each.  However, the fast machine really shouldn't have that sort of problem.

Is there something I should be looking at in the code for xfwm4 and xfdesktop?  Are those the only two processes which might be causing my problem?

Thanks,

Alan

[Edited for typo]

Last edited by acme (2019-01-04 23:53:38)

Offline

#37 2019-01-05 00:19:30

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

Re: How to display icons from existing directory on a Desktop/Workspace

acme wrote:

Is there something I should be looking at in the code for xfwm4 and xfdesktop?  Are those the only two processes which might be causing my problem?

xfsettingsd might also be involved. Try checking for that process as well.


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

#38 2019-01-05 01:04:38

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

Toz:  "xfsettingsd might also be involved. Try checking for that process as well."

Adding xfsettingsd makes no difference.  As for the other two processes, it has already started.

I take it that your code works for you.  This seems to imply that my problem is specific to my setup(s).  If so, presumably it isn't a bug as such - and, even if it were, you could hardly find it if you can't reproduce my problem.  I'm about to get a new (very fast) laptop and so I could use my existing laptop to find the source of the problem.  However, it would take me a long time to set up and work it all out.

Any suggestions?

Thanks,

Alan

[Edited for typo]

Last edited by acme (2019-01-05 01:05:48)

Offline

#39 2019-01-05 03:07:44

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

Re: How to display icons from existing directory on a Desktop/Workspace

I've re-factored the code and tested it on Mint 18.3. It looks like it works for me, but I haven't tested it extensively. Try this new version:

#!/bin/bash

#Name: 		xfdeskicons
#Version:	2a (saves and restores last workspace)
#Description: 	Displays a different set of icons on each workspace's desktop (corresponding to separate folders)
#Requires: 	wmctrl, xdg-user-dirs
#Debug mode:	bash -xv /path/to/xfdeskicons 2>&1 | tee xfdeskicons.log

declare -a WSPACE_ICONS_FOLDERS
### Set these values to the folders containing the icons for each workspace
WSPACE_ICONS_FOLDERS=(  "/home/toz/Desktop"
			"/home/toz/Pictures"
			"/home/toz/Downloads"
			"/home/toz/Development"
			"/home/toz/Music"    )

### Do not change anything below here

# make sure that only one instance of this script is running per user
lockfile=/tmp/.xfdeskicons.$USER.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
	trap 'rm -f "$lockfile"; echo $(($CURRENT_WORKSPACE-1)) > ~/.cache/.xfdeskicons; exit $?' INT TERM EXIT
	echo "xfdeskiconsDEBUG: Locking succeeded" >&2

	# on startup, get the latest real xfdesktop icon file
	ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)

        # on startup, wait until main components are running and grab last saved workspace
        while ! pidof xfwm4; do sleep 1; done
        while ! pidof xfdesktop; do sleep 1; done
        while ! pidof xfsettingsd; do sleep 1; done
	CURRENT_WORKSPACE=$(cat ~/.cache/.xfdeskicons)

	# finalize preparations
        #    position to correct workspace if saved. or use current workspace
	if [ "$CURRENT_WORKSPACE" == "" ]; then
            CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
        else
        # set, save and re-read
    	    wmctrl -s $CURRENT_WORKSPACE
            xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($CURRENT_WORKSPACE-1))]}"
	    cp ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
            kill -HUP $(pidof xfdesktop)
        fi


	# every second, query the active workspace number and if different from the previous one, send a notification
	while true
	do
		sleep 1
		NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))	
		if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then

			# save current icon layout
			cp ~/.config/xfce4/desktop/$ICON_FILE ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1))

			# using xdg-user-dirs-update, point $XDG_DESKTOP to the proper icon folder
			xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($NEW_WORKSPACE-1))]}"

			# reload xfdesktop to re-read values and display correct icon set
			ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)
			cp ~/.config/xfce4/desktop/icon.layout.$(($NEW_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
			kill -HUP $(pidof xfdesktop)

			# Save the new current workspace
			CURRENT_WORKSPACE=$NEW_WORKSPACE
		fi

		# restart xfdesktop if it dies
		pgrep xfdesktop || xfdesktop &

	done

# can't create lockfile - notify user and quit
else

	echo "xfdeskiconsDEBUG: Lock failed, check for existing process and/or lock file and delete - exiting." >&2
	exit 1

fi			

exit 0

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

#40 2019-01-05 03:48:51

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

Toz:

Thank you.  Unfortunately it doesn't solve the problem on my fast machine.

However, I've had an idea which may help.  In testing I found that wmctrl -d doesn't return the usual output when the script starts, presumably because the initial set of workspaces have not been constructed at that time. If I first sleep the script sufficiently then wmctrl -d works as normal.  So, if we can make the script sleep until wmctrl-d does work, then maybe that would solve the problem, at least in terms of a good workaround.  What do you think?

Many thanks for all the work you have put into this - very much appreciated!

Alan

[Edited for typo - yet again!]

Last edited by acme (2019-01-05 03:50:00)

Offline

#41 2019-01-05 04:13:34

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

Re: How to display icons from existing directory on a Desktop/Workspace

acme wrote:

In testing I found that wmctrl -d doesn't return the usual output when the script starts,

Interesting find. Try this:

#!/bin/bash

#Name: 		xfdeskicons
#Version:	2a (saves and restores last workspace)
#Description: 	Displays a different set of icons on each workspace's desktop (corresponding to separate folders)
#Requires: 	wmctrl, xdg-user-dirs
#Debug mode:	bash -xv /path/to/xfdeskicons 2>&1 | tee xfdeskicons.log

declare -a WSPACE_ICONS_FOLDERS
### Set these values to the folders containing the icons for each workspace
WSPACE_ICONS_FOLDERS=(  "/home/toz/Desktop"
			"/home/toz/Pictures"
			"/home/toz/Downloads"
			"/home/toz/Development"
			"/home/toz/Music"    )

### Do not change anything below here

# make sure that only one instance of this script is running per user
lockfile=/tmp/.xfdeskicons.$USER.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
	trap 'rm -f "$lockfile"; echo $(($CURRENT_WORKSPACE-1)) > ~/.cache/.xfdeskicons; exit $?' INT TERM EXIT
	echo "xfdeskiconsDEBUG: Locking succeeded" >&2

	# on startup, get the latest real xfdesktop icon file
	ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)

        # on startup, wait until workspaces are created and grab last saved workspace
        while [[ $(wmctrl -d | wc -l) -eq 0 ]]; do sleep 1; done
	CURRENT_WORKSPACE=$(cat ~/.cache/.xfdeskicons)

	# finalize preparations
        #    position to correct workspace if saved. or use current workspace
	if [ "$CURRENT_WORKSPACE" == "" ]; then
            CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
        else
        # set, save and re-read
    	    wmctrl -s $CURRENT_WORKSPACE
            xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($CURRENT_WORKSPACE-1))]}"
	    cp ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
            kill -HUP $(pidof xfdesktop)
        fi

	# every second, query the active workspace number and if different from the previous one, send a notification
	while true
	do
		sleep 1
		NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))	
		if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then

			# save current icon layout
			cp ~/.config/xfce4/desktop/$ICON_FILE ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1))

			# using xdg-user-dirs-update, point $XDG_DESKTOP to the proper icon folder
			xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($NEW_WORKSPACE-1))]}"

			# reload xfdesktop to re-read values and display correct icon set
			ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)
			cp ~/.config/xfce4/desktop/icon.layout.$(($NEW_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
			kill -HUP $(pidof xfdesktop)

			# Save the new current workspace
			CURRENT_WORKSPACE=$NEW_WORKSPACE
		fi

		# restart xfdesktop if it dies
		pgrep xfdesktop || xfdesktop &

	done

# can't create lockfile - notify user and quit
else

	echo "xfdeskiconsDEBUG: Lock failed, check for existing process and/or lock file and delete - exiting." >&2
	exit 1

fi			

exit 0

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

#42 2019-01-05 20:45:31

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

ToZ:

Thank you.  This works on my fast machine, even if I reduce the sleeps (waiting for the workspaces to initialize) to .01 seconds.

However, on the slow machine, here is what happens:
(1) the workspaces get initialized
(2) the current workspace is successfully set to the last workspace (as shown by wmctrl -d)
(3) in the loop checking for a change of workspace, after 1.1 seconds the workspace changes to workspace 1

The change to workspace 1 in (3) takes place at least 2.1 seconds from the start due to the initial 1 second sleep.

How best to fix that?

Just wondering, what time zone are you in Canada?

Thanks,

Alan

Offline

#43 2019-01-05 22:40:47

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

Re: How to display icons from existing directory on a Desktop/Workspace

I live just outside Toronto - EST.

That's strange about the script on the old computer. It doesn't make sense. Here is a version of the last script with debug statements. Before logging in on the slow computer, set ~/.cache/.xfdeskicons to 2 then log in. Don't change the workspace at all and let the flip happen on its own. When it does, post back the contents of $HOME/xfdeskicons.log

#!/bin/bash

#Name: 		xfdeskicons
#Version:	2a (saves and restores last workspace)
#Description: 	Displays a different set of icons on each workspace's desktop (corresponding to separate folders)
#Requires: 	wmctrl, xdg-user-dirs
#Debug mode:	bash -xv /path/to/xfdeskicons 2>&1 | tee xfdeskicons.log

echo "1. start" > $HOME/xfdeskicons.log

declare -a WSPACE_ICONS_FOLDERS
### Set these values to the folders containing the icons for each workspace
WSPACE_ICONS_FOLDERS=(  "/home/toz/Desktop"
			"/home/toz/Pictures"
			"/home/toz/Downloads"
			"/home/toz/Development"
			"/home/toz/Music"    )

### Do not change anything below here

# make sure that only one instance of this script is running per user
lockfile=/tmp/.xfdeskicons.$USER.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
	trap 'rm -f "$lockfile"; echo $(($CURRENT_WORKSPACE-1)) > ~/.cache/.xfdeskicons; exit $?' INT TERM EXIT
	echo "xfdeskiconsDEBUG: Locking succeeded" >&2

	echo "2. lock enabled" >> $HOME/xfdeskicons.log

	# on startup, get the latest real xfdesktop icon file
	ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)

	echo "3. retrieved icon file"  >> $HOME/xfdeskicons.log

        # on startup, wait until workspaces are created and grab last saved workspace
        while [[ $(wmctrl -d | wc -l) -eq 0 ]]; do sleep 1; done
	CURRENT_WORKSPACE=$(cat ~/.cache/.xfdeskicons)

	echo "4. retrieved old workspace"  >> $HOME/xfdeskicons.log
	echo "4.1 OLD=$CURRENT_WORKSPACE" >> $HOME/xfdeskicons.log

	# finalize preparations
        #    position to correct workspace if saved. or use current workspace
	if [ "$CURRENT_WORKSPACE" == "" ]; then
				echo "5. no old workspace - use current"  >> $HOME/xfdeskicons.log
            CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
        else
        # set, save and re-read
			echo "6. got old workspace"  >> $HOME/xfdeskicons.log
    	    wmctrl -s $CURRENT_WORKSPACE
            xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($CURRENT_WORKSPACE-1))]}"
	    cp ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
            kill -HUP $(pidof xfdesktop)
        fi

	# every second, query the active workspace number and if different from the previous one, send a notification
	while true
	do
		echo "7. in loop"  >> $HOME/xfdeskicons.log
		echo "7.1 CURR=$CURRENT_WORKSPACE" >> $HOME/xfdeskicons.log
		sleep 1
		NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))	
		if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
			echo "8. new workspace identified" >> $HOME/xfdeskicons.log
			echo "8.1 NEW=$NEW_WORKSPACE" >> $HOME/xfdeskicons.log

			# save current icon layout
			cp ~/.config/xfce4/desktop/$ICON_FILE ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1))

			# using xdg-user-dirs-update, point $XDG_DESKTOP to the proper icon folder
			xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($NEW_WORKSPACE-1))]}"

			# reload xfdesktop to re-read values and display correct icon set
			ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)
			cp ~/.config/xfce4/desktop/icon.layout.$(($NEW_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
			kill -HUP $(pidof xfdesktop)

			# Save the new current workspace
			CURRENT_WORKSPACE=$NEW_WORKSPACE
		fi

		# restart xfdesktop if it dies
		pgrep xfdesktop || xfdesktop &

	done

# can't create lockfile - notify user and quit
else
	echo "9. error" >> $HOME/xfdeskicons.log
	echo "xfdeskiconsDEBUG: Lock failed, check for existing process and/or lock file and delete - exiting." >&2
	exit 1

fi			

exit 0

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

#44 2019-01-06 02:20:18

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

Toz:

Thank you - I was wondering how many hours you were behind me = 5 hours.

Here is the output from your test script:

1. start
2. lock enabled
3. retrieved icon file
4. retrieved old workspace
4.1 OLD=2
6. got old workspace
7. in loop
7.1 CURR=2
8. new workspace identified
8.1 NEW=3
7. in loop
7.1 CURR=3
8. new workspace identified
8.1 NEW=1
7. in loop
7.1 CURR=1
7. in loop
7.1 CURR=1
7. in loop
7.1 CURR=1
7. in loop
7.1 CURR=1
7. in loop
7.1 CURR=1
7. in loop
7.1 CURR=1
...

I think the most likely explanation of the problem is that the slow maschine is slow enough that it takes more than one second or so for the workspaces to fully initialize and, in particular, for xfdesktop (or maybe xfwm4) to set the initial workspace to be the first workspace. I imagine that the designer(s) never considered that someone might want to start up in a workspace other than the first and, consequently, forced the startup workspace to be the first.  If so, then provided you can set the last workspace after the forced first workspace is set then all is well if your maschine is fast enough.  But for a slow machine you would have to wait until the forced first workspace has been set before you can set the last workspace without the latter being subsequently changed.

If all that is the case, I wouldn't really describe it as a bug.  However, it would be nice if xfce were to allow a specific initial workspace to be set - but I can't see that happening!

Thanks,

Alan

Last edited by acme (2019-01-06 02:21:45)

Offline

#45 2019-01-06 02:57:15

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

Re: How to display icons from existing directory on a Desktop/Workspace

No worries - I enjoy challenges like these.

In the output that you provided, it says that the saved workspace was 2, which was loaded, then it jumped to 3 then 1. Did you make these workspace changes or did they change on their own?

But for a slow machine you would have to wait until the forced first workspace has been set before you can set the last workspace without the latter being subsequently changed.

Does it help if you change the "sleep 1" on the old system to "sleep 1.5" or "sleep 2"? Maybe give the process of switching to complete properly?

However, it would be nice if xfce were to allow a specific initial workspace to be set - but I can't see that happening!

You can always create an enhancement request at the bug tracker. See what the developer says.


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

#46 2019-01-06 03:45:16

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

In the output that you provided, it says that the saved workspace was 2, which was loaded, then it jumped to 3 then 1. Did you make these workspace changes or did they change on their own?"

Apart from substituting your workspaces with mine, I didn't make any changes to your test script nor changed workspaces while running the test - as you specified.  It looks like your code mishandles the workspace number at various points counting from 0 when it should be counting from 1, or maybe vice versa.


Does it help if you change the "sleep 1" on the old system to "sleep 1.5" or "sleep 2"? Maybe give the process of switching to complete properly?

I'll test some more and get back to you on this.


You can always create an enhancement request at the bug tracker. See what the developer says.

Well, it's an idea but I can't see that anyone would go to any trouble since no one has reported a problem until now.

Thanks,

Alan

Last edited by acme (2019-01-06 04:06:49)

Offline

#47 2019-01-06 04:27:13

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

Does it help if you change the "sleep 1" on the old system to "sleep 1.5" or "sleep 2"? Maybe give the process of switching to complete properly?

I'll test some more and get back to you on this.

I've done a quick test on the slow machine.  After  "finalize preps",  I put in a "sleep 2" and set (again) the last workspace.  I had to follow it up with another sleep (I used sleep 2) otherwise the current workspace didn't update quickly enough.  Using that, the machine started up correctly with the last workspace icons but in workspace 1, switching after one second or so to the last workspace.  Thus, essentially, that works albeit with workspace 1 intervening.

So, after "finalize preps" -
If:
1. I could speed up checking for the forced workspace 1, and
2. set the last workspace and speedily check that has be set
then hopefully workspace 1 wouldn't appear.

Any suggestions?

Thanks,

Alan

Offline

#48 2019-01-06 13:08:23

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

Re: How to display icons from existing directory on a Desktop/Workspace

A couple of additions to deal with  slow systems. Try this and post back the log file again:

#!/bin/bash

#Name: 		xfdeskicons
#Version:	2a (saves and restores last workspace)
#Description: 	Displays a different set of icons on each workspace's desktop (corresponding to separate folders)
#Requires: 	wmctrl, xdg-user-dirs
#Debug mode:	bash -xv /path/to/xfdeskicons 2>&1 | tee xfdeskicons.log

echo "1. start" > $HOME/xfdeskicons.log

declare -a WSPACE_ICONS_FOLDERS
### Set these values to the folders containing the icons for each workspace
WSPACE_ICONS_FOLDERS=(  "/home/toz/Desktop"
			"/home/toz/Pictures"
			"/home/toz/Downloads"
			"/home/toz/Development"
			"/home/toz/Music"    )

### Do not change anything below here

# wait for workspaces to initialize (for slow systems)
while [ $(wmctrl -d | wc -l) -ne $(xfconf-query -c xfwm4 -p /general/workspace_count) ]; do echo "1.5 wait" >> $HOME/xfdeskicons.log; sleep 1; done

# make sure that only one instance of this script is running per user
lockfile=/tmp/.xfdeskicons.$USER.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
	trap 'rm -f "$lockfile"; echo $(($CURRENT_WORKSPACE-1)) > ~/.cache/.xfdeskicons; exit $?' INT TERM EXIT
	echo "xfdeskiconsDEBUG: Locking succeeded" >&2

	echo "2. lock enabled" >> $HOME/xfdeskicons.log

	# on startup, get the latest real xfdesktop icon file
	ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)

	echo "3. retrieved icon file"  >> $HOME/xfdeskicons.log

        # on startup, wait until workspaces are created and grab last saved workspace
        while [[ $(wmctrl -d | wc -l) -eq 0 ]]; do sleep 1; done
	CURRENT_WORKSPACE=$(cat ~/.cache/.xfdeskicons)

	echo "4. retrieved old workspace"  >> $HOME/xfdeskicons.log
	echo "4.1 OLD=$CURRENT_WORKSPACE" >> $HOME/xfdeskicons.log

	# finalize preparations
        #    position to correct workspace if saved. or use current workspace
	if [ "$CURRENT_WORKSPACE" == "" ]; then
				echo "5. no old workspace - use current"  >> $HOME/xfdeskicons.log
            CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
        else
        # set, save and re-read
			echo "6. got old workspace"  >> $HOME/xfdeskicons.log
    	    wmctrl -s $CURRENT_WORKSPACE
	    while [ $(($(wmctrl -d | grep \* | cut -d' ' -f1)+1)) -ne $CURRENT_WORKSPACE ]; do sleep 1; done
            xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($CURRENT_WORKSPACE-1))]}"
	    cp ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
            kill -HUP $(pidof xfdesktop)
        fi

	# every second, query the active workspace number and if different from the previous one, send a notification
	while true
	do
		echo "7. in loop"  >> $HOME/xfdeskicons.log
		echo "7.1 CURR=$CURRENT_WORKSPACE" >> $HOME/xfdeskicons.log
		sleep 1
		NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))	
		if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
			echo "8. new workspace identified" >> $HOME/xfdeskicons.log
			echo "8.1 NEW=$NEW_WORKSPACE" >> $HOME/xfdeskicons.log

			# save current icon layout
			cp ~/.config/xfce4/desktop/$ICON_FILE ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1))

			# using xdg-user-dirs-update, point $XDG_DESKTOP to the proper icon folder
			xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($NEW_WORKSPACE-1))]}"

			# reload xfdesktop to re-read values and display correct icon set
			ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)
			cp ~/.config/xfce4/desktop/icon.layout.$(($NEW_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE
			kill -HUP $(pidof xfdesktop)

			# Save the new current workspace
			CURRENT_WORKSPACE=$NEW_WORKSPACE
		fi

		# restart xfdesktop if it dies
		pgrep xfdesktop || xfdesktop &

	done

# can't create lockfile - notify user and quit
else
	echo "9. error" >> $HOME/xfdeskicons.log
	echo "xfdeskiconsDEBUG: Lock failed, check for existing process and/or lock file and delete - exiting." >&2
	exit 1

fi			

exit 0

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

#49 2019-01-06 14:00:26

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

At startup: workspaces + icons as follows -
ws=1 + icons from ws=3
ws=3 + ditto
ws=1 + ditto
which happened pretty quickly compared to usual.

xfdeskicons.log output:

1. start
2. lock enabled
3. retrieved icon file
4. retrieved old workspace
4.1 OLD=2
6. got old workspace

Alan

Offline

#50 2019-01-06 22:07:25

acme
Member
From: London, England
Registered: 2018-12-30
Posts: 15

Re: How to display icons from existing directory on a Desktop/Workspace

ToZ:

The code below works - more or less - for my slow maschine.
Points to note:
1. I used a for-loop to wait for xfdesktop/xfwm4 to force the first workspace so that if the first workspace doesn't get forced then the loop terminates.
2. I've generally used short sleeps in order to make the script execute as fast as reasonably possible.
3. On a fast system, after setting a new workspace with wmctrl -s, it may be that an immediate wmctrl -d might not return a value showing the new current workspace.

Issue:
The correct last workspace and icons appear at startup but tt switches momentarily to the first workspace before switching back to the last workspace. This looks to be unavoidable with this code given that it is waiting for xfdesktop/xfwm4 to force the first workspace. However it is fleeting and not the end of the world.

#!/bin/bash

#Name: 		xfdeskicons
#Version:	2.x (saves and restores last workspace for slow machines)
#Description: 	Displays a different set of icons on each workspace's desktop (corresponding to separate folders)
#Requires: 	wmctrl, xdg-user-dirs
#Debug mode:	bash -xv /path/to/xfdeskicons 2>&1 | tee xfdeskicons.log

declare -a WSPACE_ICONS_FOLDERS
### Set these values to the folders containing the icons for each workspace
WSPACE_ICONS_FOLDERS=(  "/home/toz/Desktop"
			"/home/toz/Pictures"
			"/home/toz/Downloads"
			"/home/toz/Development"
			"/home/toz/Music"    )

### Do not change anything below here

# wait for xfdesktop and xfwm4 to start
while ! pidof xfwm4; do sleep .001; done
while ! pidof xfdesktop; do sleep .001; done

# make sure that only one instance of this script is running per user
lockfile=/tmp/.xfdeskicons.$USER.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
	trap 'rm -f "$lockfile"; echo $(($CURRENT_WORKSPACE-1)) > ~/.cache/.xfdeskicons; exit $?' INT TERM EXIT
	echo "xfdeskiconsDEBUG: Locking succeeded" >&2

	# wait for workspaces to initialize (for slow systems)
	while [ $(wmctrl -d | wc -l) -ne $(xfconf-query -c xfwm4 -p /general/workspace_count) ]; do sleep .01; done

	# on startup, get the latest real xfdesktop icon file
	ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)

	# on startup, set the LAST_WORKSPACE
	LAST_WORKSPACE=$(cat ~/.cache/.xfdeskicons)

	# wait until workspaces are created
   while [[ $(wmctrl -d | wc -l) -eq 0 ]]; do sleep .01; done

	# set LAST_WORKSPACE
	wmctrl -s $LAST_WORKSPACE

	# wait for xfdesktop/xfwm4 to reset workspace to the first workspace
	for value in {1..1000}
	do
		if [[ $(wmctrl -d | grep \* | cut -d' ' -f1) -eq "0" ]]; then break
		fi
		sleep .01
	done

	# reset LAST_WORKSPACE
	wmctrl -s $LAST_WORKSPACE

	xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($LAST_WORKSPACE))]}"
	cp ~/.config/xfce4/desktop/icon.layout.$LAST_WORKSPACE ~/.config/xfce4/desktop/$ICON_FILE
	pgrep xfdesktop || xfdesktop &
	
	# set CURRENT_WORKSPACE
   CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))

	# every second, query the active workspace number and if different from the previous one, send a notification
	while true
	do
		sleep .1

		NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))

		if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then

			# save current icon layout
			cp ~/.config/xfce4/desktop/$ICON_FILE ~/.config/xfce4/desktop/icon.layout.$(($CURRENT_WORKSPACE-1))

			# using xdg-user-dirs-update, point $XDG_DESKTOP to the proper icon folder
			xdg-user-dirs-update --set DESKTOP "${WSPACE_ICONS_FOLDERS[$(($NEW_WORKSPACE-1))]}"

			# reload xfdesktop to re-read values and display correct icon set
			ICON_FILE=$(ls -t ~/.config/xfce4/desktop | grep screen | head -1)
			cp ~/.config/xfce4/desktop/icon.layout.$(($NEW_WORKSPACE-1)) ~/.config/xfce4/desktop/$ICON_FILE

			kill -HUP $(pidof xfdesktop)

			# Save the new current workspace
			CURRENT_WORKSPACE=$NEW_WORKSPACE
		fi

		# restart xfdesktop if it dies
		pgrep xfdesktop || xfdesktop &

	done

# can't create lockfile - notify user and quit
else

	echo "xfdeskiconsDEBUG: Lock failed, check for existing process and/or lock file and delete - exiting." >&2
	exit 1

fi			

exit 0

Any further suggestions you might have would be very welcome.  I might look at the code for xfdesktop and xfwm4 as I have experience in C (and C++).  When I get my new laptop I will be using my slow one as a test machine.

Incidentally, I use 3 panels: on the bottom, lhs and rhs in that order. When I start up, the bottom and lhs appear (without icons) but rhs (panel 3) takes much longer to appear.  Is this normal?   

May I say that I wouldn't have got anywhere without the considerable help from you - thank you very much indeed!

Alan

Offline

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

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.013 seconds, 8 queries executed - Memory usage: 785.68 KiB (Peak: 850.52 KiB) ]