Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-04-2004, 07:16 AM   #1
Registered: Mar 2003
Location: UK
Distribution: gentoo
Posts: 67

Rep: Reputation: 15
XFCE 2 state launcher conundrum

I wondered if anyone out there knew how to use the 2 state launcher in XFCE. Basically I want to create a launcher that mounts/unmounts my usb drive. Not I guess I need to write a script to do the mounting/unmounting but I'm confused as to how the script should work. How does the launcher determine whether to display the on or off icon? Does my script need to return a particular value for that? How does my script differentiate between a click on the launcher from the mouse from the launcher just polling the script to detect the state of the icon (on or off). Or is it all something else entirely?

It would be really good to get my usb drive mounting/unmounting and reflecting it's state so any help would be appreciated.
Old 08-04-2004, 10:03 AM   #2
Registered: Mar 2003
Location: UK
Distribution: gentoo
Posts: 67

Original Poster
Rep: Reputation: 15
Okay after a bit of dipping into the source code and some experimentation I have a working script
I'll post it here for future googlers to find

Basically when you click on the launcher in xfce's panel the script is called with either a "1" or a "0" added as a parameter. When the launcher is just querying the script no parameters are added and the output of the script is collected (it needs to be a "1" or a "0".

So here's the basic script...


# mount
#  0 -> success
# 32 -> failed to mount


if [ $# -gt 0 ]; then

	if [ ${action} = "1" ]; then

		mount ${mpoint} > /dev/null
		if [ ${err} -eq 0 ]; then

			#echo "success"
			echo "1" > ~/.usbmount



		umount ${mpoint} > /dev/null
		if [ ${err} -eq 0 ]; then

			#echo "success"
			echo "0" > ~/.usbmount



	cat ~/.usbmount

This can definately be improved upon. Don't hesitate to post it here if ou do

Last edited by Galik; 08-04-2004 at 10:06 AM.
Old 08-04-2004, 09:12 PM   #3
Senior Member
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Well Done.
This script works very well.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Xfce problems with task bar and xfce-panel aeruzcar Linux - Software 4 06-26-2006 06:29 AM
Creating a launcher (could be java launcher) The_Messiah Linux - Newbie 12 04-06-2005 02:36 AM
poweroff reboot launcher for xfce w/ KDM? r_jensen11 Linux - Software 2 01-17-2004 05:00 PM
XFCE and kde/gnome apps (launcher menu question) JimDog Linux - Newbie 2 10-11-2003 08:43 AM
Quite the conundrum...... Randall Linux - Newbie 10 11-09-2001 06:38 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration