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.

i'm trying to make a custom launcher in 11.10 for the special force quit launcher we had in 11.04 (you could add it from the list of apps,but now it is nowhere to be found ,even in alacarte ..) .. so i try using infos from here but i have no idea what the actual file or command is for force quit nor where it is in the filesystem..

this question is real specific to force quit itself and is not about asking how to create a launcher ..

i will create a file called forcequit.desktop and put it in ~/.local/share/applications folder and will then drag it unto the toolbar like it is told elsewhere.

the content of the file will look like this:

#!/usr/bin/env xdg-open  
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=sh -c 'notify-send "Click on an application to force-close it, or press Esc to cancel."; xkill'
Name=Force Quit
Comment=Click on the app to quit with your pointer
Icon=gnome-panel-force-quit
Categories=System,Accessories;

i suppose it might be a special command that takes an argument,again if you have the info please do tell :)

i wrote comments in the file about the infos i need..

edit: ok now it works with showing a special X icon and does force quit properly.. now i just need to find out how to get instructions to appear for an end user,just like it does when using from CLI.. i'd suppose it displays the launcher's comment on screen somewhere ? any ideas or links ? or maybe i need to add something to this launcher file ?

last edit: well the solution from the above edit has been found ,it is the usage of notify send that does the trick ..like it is now reflected in the code .. enjoy the solution for your desktop (or for end users you support !)

lastest edit: all this talk makes me want to go look for notify-send options a little more..and well in a greater scale at all the other commands i can use.....notify-send is part of gnome is it ? or is it part of sh ?(i doubt it's from sh)

edit to the lastest edit : nevermind that.. i found an answer to that as well.. notify-send is part of the libnotify library package..and notify-send is in the tools folder (i had trouble finding it at first..) and no it isnt specifically part of gnome,but rather another library used by many apps :)

share|improve this question

5 Answers 5

up vote 10 down vote accepted

The command, as WarriorIng64 already said, is xkill.

To show some instructions for the end user, maybe use

notify-send "Click on an application to force-close it, or right-click to cancel."

Now to combine two commands into one launcher, you'll have to wrap them in sh -c '...', so your .desktop file should say

Exec=sh -c 'notify-send "Click on an application to force-close it, or right-click to cancel."; xkill'
share|improve this answer
    
Well worth a vote for beating me by 15 minutes! –  Scaine Oct 25 '11 at 19:29
    
that notify send does the final trick :) –  marc-andre benoit Oct 25 '11 at 20:58
1  
@Marius This is clearly superior to my accepted answer. Good job making it more presentable and user-friendly! –  Christopher Kyle Horton Oct 26 '11 at 1:47
    
in conclusion i wonder about using sh VS bash.. it it just for the sake of portability (for everyone has sh ,but not everyone might use/have bash(which in itself is odd but possible!)) –  marc-andre benoit Oct 26 '11 at 14:25
1  
At least for me on Ubuntu 11.04, escape does not work, but right-clicking will cancel the xkill prompt. –  Shane Oct 30 '11 at 15:32

Instead of writing your own you can try this:

Flashfreeze

Go here and check it out; http://www.omgubuntu.co.uk/2011/10/freezeunfreeze-unity-app-killer/

or http://www.omgubuntu.co.uk/2011/10/force-quit-applet-unity-launcher/

share|improve this answer
    
hum.. not much useful other than point me toward the icon (after downloading and reading through the source code from the script file .. i don't need an unfreeze and such :) but thanks for your answer.. –  marc-andre benoit Oct 25 '11 at 18:45
    
But there's no way to make this menu appear (e.g. by shift-clicking). Sometimes it will appear if an application is properly frozen, but if an app is still responsive but refuses to quit? You're out of luck. –  Timmmm Feb 9 '13 at 22:46

I don't know if there is an icon for force quit, but the relevant command is xkill.

share|improve this answer
1  
the icon actually is gnome-panel-force-quit i'll edit right now accordingly.. –  marc-andre benoit Oct 25 '11 at 18:38

If you absolutely need the notification, then you can achieve this with notify-send.

Create the following file, perhaps as forceclose :

#! /bin/sh 

notify-send 'Force close application' 'Select a window to close it.  All data in that window will be lost.  Right click to cancel.' --icon=gtk-cancel
xkill

Then mark it as a script with chmod +x forceclose

Then either :

a) move it to your /bin directory with sudo mv forceclose /bin/forceclose and change your launcher to call forceclose instead of xkill. (useful for multiple users of the same system, perhaps)

or

b) change your launcher to point to whichever directory contains your forceclose script. Note that other users of that system obviously won't be able to use your script.

share|improve this answer
1  
And I see that Marius beat me by the 15 minutes it took me to research that answer and post it... <sigh> –  Scaine Oct 25 '11 at 19:29
    
too intricate ,but thanks for your effort! i mean it's more elegant to have it all in one single file,rather than creating an extra one :) the solution proposed by marius does exactly that better luck next time ! –  marc-andre benoit Oct 25 '11 at 21:13
    
You made a big deal about the notification for your "users", so I assumed you might have multiple users on each system, in which case, adding it to /bin makes sense. Glad you found an answer that suits though. –  Scaine Oct 25 '11 at 23:11
1  
p.s. creating a file, marking it as executable and copying it to another location is "too intricate"?!? I'm not sure you have the right word there! :-) –  Scaine Oct 25 '11 at 23:14
    
yeah sorry.. i was just really tired ,i was on a power nap marathon (4 days straight) what i meant is just that having the notification embedded in code versus in a separate file made for a smaller footprint,just one file instead of two,but looking back the extra file makes for a better modularity which can be important in bigger projects i guess :) –  marc-andre benoit Oct 26 '11 at 13:55
  1. Press Alt+F2.
  2. Type xkill. then press Enter.
  3. Click on the window you want to kill (right click to abort).
share|improve this answer
1  
This would work, but the OP is asking how to actually turn it into a launcher you can click. –  Christopher Kyle Horton Oct 25 '11 at 18:40
    
i know how to do this on CLI but i have users that want nothing to do with it :) which is the reason i ask the question in the first place .. –  marc-andre benoit Oct 25 '11 at 18:42

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.