Xfce Forum

Sub domains
 

You are not logged in.

#51 2019-01-07 07:50:14

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

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

You can force the last workspace.

until [ $(xprop -root _NET_CURRENT_DESKTOP | cut -d' ' -f3) -eq "$LAST_WORKSPACE" ]; do
     wmctrl -s $LAST_WORKSPACE
     sleep 1
done

Prints the current workspace (-1 because it starts from 0)

xprop -root _NET_CURRENT_DESKTOP  | cut -d ' ' -f 3

Prints number of workspaces

xprop -root _NET_NUMBER_OF_DESKTOPS | cut -d ' ' -f 3

Offline

#52 2019-01-07 22: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

Misko:

Thank you for the useful code.

On my slow machine, in my version of the script, LAST_WORKSPACE is set successful initially but, certainly to my surprise, some other process (xfdesktop or xfwm4 or maybe xfsettingsd?) forceably changes the workspace to the first workspace after about 1.3 seconds.  So I have to wait until that happens before changing back to LAST_WORKSPACE.  My code still works if LAST_WORKSPACE is actually is the first workspace.

This problem does not occur on my (very) fast machine, possibly (probably?) because the forced change to the first workspace takes place very quickly.  So I think that my version is only suitable for a slow machine.  On my fast machine I use ToZ's solution #41 above.

I don't suppose that there are many people using slow machines although xfce, being very lightweight, is especially suitable for old machines.  So it wouldn't be a bad idea to enhance the underlying code so that on startup the last workspace could be selected. If you have any suggestions as to where the underlying problem lies then please let me know. As I've said above, I don't think there is much incentive to make this 'enhancement' as I don't suppose anybody has previously mentioned starting up with the last workspace in all these years!

Thank you Misko and, again, many thanks to ToZ who has done an amazing job!

Alan

Offline

#53 2019-01-07 23:34:36

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

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

acme wrote:

Misko:
On my slow machine, in my version of the script, LAST_WORKSPACE is set successful initially but, certainly to my surprise, some other process (xfdesktop or xfwm4 or maybe xfsettingsd?) forceably changes the workspace to the first workspace after about 1.3 seconds.  So I have to wait until that happens before changing back to LAST_WORKSPACE.  My code still works if LAST_WORKSPACE is actually is the first workspace.

xprop has an option to spy on wm hints forever.

xprop -spy -root _NET_CURRENT_DESKTOP

If you run this in terminal and switch workspaces you'll see that this prints out the current workspace.

You could wait for this change to occur like this:

xprop -spy -root _NET_CURRENT_DESKTOP | read

when it does the script will continue.

The problem is when it doesn't happen the script will be stuck.
You can use timeout to handle this

timeout 3 xprop -spy -root _NET_CURRENT_DESKTOP | read

If workspace doesn't change in 3 seconds timeout will kill the command and the script will continue.

Offline

#54 2019-01-08 16:37:20

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

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

Misko:

That works well and is more succinct.

Thanks you,

Alan

Offline

Board footer

Powered by FluxBB