Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is it possible to execute an action (a command or a Bash Script) by double clicking on the Desktop?

I want to emulate the function that Fences does in Windows systems: By double clicking the desktop, you show/hide the icons/folders you have in the Desktop.

The script is not the problem, what I want to know is how to execute it when double clicking on an unused area of my desktop.

share|improve this question
    
The odds of this never happening are slim. askubuntu.com/q/25904/8515 –  djeikyb Feb 12 '11 at 2:00
    
Use .desktop files. –  Pedram Feb 12 '11 at 2:47
1  
Compiz can handle mouse events on the desktop, it can trigger actions by moving the mouse to screen edges. I think you should try to make it a Compiz addon and ask help from Compiz developers. –  Nyamiou The Galeanthrope Feb 12 '11 at 21:43
    
@djeikyb: That was some user from Ubuntu's IRC channel. I asked first there, and I was told to post the question in here, but he also posted it. @Pedram, what do you mean by using .desktop files? –  David Reza Feb 12 '11 at 22:51
    
@David.. Pedram is suggesting that you can double-click on an icon; a .desktop file's icon... but you mean the double clicking on an unused deskop area..... (btw.. I mistakenly clicked on 'down-vote' instead of 'favourites' and I am disallowed from changing it back until the question is modified, so if you make a tiny modificaton, I will remove my unintentional down-vote. –  Peter.O Feb 13 '11 at 8:15
show 1 more comment

3 Answers

I'm guessing you mean by clicking on the desktop itself, rather than an Icon on the desktop (the latter can be done just by having the script in your desktop folder...)

If you're willing to compromise a little, using CCSM

apt-get install compizconfig-settings-manager

The 'commands' plugin allows you to bind commands (like running your script) to events. Under the 'Button Bindings' tab you can assign your command to when you Click while your mouse is on one of the edges. I appreciate this isn't the complete solution, but as you can select all of the edges, it'll almost do what you want.

Hope that gets you some of the way.

share|improve this answer
add comment

This is completely possible. If you place any program (script or binary) on your Desktop and ensure that it has execute permission, it will be executed by double-click by the vast majority of desktop rendering software (very definitely thunar and nautilus, but anything else that follows the same specifications). Note that some desktop handlers may ask for confirmation that you wish to run, rather than view, the program, depending on the implementation of the program (this is in part to workaround a historical issue that files from FAT tend to all be marked executable, even when one doesn't want to execute them).

If you prefer a pretty icon, create a .desktop file on your desktop referencing the program you wish to run. If this is granted execute permission, any compliant desktop rendering program will launch the program as described in the .desktop file, and should do so without asking for confirmation in any way.

The specification for creation of .desktop files is http://standards.freedesktop.org/desktop-entry-spec/latest/ , or you might start with something already created under /usr/share/applications/ . You can check to make sure your .desktop file is correctly written with the 'desktop-file-validate' program from desktop-file-utils.

share|improve this answer
add comment

As far as the icon organising feature of Fences: I haven't found anything yet for GNOME, but KDE.4 has a desktop widget called FolderView that I think does close to what you want. Here's the announcement, search for "folderview":

http://www.kde.org/announcements/4.2/desktop.php

share|improve this answer
    
Yeah, that also works for GNOME, it's a screenlet, but I'm not looking for the organising feature, I'm looking for the hide/show icons feature. –  David Reza Feb 24 '11 at 2:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.