Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-12-28 09:21:28

mg64ve
Member
Registered: 2020-12-28
Posts: 7

(SOLVED) showing workspace name when switching

Hello,

when switching from one workspace to another is it possible to shortly display the new workspace name for few seconds?
It would be helpfull to  understand in what workspace you are.
Thanks.

Last edited by mg64ve (2020-12-28 12:40:06)

Offline

#2 2020-12-28 11:21:42

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

Re: (SOLVED) showing workspace name when switching

Hello and welcome.

Yes, it is possible by using a script that monitors the current workspace, and if it changes, issue a notification. See here for a script that I have used in the past.


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 2020-12-28 12:12:21

mg64ve
Member
Registered: 2020-12-28
Posts: 7

Re: (SOLVED) showing workspace name when switching

Thanks for your reply.
It is really very nice that XFCE can be customized with scripts.
However I don't understand where to save this script, with what name and how can it be activated? Shall I change any XFCE configuration file?

Offline

#4 2020-12-28 12:39:11

mg64ve
Member
Registered: 2020-12-28
Posts: 7

Re: (SOLVED) showing workspace name when switching

Now I understand.
Just put in home directory and add to startup applications.
Thanks

Offline

#5 2021-03-15 00:15:55

Janvitus
Member
Registered: 2021-03-13
Posts: 11

Re: (SOLVED) showing workspace name when switching

ToZ wrote:

Hello and welcome.

Yes, it is possible by using a script that monitors the current workspace, and if it changes, issue a notification. See here for a script that I have used in the past.

Sorry, but don't work:

17: Syntax error: "(" unexpected (expecting "fi")

I know the thread is solved, but I can ask if there is a way to see a desktop previews (or thumbnails) when scroll through the workspaces (gnome-like)?

Last edited by Janvitus (2021-03-15 00:19:17)


Xfce 4.16 / Xubuntu 21.10

Offline

#6 2021-03-15 00:53:55

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

Re: (SOLVED) showing workspace name when switching

Janvitus wrote:

Sorry, but don't work:

17: Syntax error: "(" unexpected (expecting "fi")

Its still working here. Line 17 gets the workspace names. What happens when you run the command directly:

xfconf-query -c xfwm4 -p /general/workspace_names

Can you post back the full content of the script that you are using? Maybe the error is elsewhere.

I know the thread is solved, but I can ask if there is a way to see a desktop previews (or thumbnails) when scroll through the workspaces (gnome-like)?

Does xfdashboard fit the bill?


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 2021-03-15 12:04:31

Janvitus
Member
Registered: 2021-03-13
Posts: 11

Re: (SOLVED) showing workspace name when switching

ToZ wrote:
Janvitus wrote:

Sorry, but don't work:

17: Syntax error: "(" unexpected (expecting "fi")

Its still working here. Line 17 gets the workspace names. What happens when you run the command directly:

xfconf-query -c xfwm4 -p /general/workspace_names
xfconf-query -c xfwm4 -p /general/workspace_names
Il valore è un array con 4 elementi:

Spazio di lavoro 1
Spazio di lavoro 2
Spazio di lavoro 3
Spazio di lavoro 4

Can you post back the full content of the script that you are using? Maybe the error is elsewhere.

It's identical to yours, i've no changed anything.

#!/bin/sh

#Name: 		wsp_notify
#Description: 	Using notify-send, pop-up the current workspace number when changing workspaces
#Requires: 	xfce4-notifyd, libnotify, wmctrl
#Debug mode:	bash -xv /path/to/wsp_notify 2>&1 | tee wsp_notify.log

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

  	# on startup, set the CURRENT_WORKSPACE value
  	CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
  	# get the workspace names (starts at index 2)
	NAMES=(`xfconf-query -c xfwm4 -p /general/workspace_names | grep -v "Value is an array"`)

  	# 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))	
		NEW_WORKSPACE_NAME="${NAMES[$(($NEW_WORKSPACE-1))]}"
		if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
		
		    notify-send -t 5 "$(echo Workspace | sed -e :a -e 's/^.\{1,10\}$/ & /;ta')" "<b><span font='110'>$NEW_WORKSPACE</span></b>\n<i>$(echo $NEW_WORKSPACE_NAME | sed -e :a -e 's/^.\{1,17\}$/ & /;ta')</i>"
			
			CURRENT_WORKSPACE=$NEW_WORKSPACE
		fi
	done

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

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

exit 0

I know the thread is solved, but I can ask if there is a way to see a desktop previews (or thumbnails) when scroll through the workspaces (gnome-like)?

Does xfdashboard fit the bill?

I mean like this:
https://i.stack.imgur.com/9uF2C.jpg
https://ubuntu-mate.community/uploads/d … 0x431.jpeg

Or better like the old gnome 2: https://ubuntu-mate.community/uploads/d … 0x431.jpeg

I've find this, but.... https://askubuntu.com/questions/15971/g … ch-in-xfce

Thanks.

Last edited by Janvitus (2021-03-15 12:05:19)


Xfce 4.16 / Xubuntu 21.10

Offline

#8 2021-03-15 15:40:56

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

Re: (SOLVED) showing workspace name when switching

Janvitus wrote:

It's identical to yours, i've no changed anything.

I've noticed that the script doesn't handle workspaces with names. It shouldn't cause the problem you are seeing, but can you try this updated code to see if it helps:

#!/bin/sh

#Name: 		    wsp_notify
#Description: 	Using notify-send, pop-up the current workspace number when changing workspaces
#Requires: 	    xfce4-notifyd, libnotify, wmctrl
#Debug mode:	bash -xv /path/to/wsp_notify 2>&1 | tee wsp_notify.log

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

  	# on startup, set the CURRENT_WORKSPACE value
  	CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
  	# get the workspace names (starts at index 2)
	#NAMES=(`xfconf-query -c xfwm4 -p /general/workspace_names | grep -v 'Value is an array'`)
	c=0
	while read line; do 
	    NAMES[$c]=$line
	    ((c=c+1)) 
	done <<< $(xfconf-query -c xfwm4 -p /general/workspace_names | grep -v 'Value is an array' | grep -v ^$)


  	# 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))	
		NEW_WORKSPACE_NAME="${NAMES[$(($NEW_WORKSPACE-1))]}"
		if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
		
		    notify-send -t 5 "$(echo Workspace | sed -e :a -e 's/^.\{1,10\}$/ & /;ta')" "<b><span font='110'>$NEW_WORKSPACE</span></b>\n<i>$(echo $NEW_WORKSPACE_NAME | sed -e :a -e 's/^.\{1,17\}$/ & /;ta')</i>"
			
			CURRENT_WORKSPACE=$NEW_WORKSPACE
		fi
	done

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

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

exit 0

...and if that still doesn't work, can you run it like this:

bash -x /path/to/script > w.log 2>&1

...where "/path/to/script" is the actual path to the script and post back the contents of w.log.

Are you looking for previews in the Alt-Tab dialog? If so, make sure that "Cycle through windows in a list"is unchecked at Settings Manager > Window Manager Tweaks > Cycling tab.


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

#9 2021-03-16 17:48:28

Janvitus
Member
Registered: 2021-03-13
Posts: 11

Re: (SOLVED) showing workspace name when switching

ToZ wrote:

It's identical to yours, i've no changed anything.
I've noticed that the script doesn't handle workspaces with names. It shouldn't cause the problem you are seeing, but can you try this updated code to see if it helps:

Ok, now works, tnx.

Are you looking for previews in the Alt-Tab dialog? If so, make sure that "Cycle through windows in a list"is unchecked at Settings Manager > Window Manager Tweaks > Cycling tab.

I know alt+tab but it's not the same, thanks anyway. I'll try xfdashboard wink

Last edited by Janvitus (2021-03-16 17:50:20)


Xfce 4.16 / Xubuntu 21.10

Offline

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

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 8 queries executed - Memory usage: 585.32 KiB (Peak: 602.16 KiB) ]