2

I have this python script that connects my desktop to the internet. there is not much text in it only a few messages about current status and time. So it would be really nice if i can open it (.sh file that opens the .py file) in a terminal that has a particular profile (with short frame size and dark background etc.)

1 Answer 1

2

Put following script at the end of ~/.bashrc:

if [ x$DISPLAY != x ] ; then
    gnome-terminal --save-config=/tmp/prof
    PROFILE=$(grep 'ProfileID=' /tmp/prof | sed 's/ProfileID=//g' | tail -1)
    if [ "$PROFILE" == "Profile1" ] ; then
        # run your script here
    fi
fi

First if statement checks if you are running GNOME terminal, not a virtual console one. Then configuration of profile is saved into /tmp/prof. Third line reads profile name from that file. Inner if statement checks if it's a profile in which you want to call your script.

To list names of your profiles run:

$ gconftool-2 --get /apps/gnome-terminal/global/profile_list
[Default,Profile0,Profile1]
1
  • It worked! yay. Thankyou for the well written answer. Commented Jun 14, 2013 at 18:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .