On 21-Jan-2003/09:53 -0500, Billy Davis <[EMAIL PROTECTED]> wrote:
>Thanks Tony.  This looks like what I want, except  how do I specify a
>different 'myprogram' for each login account?

The GNOME session settings are inherently per-user. There is no way to set
it once and have it apply to all users. You have to set it for each user,
so setting the desired program is not a problem... except that this could
be a lot of work if there are a lot of users.

Another way to do this is to call a script from within each user's
~/.bash_profile. The script would check to see if it's running under X,
then call the app appropriately.

#!/bin/bash
if [ -n "$DISPLAY" ]; then
  gnome-terminal --title 'My Program' -x myprogram &
else
  myprogram
fi


Ideally, you'd put the users into groups and have the script run the
correct app based on the user's group membership.

#!/bin/bash
for groupname in `grep $LOGNAME /etc/group | cut -f 1 -d :`
do
  case $groupname in
    sales)
      appname=salesapp;;
    production)
      appname=prodapp;;
    execs)
      appname=execapp;;
  esac
done

if [ -n "$DISPLAY" ]; then
  gnome-terminal -x $appname &
else
  $appname
fi


The way I wrote this, if more than one group matches, the app will be
based on the last group to match. You can use the first match by adding an
'if' test before the 'case' statement:  

do
  if [ -z "$appname ]; then
    case...
    esac
  fi
done

I don't know of a way to use the "most significant" match. You basically
have to manage group memberships in order for this to work.

Tony
-- 
Anthony E. Greene <mailto:[EMAIL PROTECTED]%3E>
OpenPGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
AOL/Yahoo Messenger: TonyG05    HomePage: <http://www.pobox.com/~agreene/>
Linux. The choice of a GNU generation <http://www.linux.org/>



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to