Xfce Forum

Sub domains
 

You are not logged in.

#1 2021-04-05 16:12:07

PseudAnonymous
Member
Registered: 2021-04-05
Posts: 42

[SOLVED] Workspace Number Applet

FEATURE REQUEST: An applet to display the number of the current workspace - I don't have room on my panel to display the Workspace Switcher, not even with buttons instead of the Miniature View. Nor do I have room for a second panel just for that purpose (I've only got 766px vertical).

All I really need is an a two-digit indicator to remind me which workspace I'm currently in - it'd take up much less room.

Last edited by PseudAnonymous (2021-04-06 12:30:34)


Don't dance like nobody's watching, dance like a toddler instead - they don't even care if there's any music!

Offline

#2 2021-04-05 18:32:13

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

Re: [SOLVED] Workspace Number Applet

You have a couple of options:

1. You can change the workspace switch to display buttons and change all of your workspace names to numbers (e.g. 1, 2, 3, etc). It will compress the space but if you have alot of workspaces, it will take up space.

2. If you just want the number (or name or both) of the current workspace only, add the xfce4-genmon-plugin to the panel. In the properties, uncheck the label option, change the font to suit if you want, set the cycle to 1 second and for the command, point to the following script:

#!/bin/bash

# requires wmctrl

CURRENT_DESKTOP=$(( $(wmctrl -d | grep "*" | awk '{print $1}') +1))
CURRENT_DESKTOP_NAME=$(xfconf-query -c xfwm4 -p /general/workspace_names |\
	tail -$(xfconf-query -c xfwm4 -p /general/workspace_count) |\
	awk -v i=$CURRENT_DESKTOP 'NR==i')

case $1 in
	number)
		echo "<txt> $CURRENT_DESKTOP </txt>"
		echo "<tool></tool>"
	;;
	name)
		echo "<txt> $CURRENT_DESKTOP_NAME </txt>"
		echo "<tool></tool>"		
	;;
	both)
		echo "<txt> $CURRENT_DESKTOP : $CURRENT_DESKTOP_NAME </txt>"
		echo "<tool></tool>"
	;;
esac

exit 0

...and make sure to make the script executable. For the Command entry in genmon's properties, you'll need to pass a parameter, one of "number", "name" or "both". So the command should be something like:

/path/to/script number

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 2021-04-05 23:25:32

PseudAnonymous
Member
Registered: 2021-04-05
Posts: 42

Re: [SOLVED] Workspace Number Applet

Fantastic!

As I said, I don't really have room on my panel to display the Workspace Switcher, not even with buttons instead of the Miniature View. I managed to squeeze it in, but (with eleven worskspaces), even that made for a very cramped panel: I have an entirely unreasonable number of applets (two System Load monitors, a CPU graph, eleven Disk Performance monitors, eleven Free Space checkers, two Network monitors, two Date/Time applets, a Status Tray, Notification plugin, volume control applet) - because I'm demanding/paranoid (delete according to taste).

So, this is  exactly the solution I was looking for!

Thankyou so much!



P.S. Is it significant that the delay be one second specifically?

Last edited by PseudAnonymous (2021-04-05 23:26:07)


Don't dance like nobody's watching, dance like a toddler instead - they don't even care if there's any music!

Offline

#4 2021-04-05 23:46:31

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

Re: [SOLVED] Workspace Number Applet

PseudAnonymous wrote:

P.S. Is it significant that the delay be one second specifically?

That's the cycle time - the script will be run every 1 second (in this case). The shorter the cycle the more responsive/accurate the result.


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

#5 2021-04-06 00:06:49

PseudAnonymous
Member
Registered: 2021-04-05
Posts: 42

Re: [SOLVED] Workspace Number Applet

Thanks.

0.25 it is then smile


Don't dance like nobody's watching, dance like a toddler instead - they don't even care if there's any music!

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, 7 queries executed - Memory usage: 547.96 KiB (Peak: 548.8 KiB) ]