You are not logged in.

#1 2014-01-16 17:08:36

webdawg
Member
Registered: 2010-12-28
Posts: 62

XFCE - Switching Desktops - Show me the desktop!!! (Like The Money)

I have a bunch of desktops and I would like the desktop number to flash up when I switch to it with my shortcut keys.  Anyone have any reccomendations?

Offline

#2 2014-01-16 17:25:08

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: XFCE - Switching Desktops - Show me the desktop!!! (Like The Money)

conky can show you your current desktop... But it's probably not what you were expecting. hmm

Offline

#3 2014-01-16 18:52:49

webdawg
Member
Registered: 2010-12-28
Posts: 62

Re: XFCE - Switching Desktops - Show me the desktop!!! (Like The Money)

Not exactly but I have it configured and running to list the desktops.

I was really looking for a large flash just to remind me what desktop I am on.

This is what I did so far:  http://wiki.hackspherelabs.com/index.php?title=Conky

Can you make conky appear and dissappear?

Last edited by webdawg (2014-01-16 18:53:13)

Offline

#4 2014-01-16 19:00:44

toz
Member
Registered: 2011-10-28
Posts: 498

Re: XFCE - Switching Desktops - Show me the desktop!!! (Like The Money)

How about using notify-send and a script like:

#!/bin/bash
#Description: Using notify-send, pop-up the current workspace number when changing workspaces
#Requires: xfce4-notifyd, libnotify, wmctrl

CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
while true
do
	sleep 1
	NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))	
	if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
		notify-send " workspace" "<b><span font='100'>$NEW_WORKSPACE</span></b>"
		CURRENT_WORKSPACE=$NEW_WORKSPACE
	fi
done
exit 0

Offline

#5 2014-01-16 19:06:35

webdawg
Member
Registered: 2010-12-28
Posts: 62

Re: XFCE - Switching Desktops - Show me the desktop!!! (Like The Money)

I like it man.  I will test that too.

Offline

#6 2014-01-16 19:13:13

webdawg
Member
Registered: 2010-12-28
Posts: 62

Re: XFCE - Switching Desktops - Show me the desktop!!! (Like The Money)

Works awsome too.  I added the timeout:

#!/bin/bash
#Description: Using notify-send, pop-up the current workspace number when changing workspaces
#Requires: xfce4-notifyd, libnotify, wmctrl

CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
while true
do
        sleep 1
        NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
        if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
                notify-send -t 500 " workspace" "<b><span font='100'>$NEW_WORKSPACE</span></b>"
                CURRENT_WORKSPACE=$NEW_WORKSPACE
        fi
done
exit 0

You know of anyway to have xfce send the notification?  This still works great.

Offline

#7 2014-01-16 20:54:03

toz
Member
Registered: 2011-10-28
Posts: 498

Re: XFCE - Switching Desktops - Show me the desktop!!! (Like The Money)

webdawg wrote:

You know of anyway to have xfce send the notification?

Unfortunately no. I don't think the code base supports it. You can always create an enhancement request if you want at https://bugzilla.xfce.org/.

Offline

#8 2014-01-17 18:11:58

webdawg
Member
Registered: 2010-12-28
Posts: 62

Re: XFCE - Switching Desktops - Show me the desktop!!! (Like The Money)

Did you make this script or did you find it somewhere?

Offline

#9 2014-01-17 18:58:24

toz
Member
Registered: 2011-10-28
Posts: 498

Re: XFCE - Switching Desktops - Show me the desktop!!! (Like The Money)

webdawg wrote:

Did you make this script or did you find it somewhere?

I was looking for something similar a couple of months back and wrote it.

In case you're interested, I've enhanced it to also show the workspace name centered (though right now the workspace names can't have spaces in them - I blame my mis-understanding of bash arrays for this). Plus some code to ensure that only one instance of it runs.

#!/bin/bash

#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,12\}$/ & /;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

Offline

#10 2015-10-30 10:48:33

rakotomandimby
Member
From: Madagascar
Registered: 2014-05-07
Posts: 20
Website

Offline

#11 2021-04-20 10:18:09

tobecci
Member
From: Owerri, Nigeria
Registered: 2021-04-13
Posts: 1
Website

Re: XFCE - Switching Desktops - Show me the desktop!!! (Like The Money)

I changed the sleep timeout to 0.0001s because I wanted the notification to be faster, I hope that's okay

webdawg wrote:

Works awsome too.  I added the timeout:

#!/bin/bash
#Description: Using notify-send, pop-up the current workspace number when changing workspaces
#Requires: xfce4-notifyd, libnotify, wmctrl

CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
while true
do
        sleep 1
        NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
        if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
                notify-send -t 500 " workspace" "<b><span font='100'>$NEW_WORKSPACE</span></b>"
                CURRENT_WORKSPACE=$NEW_WORKSPACE
        fi
done
exit 0

You know of anyway to have xfce send the notification?  This still works great.

Offline

Board footer

Powered by FluxBB