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've downloaded from the USC an app that grabs colors with the mouse (result shows in the terminal) and I'm trying to add a unity launcher app to run that command in the gnome-terminal.

Here is the code:

#!/usr/bin/bash
[Desktop Entry]
Type=Application
Name=Grab Color
Exec=gnome-terminal -x grabc
Categories=Development;
Icon=/home/diogo/.local/share/applications/colorline.png

The problem is that when I click the icon the terminal opens and closes. I just want it to be open in order to see the grabbed color.

Can someone help me? :(

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

You can create a simple shell script to grab the color and copy the output to clipboard and using that in the desktop file

Here is the shell script. I have named it as grab.sh

#!/bin/bash
OUT=`grabc`
echo ${OUT} | xclip -sel clip

Change your .desktop contents

[Desktop Entry]
Type=Application
Name=Grab Color
Exec= sh /home/user/grab.sh
Categories=Development;
Icon=/home/diogo/.local/share/applications/colorline.png

This will copy the output to clipboard. You need to have xclip installed. If its not installed. Install it using command.

sudo apt-get install xclip
share|improve this answer
    
Yes! It works very nice :D thank you a lot! :D –  DeviDarkL Nov 26 '12 at 15:21
    
Glad that it helped you. –  devav2 Nov 26 '12 at 15:26
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.